本文整理汇总了TypeScript中core/application/application.model.Application.getDataSource方法的典型用法代码示例。如果您正苦于以下问题:TypeScript model.Application.getDataSource方法的具体用法?TypeScript model.Application.getDataSource怎么用?TypeScript model.Application.getDataSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core/application/application.model.Application
的用法示例。
在下文中一共展示了model.Application.getDataSource方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('sets appropriate flags when task load fails', function () {
spyOn(taskReader, 'getTasks').and.returnValue($q.reject(null));
configureApplication();
expect(application.getDataSource('tasks').loaded).toBe(false);
expect(application.getDataSource('tasks').loading).toBe(false);
expect(application.getDataSource('tasks').loadFailure).toBe(true);
});
示例2: it
it('loads tasks and sets appropriate flags', function() {
spyOn(TaskReader, 'getTasks').and.returnValue($q.when([]));
configureApplication();
expect(application.getDataSource('tasks').loaded).toBe(true);
expect(application.getDataSource('tasks').loading).toBe(false);
expect(application.getDataSource('tasks').loadFailure).toBe(false);
});
示例3: it
it('sets appropriate flags when execution load fails', function () {
spyOn(executionService, 'getExecutions').and.returnValue($q.reject(null));
configureApplication();
application.getDataSource('executions').activate();
$scope.$digest();
expect(application.getDataSource('executions').loaded).toBe(false);
expect(application.getDataSource('executions').loading).toBe(false);
expect(application.getDataSource('executions').loadFailure).toBe(true);
});
示例4: handleTaskSuccess
public handleTaskSuccess(task: ITask): void {
this.task = task;
if (this.application && this.application.getDataSource('runningTasks')) {
this.application.getDataSource('runningTasks').refresh();
}
this.taskReader.waitUntilTaskCompletes(task, this.monitorInterval)
.then(() => this.onTaskComplete ? this.onTaskComplete() : noop)
.catch(() => this.setError(task));
}
示例5: addTagsToExecutions
public static addTagsToExecutions(application: Application): void {
if (!SETTINGS.feature.entityTags) {
return;
}
const allTags = application.getDataSource('entityTags').data;
const executionTags: IEntityTags[] = allTags.filter(t => t.entityRef.entityType === 'execution');
application.getDataSource('executions').data.forEach((execution: IExecution) => {
execution.entityTags = executionTags.find(t => t.entityRef.entityId === execution.id);
});
}
示例6: addTagsToPipelines
public static addTagsToPipelines(application: Application): void {
if (!SETTINGS.feature.entityTags) {
return;
}
const allTags = application.getDataSource('entityTags').data;
const pipelineTags: IEntityTags[] = allTags.filter(t => t.entityRef.entityType === 'pipeline');
application.getDataSource('pipelineConfigs').data.forEach((pipeline: IPipeline) => {
pipeline.entityTags = pipelineTags.find(t => t.entityRef.entityId === pipeline.id);
});
}
示例7: addTagsToLoadBalancers
public addTagsToLoadBalancers(application: Application): void {
if (!SETTINGS.feature.entityTags) {
return;
}
const allTags = application.getDataSource('entityTags').data;
const serverGroupTags: IEntityTags[] = allTags.filter(t => t.entityRef.entityType === 'loadbalancer');
application.getDataSource('loadBalancers').data.forEach((loadBalancer: ILoadBalancer) => {
loadBalancer.entityTags = serverGroupTags.find(t => t.entityRef.entityId === loadBalancer.name &&
t.entityRef.account === loadBalancer.account &&
t.entityRef.region === loadBalancer.region);
});
}
示例8: addTagsToSecurityGroups
public addTagsToSecurityGroups(application: Application): void {
if (!SETTINGS.feature.entityTags) {
return;
}
const allTags = application.getDataSource('entityTags').data;
const securityGroupTags: IEntityTags[] = allTags.filter(t => t.entityRef.entityType === 'securitygroup');
application.getDataSource('securityGroups').data.forEach((securityGroup: ISecurityGroup) => {
securityGroup.entityTags = securityGroupTags.find(t => t.entityRef.entityId === securityGroup.name &&
t.entityRef.account === securityGroup.account &&
t.entityRef.region === securityGroup.region);
});
}
示例9: attachSecurityGroups
private attachSecurityGroups(
application: Application,
nameBasedSecurityGroups: ISecurityGroup[],
retryIfNotFound: boolean,
): IPromise<any[]> {
let data: ISecurityGroup[] = [];
let notFoundCaught = false;
if (nameBasedSecurityGroups) {
// reset everything
application.getDataSource('securityGroups').data = [];
const nameBasedGroups: ISecurityGroupProcessorResult = this.addNameBasedSecurityGroups(
application,
nameBasedSecurityGroups,
);
notFoundCaught = nameBasedGroups.notFoundCaught;
if (!nameBasedGroups.notFoundCaught) {
data = nameBasedGroups.securityGroups;
}
} else {
// filter down to empty (name-based only) firewalls - we will repopulate usages
data = application
.getDataSource('securityGroups')
.data.filter(
(group: ISecurityGroup) => !group.usages.serverGroups.length && !group.usages.loadBalancers.length,
);
}
if (!notFoundCaught) {
const loadBalancerSecurityGroups: ISecurityGroupProcessorResult = this.addLoadBalancerSecurityGroups(application);
notFoundCaught = loadBalancerSecurityGroups.notFoundCaught;
if (!notFoundCaught) {
data = data.concat(loadBalancerSecurityGroups.securityGroups.filter((sg: any) => !data.includes(sg)));
const serverGroupSecurityGroups: ISecurityGroupProcessorResult = this.addServerGroupSecurityGroups(application);
notFoundCaught = serverGroupSecurityGroups.notFoundCaught;
if (!notFoundCaught) {
data = data.concat(serverGroupSecurityGroups.securityGroups.filter((sg: any) => !data.includes(sg)));
}
}
}
data = uniq(data);
if (notFoundCaught && retryIfNotFound) {
this.$log.warn('Clearing firewall cache and trying again...');
return this.clearCacheAndRetryAttachingSecurityGroups(application, nameBasedSecurityGroups);
} else {
data.forEach((sg: ISecurityGroup) => this.addNamePartsToSecurityGroup(sg));
return this.$q
.all(data.map((sg: ISecurityGroup) => this.securityGroupTransformer.normalizeSecurityGroup(sg)))
.then(() => data);
}
}