本文整理汇总了TypeScript中core/domain.ITask.getValueFor方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ITask.getValueFor方法的具体用法?TypeScript ITask.getValueFor怎么用?TypeScript ITask.getValueFor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core/domain.ITask
的用法示例。
在下文中一共展示了ITask.getValueFor方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: createCloneTask
private createCloneTask(task: ITask): string | boolean {
const regionAndName: any = task.getValueFor('deploy.server.groups');
const account: string = task.getValueFor('deploy.account.name');
let result: string | boolean;
if (!regionAndName || !Object.keys(regionAndName)[0]) {
result = false;
} else {
const regions: string[] = Object.keys(regionAndName);
const region: string = regions[0];
const asgName: string = regionAndName[region][0];
if (!asgName) {
result = false;
} else if (!asgName.match(NameUtils.VERSION_PATTERN)) {
result = false;
} else {
result = this.$state.href('home.applications.application.insight.clusters.serverGroup', {
application: asgName.split('-')[0],
cluster: asgName.replace(NameUtils.VERSION_PATTERN, ''),
account,
accountId: account,
region: regions,
serverGroup: asgName,
q: asgName,
});
}
}
return result;
}
示例2: rollbackServerGroupTaskMatcher
function rollbackServerGroupTaskMatcher(task: ITask, serverGroup: IServerGroup): boolean {
const account: string = task.getValueFor('credentials'),
region: string = task.getValueFor('regions') ? task.getValueFor('regions')[0] : null;
if (account && serverGroup.account === account && region && serverGroup.region === region) {
return serverGroup.name === task.getValueFor('targetop.asg.disableServerGroup.name') ||
serverGroup.name === task.getValueFor('targetop.asg.enableServerGroup.name');
}
return false;
}
示例3: instanceIdsTaskMatcher
function instanceIdsTaskMatcher(task: ITask, serverGroup: IServerGroup): boolean {
if (task.getValueFor('region') === serverGroup.region && task.getValueFor('credentials') === serverGroup.account) {
if (task.getValueFor('knownInstanceIds')) {
return intersection(map(serverGroup.instances, 'id'), task.getValueFor('knownInstanceIds')).length > 0;
} else {
return intersection(map(serverGroup.instances, 'id'), task.getValueFor('instanceIds')).length > 0;
}
}
return false;
}
示例4: createdeployMatcher
function createdeployMatcher(task: ITask, serverGroup: IServerGroup): boolean {
const account: string = task.getValueFor('deploy.account.name'),
region: string = task.getValueFor('deploy.server.groups') ? Object.keys(task.getValueFor('deploy.server.groups'))[0] : null,
serverGroupName: string = (serverGroup && region) ? task.getValueFor('deploy.server.groups')[region][0] : null;
if (account && serverGroup && region) {
return serverGroup.account === account && serverGroup.region === region && serverGroup.name === serverGroupName;
}
return false;
}
示例5: createcopylastasgMatcher
function createcopylastasgMatcher(task: ITask, serverGroup: IServerGroup): boolean {
const source: any = task.getValueFor('source'),
targetAccount: string = task.getValueFor('deploy.account.name'),
targetRegion: string = task.getValueFor('availabilityZones') ? Object.keys(task.getValueFor('availabilityZones'))[0] : null,
deployedServerGroups: {[region: string]: string[]} = task.getValueFor('deploy.server.groups'),
targetServerGroup: string = targetRegion && deployedServerGroups && deployedServerGroups[targetRegion] ? deployedServerGroups[targetRegion][0] : null,
sourceServerGroup: string = source.asgName,
sourceAccount: string = source.account,
sourceRegion: string = source.region;
const targetMatches = serverGroup.account === targetAccount && serverGroup.region === targetRegion && serverGroup.name === targetServerGroup;
const sourceMatches = serverGroup.account === sourceAccount && serverGroup.region === sourceRegion && serverGroup.name === sourceServerGroup;
return targetMatches || sourceMatches;
}
示例6: getLockFailureException
private static getLockFailureException(task: ITask): string {
const generalException: any = task.getValueFor('exception');
if (generalException) {
const details: any = generalException.details;
if (details && details.currentLockValue) {
let typeDisplay: string;
let linkUrl: string;
if (details.currentLockValue.type === 'orchestration') {
typeDisplay = 'task';
linkUrl = ReactInjector.$state.href('home.applications.application.tasks.taskDetails', {
application: details.currentLockValue.application,
taskId: details.currentLockValue.id,
});
} else {
typeDisplay = 'pipeline';
linkUrl = ReactInjector.$state.href('home.applications.application.pipelines.executionDetails.execution', {
application: details.currentLockValue.application,
executionId: details.currentLockValue.id,
});
}
return `Failed to acquire lock. An <a href="${linkUrl}">existing ${typeDisplay}</a> is currently operating on the cluster.`;
}
}
return null;
}
示例7: taskMatches
export function taskMatches(task: ITask, serverGroup: IServerGroup) {
const matchers: { [type: string]: ITaskMatcher } = {
createcopylastasg: createcopylastasgMatcher,
createdeploy: createdeployMatcher,
rollbackServerGroup: rollbackServerGroupTaskMatcher,
};
const instanceIdMatchers = ['enableinstancesindiscovery', 'disableinstancesindiscovery', 'disableinstances',
'registerinstanceswithloadbalancer', 'deregisterinstancesfromloadbalancer', 'terminateinstances', 'rebootinstances'];
instanceIdMatchers.forEach(m => matchers[m] = instanceIdsTaskMatcher);
const baseTaskMatchers = ['resizeasg', 'resizeservergroup', 'disableasg', 'disableservergroup', 'destroyasg',
'destroyservergroup', 'enableasg', 'enableservergroup', 'enablegoogleservergroup', 'disablegoogleservergroup',
'resumeasgprocessesdescription'];
baseTaskMatchers.forEach(m => matchers[m] = baseTaskMatcher);
const notificationType: string = has(task, 'execution.stages') ?
task.execution.stages[0].context['notification.type'] ?
task.execution.stages[0].context['notification.type'] :
task.execution.stages[0].type : // TODO: good grief
task.getValueFor('notification.type');
if (notificationType && matchers[notificationType]) {
return matchers[notificationType](task, serverGroup);
}
return false;
}
示例8: getCustomException
private static getCustomException(task: ITask): string {
const generalException: any = task.getValueFor('exception');
if (generalException) {
if (generalException.exceptionType && generalException.exceptionType === 'LockFailureException') {
return this.getLockFailureException(task);
}
}
return null;
}
示例9: getGeneralException
private static getGeneralException(task: ITask): string {
const generalException: any = task.getValueFor('exception');
if (generalException) {
if (generalException.details && generalException.details.errors && generalException.details.errors.length) {
return generalException.details.errors.join(', ');
}
if (generalException.details && generalException.details.error) {
return generalException.details.error;
}
}
return null;
}
示例10: asgTask
private asgTask(task: ITask): string | boolean {
const asgName: string = task.getValueFor('asgName');
const account: string = task.getValueFor('credentials');
let result: string | boolean;
if (!asgName) {
result = false;
} else if (!asgName.match(NameUtils.VERSION_PATTERN)) {
result = '/';
} else {
result = this.$state.href('home.applications.application.insight.clusters.serverGroup', {
application: asgName.split('-')[0],
cluster: asgName.replace(NameUtils.VERSION_PATTERN, ''),
account,
accountId: account,
region: task.getValueFor('regions')[0],
serverGroup: asgName,
});
}
return result;
}