當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。