當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript application.model.Application類代碼示例

本文整理匯總了TypeScript中core/application/application.model.Application的典型用法代碼示例。如果您正苦於以下問題:TypeScript model.Application類的具體用法?TypeScript model.Application怎麽用?TypeScript model.Application使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了model.Application類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: addTagsToSecurityGroups

 public static 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,
     );
   });
 }
開發者ID:mizzy,項目名稱:deck,代碼行數:15,代碼來源:EntityTagsReader.ts

示例2: addTagsToServerGroupManagers

 public static addTagsToServerGroupManagers(application: Application): void {
   if (!SETTINGS.feature.entityTags) {
     return;
   }
   const allTags = application.getDataSource('entityTags').data;
   const serverGroupManagerTags: IEntityTags[] = allTags.filter(t => t.entityRef.entityType === 'servergroupmanager');
   application.getDataSource('serverGroupManagers').data.forEach((serverGroupManager: IServerGroupManager) => {
     serverGroupManager.entityTags = serverGroupManagerTags.find(
       t =>
         t.entityRef.entityId === serverGroupManager.name &&
         t.entityRef.account === serverGroupManager.account &&
         t.entityRef.region === serverGroupManager.region,
     );
   });
 }
開發者ID:emjburns,項目名稱:deck,代碼行數:15,代碼來源:EntityTagsReader.ts

示例3: addTagsToLoadBalancers

 public static addTagsToLoadBalancers(application: Application): void {
   if (!SETTINGS.feature.entityTags) {
     return;
   }
   const allTags = application.getDataSource('entityTags').data;
   const loadBalancerTags: IEntityTags[] = allTags.filter(t => t.entityRef.entityType === 'loadbalancer');
   application.getDataSource('loadBalancers').data.forEach((loadBalancer: ILoadBalancer) => {
     loadBalancer.entityTags = loadBalancerTags.find(
       t =>
         t.entityRef.entityId === loadBalancer.name &&
         t.entityRef.account === loadBalancer.account &&
         t.entityRef.region === loadBalancer.region,
     );
   });
 }
開發者ID:emjburns,項目名稱:deck,代碼行數:15,代碼來源:EntityTagsReader.ts

示例4: it

  it('attaches load balancer to firewall usages', function() {
    let data: any[] = null;

    const application: Application = ApplicationModelBuilder.createApplicationForTests(
      'app',
      {
        key: 'securityGroups',
        loader: () => $q.resolve([]),
        onLoad: (_app, _data) => $q.resolve(_data),
      },
      {
        key: 'serverGroups',
        loader: () => $q.resolve([]),
        onLoad: (_app, _data) => $q.resolve(_data),
      },
      {
        key: 'loadBalancers',
        loader: () =>
          $q.resolve([
            {
              name: 'my-elb',
              account: 'test',
              region: 'us-east-1',
              securityGroups: ['not-cached'],
            },
          ]),
        onLoad: (_app, _data) => $q.resolve(_data),
      },
    );

    application.serverGroups.refresh();
    application.loadBalancers.refresh();
    $scope.$digest();

    $http.expectGET(`${API.baseUrl}/securityGroups`).respond(200, {
      test: {
        aws: {
          'us-east-1': [{ name: 'not-cached' }],
        },
      },
    });
    reader.getApplicationSecurityGroups(application, null).then((results: any[]) => (data = results));
    $http.flush();
    $scope.$digest();
    const group: ISecurityGroup = data[0];
    expect(group.name).toBe('not-cached');
    expect(group.usages.loadBalancers[0]).toEqual({ name: application.getDataSource('loadBalancers').data[0].name });
  });
開發者ID:emjburns,項目名稱:deck,代碼行數:48,代碼來源:securityGroupReader.service.spec.ts

示例5: it

  it('should clear cache, then reload security groups and try again if a security group is not found', function () {
    let data: ISecurityGroup[] = null;
    const application: Application = applicationModelBuilder.createApplication(
      {
        key: 'securityGroups',
      },
      {
        key: 'serverGroups',
        ready: () => $q.when(null),
        loaded: true
      },
      {
        securityGroupsIndex: {}
      },
      {
        key: 'loadBalancers',
        ready: () => $q.when(null),
        loaded: true
      });
    application.getDataSource('securityGroups').data = [];
    application.getDataSource('serverGroups').data = [];
    application.getDataSource('loadBalancers').data = [
      {
        name: 'my-elb',
        account: 'test',
        region: 'us-east-1',
        securityGroups: [
          'not-cached',
        ]
      }
    ];

    $http.expectGET(API.baseUrl + '/securityGroups').respond(200, {
      test: {
        aws: {
          'us-east-1': [
            {name: 'not-cached', id: 'not-cached-id', vpcId: null}
          ]
        }
      }
    });

    reader.getApplicationSecurityGroups(application, []).then(results => data = results);
    $http.flush();
    const group: ISecurityGroup = data[0];
    expect(group.name).toBe('not-cached');
    expect(group.usages.loadBalancers[0]).toEqual({name: application.getDataSource('loadBalancers').data[0].name});
  });
開發者ID:brujoand,項目名稱:deck,代碼行數:48,代碼來源:securityGroupReader.service.spec.ts

示例6: beforeEach

 beforeEach(() => {
   application = ApplicationModelBuilder.createApplicationForTests(
     'app',
     {
       key: 'optionalSource',
       optional: true,
       visible: true,
     },
     {
       key: 'invisibleSource',
       visible: false,
     },
     {
       key: 'requiredSource',
       visible: true,
     },
     {
       key: 'optInSource',
       optional: true,
       visible: true,
       optIn: true,
     },
   );
   application.getDataSource('optInSource').disabled = true;
   application.attributes = { accounts: ['test'] };
 });
開發者ID:emjburns,項目名稱:deck,代碼行數:26,代碼來源:applicationDataSourceEditor.component.spec.ts

示例7: addServerGroupSecurityGroups

  private addServerGroupSecurityGroups(application: Application): ISecurityGroupProcessorResult {
    let notFoundCaught = false;
    const securityGroups: ISecurityGroup[] = [];
    application.getDataSource('serverGroups').data.forEach((serverGroup: IServerGroup) => {
      if (serverGroup.securityGroups) {
        serverGroup.securityGroups.forEach((securityGroupId: string) => {
          try {
            const securityGroup: ISecurityGroup = this.resolve(application['securityGroupsIndex'], serverGroup, securityGroupId);
            SecurityGroupReader.attachUsageFields(securityGroup);
            if (!securityGroup.usages.serverGroups.some((sg: IServerGroupUsage) => sg.name === serverGroup.name)) {
              securityGroup.usages.serverGroups.push({
                name: serverGroup.name,
                isDisabled: serverGroup.isDisabled,
                region: serverGroup.region,
              });
            }
            securityGroups.push(securityGroup);
          } catch (e) {
            this.$log.warn('could not attach security group to server group:', serverGroup.name, securityGroupId);
            notFoundCaught = true;
          }
        });
      }
    });

    return {notFoundCaught, securityGroups};
  }
開發者ID:jcwest,項目名稱:deck,代碼行數:27,代碼來源:securityGroupReader.service.ts

示例8: addTagsToServerGroups

 public addTagsToServerGroups(application: Application): void {
   if (!SETTINGS.feature.entityTags) {
     return;
   }
   const allTags = application.getDataSource('entityTags').data;
   const serverGroupTags: IEntityTags[] = allTags.filter(t => t.entityRef.entityType === 'servergroup');
   const clusterTags: IEntityTags[] = allTags.filter(t => t.entityRef.entityType === 'cluster');
   application.getDataSource('serverGroups').data.forEach((serverGroup: IServerGroup) => {
     serverGroup.entityTags = serverGroupTags.find(t => t.entityRef.entityId === serverGroup.name &&
       t.entityRef.account === serverGroup.account &&
       t.entityRef.region === serverGroup.region);
     serverGroup.clusterEntityTags = clusterTags.filter(t => t.entityRef.entityId === serverGroup.cluster &&
       (t.entityRef.account === '*' || t.entityRef.account === serverGroup.account) &&
       (t.entityRef.region === '*' || t.entityRef.region === serverGroup.region));
   });
 }
開發者ID:robfletcher,項目名稱:deck,代碼行數:16,代碼來源:entityTags.read.service.ts

示例9: it

 it('adds a server group when new one provided in same sub-sub-group', function(done) {
   application = this.buildApplication({
     serverGroups: {
       data: [
         this.serverGroup000,
         this.serverGroup001,
         {
           cluster: 'cluster-a',
           name: 'cluster-a-v003',
           account: 'prod',
           region: 'us-east-1',
           stringVal: 'new',
           category: 'serverGroup',
           instances: [],
         },
       ],
     },
   });
   application.clusters = clusterService.createServerGroupClusters(application.getDataSource('serverGroups').data);
   ClusterState.filterService.updateClusterGroups(application);
   setTimeout(() => {
     expect(ClusterState.filterModel.asFilterModel.groups.length).toBe(1);
     expect(ClusterState.filterModel.asFilterModel.groups[0].subgroups.length).toBe(1);
     expect(ClusterState.filterModel.asFilterModel.groups[0].subgroups[0].subgroups.length).toBe(1);
     expect(ClusterState.filterModel.asFilterModel.groups[0].subgroups[0].subgroups[0].serverGroups.length).toBe(3);
     expect(ClusterState.filterModel.asFilterModel.groups[0].subgroups[0].subgroups[0].serverGroups[2].name).toBe(
       'cluster-a-v003',
     );
     done();
   }, debounceTimeout);
 });
開發者ID:mizzy,項目名稱:deck,代碼行數:31,代碼來源:ClusterFilterService.spec.ts


注:本文中的core/application/application.model.Application類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。