當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript azure-devops-extension-api.IExtensionDataManager類代碼示例

本文整理匯總了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;未經允許,請勿轉載。