• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript azure-devops-extension-api.IExtensionDataManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中azure-devops-extension-api.IExtensionDataManager的典型用法代码示例。如果您正苦于以下问题:TypeScript IExtensionDataManager类的具体用法?TypeScript IExtensionDataManager怎么用?TypeScript IExtensionDataManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了IExtensionDataManager类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: removeSession

    async removeSession(id: string): Promise<void> {
        const manager = await this.getManager();

        try {
            await manager.deleteDocument(await this._getCollection(), id);
        } catch {
            try {
                // Try again with legacy collection
                await manager.deleteDocument("sessions", id);
            } catch {
                // Ignore
            }
        }
    }
开发者ID:cschleiden,项目名称:vsts-estimate,代码行数:14,代码来源:sessions.ts


示例2: getLegacySession

    async getLegacySession(id: string): Promise<ISession | null> {
        const manager = await this.getManager();

        try {
            const legacySession: ILegacySession = await manager.getDocument(
                "EstimationSessions",
                id,
                {
                    defaultValue: null
                }
            );

            return {
                id: legacySession.id,
                name: `Migrated: '${legacySession.name}'`,
                mode: SessionMode.Online,
                source: SessionSource.Ids,
                sourceData: legacySession.workItemIds,
                version: 1,
                createdAt: legacySession.createdAt,
                createdBy: legacySession.creatorId,
                cardSet: defaultCardSets[0].id, // Always use the first card set for migrated sessions
                isLegacy: true
            };
        } catch {
            return null;
        }
    }
开发者ID:cschleiden,项目名称:vsts-estimate,代码行数:28,代码来源:sessions.ts


示例3:

    async setSettingsValue<T>(
        projectId: string,
        id: string,
        value: T
    ): Promise<void> {
        const manager = await this.getManager();

        await manager.setValue(`${projectId}-${id}`, value);
    }
开发者ID:cschleiden,项目名称:vsts-estimate,代码行数:9,代码来源:sessions.ts


示例4: getSessions

    async getSessions(): Promise<ISession[]> {
        const manager = await this.getManager();

        try {
            // Try legacy and current collection
            const sessions: ISession[][] = await Promise.all(
                [
                    manager.getDocuments("sessions", {
                        defaultValue: []
                    }),
                    manager.getDocuments(await this._getCollection(), {
                        defaultValue: []
                    })
                ].map(p => p.catch(() => []))
            );

            return sessions.flat();
        } catch {
            return [];
        }
    }
开发者ID:cschleiden,项目名称:vsts-estimate,代码行数:21,代码来源:sessions.ts


示例5: getSession

    async getSession(id: string): Promise<ISession | null> {
        const manager = await this.getManager();

        try {
            const session: ISession | null = await manager.getDocument(
                await this._getCollection(),
                id,
                {
                    defaultValue: null
                }
            );

            return session;
        } catch {
            return null;
        }
    }
开发者ID:cschleiden,项目名称:vsts-estimate,代码行数:17,代码来源:sessions.ts


示例6: getDocument

    private async getDocument(sessionId: string): Promise<ISessionDocument> {
        const defaultValue: ISessionDocument = {
            id: sessionId,
            sessionEstimates: {}
        };

        const manager = await this.getManager();
        try {
            const document = await manager.getDocument(
                OfflineEstimationCollection,
                sessionId,
                {
                    defaultValue
                }
            );
            return document;
        } catch (e) {
            // Collection does not exist
            return defaultValue;
        }
    }
开发者ID:cschleiden,项目名称:vsts-estimate,代码行数:21,代码来源:estimation.ts


示例7: getLegacySessions

    async getLegacySessions(): Promise<ISession[]> {
        const manager = await this.getManager();

        try {
            const legacySession: ILegacySession[] = await manager.getDocuments(
                "EstimationSessions"
            );

            return legacySession.map<ISession>(ls => ({
                id: ls.id,
                name: `Migrated: '${ls.name}'`,
                mode: SessionMode.Online,
                source: SessionSource.Ids,
                sourceData: ls.workItemIds,
                version: 1,
                createdAt: ls.createdAt,
                createdBy: ls.creatorId,
                cardSet: defaultCardSets[0].id // Always use the first card set for migrated sessions
            }));
        } catch {
            return [];
        }
    }
开发者ID:cschleiden,项目名称:vsts-estimate,代码行数:23,代码来源:sessions.ts


示例8: estimate

    async estimate(sessionId: string, estimate: IEstimate): Promise<void> {
        const document = await this.getDocument(sessionId);
        const { sessionEstimates } = document;

        let estimates = sessionEstimates[estimate.workItemId];
        if (!estimates) {
            estimates = sessionEstimates[estimate.workItemId] = [];
        }

        const idx = estimates.findIndex(
            x => x.identity.id === estimate.identity.id
        );
        if (idx !== -1) {
            estimates[idx] = estimate;
        } else {
            estimates.push(estimate);
        }

        const manager = await this.getManager();
        manager.setDocument(OfflineEstimationCollection, {
            ...document,
            sessionEstimates
        });
    }
开发者ID:cschleiden,项目名称:vsts-estimate,代码行数:24,代码来源:estimation.ts


示例9: saveSession

 async saveSession(session: ISession): Promise<ISession> {
     const manager = await this.getManager();
     await manager.setDocument(await this._getCollection(), session);
     return session;
 }
开发者ID:cschleiden,项目名称:vsts-estimate,代码行数:5,代码来源:sessions.ts



注:本文中的azure-devops-extension-api.IExtensionDataManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript BuildApi.IBuildApi类代码示例发布时间:2022-05-25
下一篇:
TypeScript azure-devops-extension-api.getClient函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap