本文整理汇总了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;未经允许,请勿转载。 |
请发表评论