本文整理汇总了TypeScript中VSS/Service.getService函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getService函数的具体用法?TypeScript getService怎么用?TypeScript getService使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getService函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: getService
return getService(CacheableQueryService).getCacheableQueryResult(new MetadataQuery(projectId, MetadataQuery.WorkItemSnapshot)).then(metadata => {
this.state.configOptions.metadata = metadata;
return getService(CacheableQueryService).getCacheableQueryResult(new WitFieldsQuery(projectId)).then(typeFields => {
this.state.configOptions.typeFields = typeFields;
if (typeFields) {
this.state.configOptions.types = this.filterUniqueTypes(typeFields, projectId);
//if work item type isn't selected, choose a default. For sample purpose, use the first type.
if (this.state.configuration.workItemType == null) {
if (this.state.configOptions.types.length > 0) {
this.state.configuration.workItemType = this.state.configOptions.types[0];
} else {
throw "No WorkItemTypes were found on the active project.";
}
}
this.state.configOptions.fields = this.filterFieldsOfType(typeFields, this.state.configuration.workItemType, projectId, this.state.configOptions.metadata,(o)=>{ return this.isAcceptedFilterField(o);});
this.updateFieldFilterControlOptions();
this.updateAggregationControlOptions();
return this.state;
}
this.notifyListenersOfStateChange(this.state);
return this.state;
});
})
开发者ID:Microsoft,项目名称:vsts-extension-samples,代码行数:26,代码来源:AnalyticsConfigActionCreator.ts
示例2: requestData
public requestData(): IPromise<QueryViewState> {
let context = VSS.getWebContext();
this.results.isLoading = true;
if (!areSettingsValid(this.configuration)) {
return this.packErrorMessage("This widget is not properly configured yet.");
}
let now : number = Date.now();
let endDate : Date = new Date(now);
let startDate : Date = new Date(now - (this.rollingPeriodLength * 1000 * 60 * 60 * 24)); // Rolling 60 day period from the current timestamp.
let querySettings = {
projectId: this.configuration.projectId,
teamId: this.configuration.teamId,
workItemType: this.configuration.workItemType,
fields: this.configuration.fields,
startDate: startDate,
endDate: endDate,
aggregation: this.configuration.aggregation
} as BurndownQueryOptions;
return getService(CacheableQueryService).getCacheableQueryResult(new DatesQuery()).then(dates => {
return getService(CacheableQueryService).getCacheableQueryResult(new BurndownResultsQuery(querySettings)).then(groupedWorkItemAggregation => {
if (groupedWorkItemAggregation.length > 0) {
this.results.chartState = new ChartOptionFactory().generateChart(this.size, groupedWorkItemAggregation, dates, this.suppressAnimation)
} else {
this.results.statusMessage = "0 results were found for this query.";
this.results.messageType = WidgetMessageType.Warning;
}
this.results.isLoading = false;
return this.results;
});
});
}
开发者ID:Microsoft,项目名称:vsts-extension-samples,代码行数:35,代码来源:AnalyticsViewActionCreator.ts
示例3: runQuery
public runQuery(): IPromise<PopularValueQueryResults[]> {
return getService(CacheableQueryService).getCacheableQueryResult(new MetadataQuery(this.popularValueQueryOptions.projectId, MetadataQuery.WorkItemSnapshot)).then(result => {
return ODataClient.getInstance().then((client) => {
let entity = "WorkItemSnapshot";
let teamFilter = `Teams/any(t:t/TeamSK eq ${this.popularValueQueryOptions.teamId})`;
let typeFilter = `(WorkItemType eq '${this.popularValueQueryOptions.workItemType}')`;
let filter = `${teamFilter} and ${typeFilter}`;
let fieldQueryingname = mapReferenceNameForQuery(this.popularValueQueryOptions.fieldName, result);
let groupFields = `${fieldQueryingname}`;
let aggregation = `$count as Frequency`;
let aggregationQuery = `${entity}?$apply=filter(${filter})/groupby((${groupFields}),aggregate(${aggregation}))`;
let fullQueryUrl = client.generateProjectLink(this.popularValueQueryOptions.projectId, aggregationQuery);
return client.runGetQuery(fullQueryUrl).then((results: any) => {
let resultSet = results["value"];
if (resultSet === undefined) {
return [];
} else {
resultSet.forEach(element => {
//Re-map the field name to be "Value" for strong type consistency
let temp = element[fieldQueryingname];
element.Value = temp;
});
return resultSet;
}
});
});
});
}
开发者ID:Microsoft,项目名称:vsts-extension-samples,代码行数:31,代码来源:PopularValueQuery.ts
示例4: loadValues
public loadValues(fieldName: string) {
let queryOptions = {
projectId: this.state.configuration.projectId,
teamId: this.state.configuration.teamId,
workItemType: this.state.configuration.workItemType,
fieldName: fieldName
};
return getService(CacheableQueryService).getCacheableQueryResult(new PopularValueQuery(queryOptions));
}
开发者ID:Microsoft,项目名称:vsts-extension-samples,代码行数:10,代码来源:AnalyticsConfigActionCreator.ts
示例5: loadTeams
private loadTeams(projectId: string): IPromise<AnalyticsConfigState> {
return getService(CacheableQueryService).getCacheableQueryResult(new TeamsQuery(projectId)).then(teams => {
this.state.configOptions.teams = teams;
if (!this.state.configuration.teamId) {
this.state.configuration.teamId = teams[0].TeamId;
}
this.notifyListenersOfStateChange(this.state);
return this.state;
});
}
开发者ID:Microsoft,项目名称:vsts-extension-samples,代码行数:11,代码来源:AnalyticsConfigActionCreator.ts
示例6: getService
return getService(CacheableQueryService).getCacheableQueryResult(new DatesQuery()).then(dates => {
return getService(CacheableQueryService).getCacheableQueryResult(new BurndownResultsQuery(querySettings)).then(groupedWorkItemAggregation => {
if (groupedWorkItemAggregation.length > 0) {
this.results.chartState = new ChartOptionFactory().generateChart(this.size, groupedWorkItemAggregation, dates, this.suppressAnimation)
} else {
this.results.statusMessage = "0 results were found for this query.";
this.results.messageType = WidgetMessageType.Warning;
}
this.results.isLoading = false;
return this.results;
});
});
开发者ID:Microsoft,项目名称:vsts-extension-samples,代码行数:12,代码来源:AnalyticsViewActionCreator.ts
示例7: updateFieldFilterFieldState
/**
* Update visual state of filters to reflect new field, and then ensure the value picker settings for the current state is up to date.
*/
public updateFieldFilterFieldState(rowIndex: number, field: WorkItemTypeField) {
let row = this.state.configOptions.fieldFilter.fieldFilterRowValues[rowIndex];
let priorState = row.settings.fieldReferenceName;
row.settings.fieldReferenceName = field.FieldReferenceName;
row.settings.fieldType = field.FieldType;
row.settings.value = null;
this.notifyListenersOfStateChange(this.state);
return getService(CacheableQueryService).getCacheableQueryResult(new MetadataQuery(this.state.configuration.projectId, MetadataQuery.WorkItemSnapshot)).then(metadata => {
row.settings.fieldQueryName = mapReferenceNameForQuery(field.FieldReferenceName, metadata);
if (priorState != field.FieldReferenceName) {
this.loadSuggestedFieldValues(this.state.configuration.projectId, this.state.configuration.teamId, this.state.configuration.workItemType, field.FieldReferenceName).then(() => {
this.notifyListenersOfStateChange(this.state);
})
}
});
}
开发者ID:Microsoft,项目名称:vsts-extension-samples,代码行数:21,代码来源:AnalyticsConfigActionCreator.ts
示例8: loadSuggestedFieldValues
private loadSuggestedFieldValues(projectId: string, teamId: string, workItemType: string, fieldName: string): IPromise<AnalyticsConfigState> {
let params = {
projectId: projectId,
teamId: teamId,
workItemType: workItemType,
fieldName: fieldName
};
return getService(CacheableQueryService).getCacheableQueryResult(new PopularValueQuery(params)).then(results => {
let suggestedValues = this.sortAllowedValues(results);
//Update Fields matching the result FieldName.
this.state.configOptions.fieldFilter.fieldFilterRowValues.forEach(o => {
if (o.settings.fieldReferenceName == fieldName) {
o.suggestedValues = suggestedValues;
if (o.settings.value == null) {
o.settings.value = (o.suggestedValues.length > 0) ? o.suggestedValues[0] : null;
}
}
});
return this.state;
});
}
开发者ID:Microsoft,项目名称:vsts-extension-samples,代码行数:21,代码来源:AnalyticsConfigActionCreator.ts
示例9: requestData
public requestData(): IPromise<AnalyticsConfigState> {
if (!this.state.configuration.projectId) {
this.state.configuration.projectId = VSS.getWebContext().project.id;
this.state.configuration.teamId = VSS.getWebContext().team.id;
}
if (!this.state.configuration.aggregation) {
this.state.configuration.aggregation = { aggregationMode: AggregationMode.count, displayName: null, queryableName: null, fieldReferenceName: null}
}
return getService(CacheableQueryService).getCacheableQueryResult(new ProjectsQuery()).then(projects => {
this.state.configOptions.projects = projects;
this.notifyListenersOfStateChange(this.state);
//If we have a project selected, keep loading on other data.
let teamPromise = this.state.configuration.projectId ? this.loadTeams(this.state.configuration.projectId) : this.endChain();
return teamPromise.then((teams) => {
return this.loadTypeFields(this.state.configuration.projectId).then(() => {
return this.state;
});
});
});
}
开发者ID:Microsoft,项目名称:vsts-extension-samples,代码行数:23,代码来源:AnalyticsConfigActionCreator.ts
注:本文中的VSS/Service.getService函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论