本文整理汇总了TypeScript中angular.IQService.all方法的典型用法代码示例。如果您正苦于以下问题:TypeScript IQService.all方法的具体用法?TypeScript IQService.all怎么用?TypeScript IQService.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular.IQService
的用法示例。
在下文中一共展示了IQService.all方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: buildNewServerGroupCommand
public buildNewServerGroupCommand(app: Application,
selectedProvider = 'appengine',
mode = 'create'): IPromise<IAppengineServerGroupCommand> {
const dataToFetch = {
accounts: this.accountService.getAllAccountDetailsForProvider('appengine'),
};
const viewState: IViewState = {
mode: mode,
submitButtonLabel: this.getSubmitButtonLabel(mode),
disableStrategySelection: mode === 'create' ? true : false,
};
return this.$q.all(dataToFetch)
.then((backingData: any) => {
const credentials: string = this.getCredentials(backingData.accounts, app);
const region: string = this.getRegion(backingData.accounts, credentials);
return {
application: app.name,
backingData,
viewState,
credentials,
region,
selectedProvider,
interestingHealthProviderNames: [],
} as IAppengineServerGroupCommand;
});
}
示例2: getPipelineTemplatesByScopes
public getPipelineTemplatesByScopes(scopes: string[]): IPromise<IPipelineTemplate[]> {
return this.$q.all(scopes.map(this.getPipelineTemplatesByScope)).then(flatten)
.then(templates => {
templates.forEach(template => template.selfLink = `spinnaker://${template.id}`);
return templates;
});
}
示例3: search
search(options: any) {
const sections: any = {};
const promises = [];
const query = _.clone(options);
const hasFilters =
options.query ||
(options.tag && options.tag.length > 0) ||
options.starred ||
(options.folderIds && options.folderIds.length > 0);
if (!options.skipRecent && !hasFilters) {
promises.push(this.getRecentDashboards(sections));
}
if (!options.skipStarred && !hasFilters) {
promises.push(this.getStarred(sections));
}
query.folderIds = query.folderIds || [];
if (!hasFilters) {
query.folderIds = [0];
}
promises.push(
this.backendSrv.search(query).then(results => {
return this.handleSearchResult(sections, results);
})
);
return this.$q.all(promises).then(() => {
return _.sortBy(_.values(sections), 'score');
});
}
示例4: keys
.then((backingData: Partial<IEcsServerGroupCommandBackingData>) => {
let loadBalancerReloader = this.$q.when();
backingData.accounts = keys(backingData.credentialsKeyedByAccount);
backingData.filtered = {} as IEcsServerGroupCommandBackingDataFiltered;
cmd.backingData = backingData as IEcsServerGroupCommandBackingData;
this.configureVpcId(cmd);
this.configureAvailableIamRoles(cmd);
this.configureAvailableSubnetTypes(cmd);
this.configureAvailableSecurityGroups(cmd);
this.configureAvailableMetricAlarms(cmd);
this.configureAvailableEcsClusters(cmd);
if (cmd.loadBalancers && cmd.loadBalancers.length) {
// verify all load balancers are accounted for; otherwise, try refreshing load balancers cache
const loadBalancerNames = this.getLoadBalancerNames(cmd);
if (intersection(loadBalancerNames, cmd.loadBalancers).length < cmd.loadBalancers.length) {
loadBalancerReloader = this.refreshLoadBalancers(cmd, true);
}
}
return this.$q.all([loadBalancerReloader]).then(() => {
this.applyOverrides('afterConfiguration', cmd);
this.attachEventHandlers(cmd);
});
});
示例5: getAllEntityTags
public getAllEntityTags(entityType: string, entityIds: string[]): IPromise<IEntityTags[]> {
if (!entityIds || !entityIds.length) {
return this.$q.when([]);
}
const idGroups: string[] = this.collateEntityIds(entityType, uniq(entityIds));
const succeeded = (val: IEntityTags[]) => val !== null;
const sources = idGroups.map(idGroup => this.retryService.buildRetrySequence<IEntityTags[]>(
() => this.API.one('tags')
.withParams({
entityType: entityType.toLowerCase(),
entityId: idGroup
}).getList(),
succeeded, 1, 0)
);
const result: IDeferred<IEntityTags[]> = this.$q.defer();
this.$q.all(sources).then(
(entityTagGroups: IEntityTags[][]) => {
const allTags: IEntityTags[] = this.flattenTagsAndAddMetadata(entityTagGroups);
result.resolve(allTags);
})
.catch(() => {
this.$exceptionHandler(new Error(`Failed to load ${entityType} entity tags; groups: \n${idGroups.join('\n')}`));
result.resolve([]);
});
return result.promise;
}
示例6: getAllEntityTags
public getAllEntityTags(entityType: string, entityIds: string[]): IPromise<IEntityTags[]> {
if (!entityIds || !entityIds.length) {
return this.$q.when([]);
}
const idGroups: ICollatedIdGroup[] = this.collateEntityIds(entityType, entityIds);
const succeeded = (val: IEntityTags[]) => val !== null;
const sources = idGroups.map(idGroup => this.retryService.buildRetrySequence<IEntityTags[]>(
() => this.API.one('tags')
.withParams({
entityType: entityType.toLowerCase(),
entityId: idGroup.entityId,
maxResults: idGroup.maxResults,
}).getList(),
succeeded, 1, 0)
);
const result: IDeferred<IEntityTags[]> = this.$q.defer();
this.$q.all(sources).then(
(entityTagGroups: IEntityTags[][]) => {
const allTags: IEntityTags[] = this.flattenTagsAndAddMetadata(entityTagGroups);
result.resolve(allTags);
})
.catch(() => {
result.resolve([]);
});
return result.promise;
}
示例7: applicationAccounts
public applicationAccounts(application: Application = null): IPromise<IAccountDetails[]> {
return this.$q.all([this.listProviders(application), this.listAccounts()]).then(([providers, accounts]) => {
return providers.reduce((memo, p) => {
return memo.concat(accounts.filter(acc => acc.cloudProvider === p));
}, [] as IAccountDetails[]);
});
}
示例8: placeOrders
// todo: add return type
placeOrders(orders: IOrder[]): IPromise<IOrder[]> {
const url = this.lConfig.apiUrl + '/orders';
const allOrdersPlacedPromise = map(orders, order => {
return this.$http.post(url, this.prepareOrderForApi(order));
});
return this.$q.all(allOrdersPlacedPromise);
}
示例9: configureCommand
// TODO (Bruno Carrier): Why do we need to inject an Application into this constructor so that the app works? This is strange, and needs investigating
public configureCommand(command: IEcsServerGroupCommand): IPromise<void> {
this.applyOverrides('beforeConfiguration', command);
command.toggleSuspendedProcess = (process: string): void => {
command.suspendedProcesses = command.suspendedProcesses || [];
const processIndex = command.suspendedProcesses.indexOf(process);
if (processIndex === -1) {
command.suspendedProcesses.push(process);
} else {
command.suspendedProcesses.splice(processIndex, 1);
}
};
command.processIsSuspended = (process: string): boolean => command.suspendedProcesses.includes(process);
command.onStrategyChange = (strategy: IDeploymentStrategy): void => {
// Any strategy other than None or Custom should force traffic to be enabled
if (strategy.key !== '' && strategy.key !== 'custom') {
command.suspendedProcesses = (command.suspendedProcesses || []).filter(p => p !== 'AddToLoadBalancer');
}
};
command.regionIsDeprecated = (): boolean => {
return has(command, 'backingData.filtered.regions') &&
command.backingData.filtered.regions.some((region) => region.name === command.region && region.deprecated);
};
return this.$q.all({
credentialsKeyedByAccount: this.accountService.getCredentialsKeyedByAccount('ecs'),
loadBalancers: this.loadBalancerReader.listLoadBalancers('ecs'),
subnets: this.subnetReader.listSubnets(),
iamRoles: this.iamRoleReader.listRoles('ecs'),
ecsClusters: this.ecsClusterReader.listClusters(),
metricAlarms: this.metricAlarmReader.listMetricAlarms(),
}).then((backingData: Partial<IEcsServerGroupCommandBackingData>) => {
let loadBalancerReloader = this.$q.when(null);
backingData.accounts = keys(backingData.credentialsKeyedByAccount);
backingData.filtered = {} as IEcsServerGroupCommandBackingDataFiltered;
command.backingData = backingData as IEcsServerGroupCommandBackingData;
this.configureVpcId(command);
this.configureAvailableIamRoles(command);
this.configureAvailableMetricAlarms(command);
this.configureAvailableEcsClusters(command);
if (command.loadBalancers && command.loadBalancers.length) {
// verify all load balancers are accounted for; otherwise, try refreshing load balancers cache
const loadBalancerNames = this.getLoadBalancerNames(command);
if (intersection(loadBalancerNames, command.loadBalancers).length < command.loadBalancers.length) {
loadBalancerReloader = this.refreshLoadBalancers(command, true);
}
}
return this.$q.all([loadBalancerReloader]).then(() => {
this.applyOverrides('afterConfiguration', command);
this.attachEventHandlers(command);
});
});
}
示例10: buildNewManifestCommand
public buildNewManifestCommand(app: Application, sourceManifest?: any, sourceMoniker?: IMoniker): IPromise<IKubernetesManifestCommandData> {
const dataToFetch = {
accounts: this.accountService.getAllAccountDetailsForProvider('kubernetes', 'v2'),
artifactAccounts: this.accountService.getArtifactAccounts(),
};
return this.$q.all(dataToFetch)
.then((backingData: any) => {
const accountData = backingData.accounts[0];
let account: string = null;
if (accountData) {
account = accountData.name;
}
let manifestArtifactAccount: string = null;
const artifactAccountData = backingData.artifactAccounts[0];
if (artifactAccountData) {
manifestArtifactAccount = artifactAccountData.name;
}
const manifest: any = null;
const manifests: any = null;
const manifestText = !sourceManifest ? '' : dump(sourceManifest);
const cloudProvider = 'kubernetes';
const moniker = sourceMoniker || {
app: app.name,
};
const relationships = {
loadBalancers: [] as string[],
securityGroups: [] as string[],
};
const versioned: any = null;
return {
command: {
cloudProvider,
manifest,
manifests,
relationships,
moniker,
account,
versioned,
manifestArtifactAccount,
},
metadata: {
backingData,
manifestText,
}
} as IKubernetesManifestCommandData;
});
}