当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript domain.ITask类代码示例

本文整理汇总了TypeScript中core/domain.ITask的典型用法代码示例。如果您正苦于以下问题:TypeScript ITask类的具体用法?TypeScript ITask怎么用?TypeScript ITask使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ITask类的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;
  }
开发者ID:mizzy,项目名称:deck,代码行数:30,代码来源:urlBuilder.service.ts

示例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;
}
开发者ID:jcwest,项目名称:deck,代码行数:10,代码来源:task.matcher.ts

示例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;
}
开发者ID:jcwest,项目名称:deck,代码行数:10,代码来源:task.matcher.ts

示例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;
}
开发者ID:jcwest,项目名称:deck,代码行数:10,代码来源:task.matcher.ts

示例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;
}
开发者ID:jcwest,项目名称:deck,代码行数:14,代码来源:task.matcher.ts

示例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;
  }
开发者ID:mizzy,项目名称:deck,代码行数:27,代码来源:orchestratedItem.transformer.ts

示例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;
}
开发者ID:jcwest,项目名称:deck,代码行数:27,代码来源:task.matcher.ts

示例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;
 }
开发者ID:mizzy,项目名称:deck,代码行数:9,代码来源:orchestratedItem.transformer.ts

示例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;
 }
开发者ID:mizzy,项目名称:deck,代码行数:12,代码来源:orchestratedItem.transformer.ts

示例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;
  }
开发者ID:mizzy,项目名称:deck,代码行数:22,代码来源:urlBuilder.service.ts


注:本文中的core/domain.ITask类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。