From 2b07d343c57dfa30b84b0793dbecbecf8800ca13 Mon Sep 17 00:00:00 2001 From: Justin Reynolds Date: Mon, 10 Apr 2017 21:15:08 -0700 Subject: [PATCH] chore(core): Add prefer-const tslint rule --- .../validation/applicationName.validator.ts | 8 +- .../modules/appengine/appengine.module.ts | 2 +- .../helpContents/appengineHelpContents.ts | 2 +- .../instance/details/details.controller.ts | 16 +- .../wizard/advancedSettings.component.ts | 4 +- .../wizard/basicSettings.component.ts | 6 +- ...ageAllocationConfigurationRow.component.ts | 6 +- .../configure/wizard/wizard.controller.ts | 4 +- .../details/details.controller.ts | 12 +- .../appengine/loadBalancer/transformer.ts | 10 +- .../stages/appengineStage.controller.ts | 2 +- .../appengineEditLoadBalancerStage.ts | 2 +- .../loadBalancerChoice.modal.controller.ts | 4 +- .../appengineShrinkClusterStage.ts | 2 +- .../serverGroupCommandBuilder.service.ts | 16 +- .../wizard/basicSettings.controller.ts | 4 +- .../wizard/cloneServerGroup.controller.ts | 6 +- .../configure/wizard/configFiles.component.ts | 4 +- .../serverGroup/details/details.controller.ts | 62 +++---- .../writer/serverGroup.write.service.ts | 8 +- .../validation/applicationName.validator.ts | 6 +- .../modules/core/api/api.service.spec.ts | 50 +++--- .../application/application.model.spec.ts | 14 +- .../core/application/application.model.ts | 16 +- .../application/application.state.provider.ts | 2 +- .../application/applicationModel.builder.ts | 4 +- .../application/config/appConfig.states.ts | 2 +- ...licationDataSourceEditor.component.spec.ts | 2 +- .../applicationDataSourceEditor.component.ts | 2 +- .../configSectionFooter.component.spec.ts | 8 +- .../listExtractor.service.spec.ts | 164 +++++++++--------- .../listExtractor/listExtractor.service.ts | 2 +- .../exampleApplicationName.validator.ts | 4 +- .../validateApplicationName.directive.ts | 2 +- .../service/application.read.service.spec.ts | 4 +- .../service/application.write.service.spec.ts | 10 +- .../service/applicationDataSource.ts | 10 +- .../authentication.initializer.service.ts | 2 +- .../authentication/authentication.module.ts | 2 +- .../authentication.provider.spec.ts | 2 +- .../chaosMonkeyExceptions.component.spec.ts | 6 +- .../cloudProvider/cloudProvider.registry.ts | 12 +- .../core/cluster/cluster.service.spec.ts | 16 +- .../modules/core/cluster/cluster.service.ts | 6 +- .../cluster/filter/clusterFilter.component.ts | 2 +- .../filter/clusterFilter.service.spec.ts | 10 +- .../cluster/filter/clusterFilter.service.ts | 26 +-- .../executionDetailsSection.service.spec.ts | 4 +- .../execution/execution.component.ts | 6 +- .../filter/executionFilter.service.spec.ts | 16 +- .../filter/executionFilter.service.ts | 10 +- .../delivery/service/execution.service.ts | 8 +- .../core/entityTag/entityTags.read.service.ts | 6 +- .../numberList/numberList.component.spec.ts | 4 +- .../forms/numberList/numberList.component.ts | 2 +- .../core/help/helpField.component.spec.ts | 8 +- .../history/recentHistory.service.spec.ts | 22 +-- .../instance/instance.write.service.spec.ts | 20 +-- .../core/instance/instance.write.service.ts | 18 +- .../filter/loadBalancer.filter.component.ts | 2 +- .../loadBalancersTag.component.spec.ts | 2 +- .../loadBalancersTag.component.ts | 10 +- .../modal/wizard/v2modalWizard.component.ts | 2 +- .../modal/wizard/v2modalWizard.service.ts | 2 +- .../core/navigation/stateHelper.provider.ts | 2 +- .../orchestratedItem.transformer.spec.ts | 24 +-- .../copyStage/copyStage.modal.controller.ts | 4 +- .../config/graph/pipeline.graph.component.ts | 4 +- .../services/piplineConfig.service.spec.ts | 20 +-- .../executionWindows/atlasGraph.component.ts | 12 +- .../travis/travisStage.controller.spec.ts | 4 +- .../config/stages/travis/travisStage.ts | 2 +- .../travisTriggerOptions.component.spec.ts | 6 +- .../pipelineConfig.validator.spec.ts | 2 +- .../validation/pipelineConfig.validator.ts | 4 +- .../stageOrTriggerBeforeType.validator.ts | 8 +- .../anyFieldFilter/anyField.filter.ts | 6 +- .../pageNavigator.component.spec.ts | 4 +- .../core/scheduler/scheduler.factory.spec.ts | 2 +- .../modules/core/search/search.service.ts | 2 +- .../filter/securityGroup.filter.component.ts | 2 +- .../securityGroupWriter.service.ts | 2 +- .../scalingActivities.controller.spec.ts | 4 +- .../core/serverGroup/serverGroup.component.ts | 4 +- .../core/task/displayableTasks.filter.ts | 2 +- .../task/monitor/taskMonitor.builder.spec.ts | 18 +- .../core/utils/json/json.utility.service.ts | 14 +- .../whatsNew/whatsNew.read.service.spec.ts | 4 +- .../core/whatsNew/whatsNew.read.service.ts | 6 +- ...ockerImageAndTagSelector.component.spec.ts | 8 +- .../modules/google/address/address.reader.ts | 2 +- .../google/cache/cacheRefresh.component.ts | 2 +- .../healthCheck/healthCheck.read.service.ts | 4 +- .../choice/gceLoadBalancerChoice.modal.ts | 2 +- .../common/commonLoadBalancer.controller.ts | 4 +- ...ommonLoadBalancerCommandBuilder.service.ts | 2 +- ...ceCreateInternalLoadBalancer.controller.ts | 14 +- .../gceCreateSslLoadBalancer.controller.ts | 14 +- .../deleteModal/deleteModal.controller.ts | 2 +- .../httpLoadBalancerUtils.service.ts | 4 +- .../loadBalancer.setTransformer.ts | 10 +- .../securityGroupHelpText.service.spec.ts | 6 +- .../securityGroupHelpText.service.ts | 2 +- .../autoHealingPolicySelector.component.ts | 2 +- .../loadBalancingPolicySelector.component.ts | 10 +- .../autoHealingPolicy.component.ts | 2 +- ...psertAutoHealingPolicy.modal.controller.ts | 2 +- .../capabilitiesSelector.component.ts | 2 +- .../netflix/exception/exceptionHandler.ts | 2 +- .../dataNav/fastPropertyFilter.directive.ts | 10 +- .../fastProperties/domain/property.domain.ts | 2 +- .../domain/propertyCommand.model.spec.ts | 34 ++-- .../domain/propertyCommand.model.ts | 8 +- .../domain/propertyPipelineStage.ts | 20 +-- .../domain/scope.domain.spec.ts | 20 +-- .../fastProperties/domain/scope.domain.ts | 6 +- .../fastPropertyScopeSearch.component.ts | 10 +- ...ropertyScopeSearchCategory.service.spec.ts | 2 +- ...fastPropertyScopeSearchCategory.service.ts | 48 ++--- .../view/fastPropertyDetails.controller.ts | 6 +- .../fastPropertyFilterSearch.component.ts | 12 +- ...FastPropertyToNewScopeWizard.controller.ts | 2 +- .../createFastPropertyWizard.controller.ts | 2 +- .../deleteFastPropertyWizard.controller.ts | 2 +- .../wizard/monitor/propertyMonitorService.ts | 4 +- .../propertyDetails.component.spec.ts | 8 +- .../propertyDetails.component.ts | 2 +- .../wizard/propertyPipelineBuilder.service.ts | 14 +- .../propertyScope/propertyScope.component.ts | 4 +- .../updateFastPropertyWizard.controller.ts | 2 +- .../isolatedTestingTargetStage.ts | 4 +- .../titusMigrationConfigurer.component.ts | 2 +- .../securityGroupPicker.component.ts | 28 +-- .../validation/applicationName.validator.ts | 4 +- tslint.json | 6 + 135 files changed, 618 insertions(+), 610 deletions(-) diff --git a/app/scripts/modules/amazon/validation/applicationName.validator.ts b/app/scripts/modules/amazon/validation/applicationName.validator.ts index 42a3b863e4b..1765dd06b13 100644 --- a/app/scripts/modules/amazon/validation/applicationName.validator.ts +++ b/app/scripts/modules/amazon/validation/applicationName.validator.ts @@ -7,14 +7,14 @@ import {AWSProviderSettings} from '../aws.settings'; class AmazonApplicationNameValidator implements IApplicationNameValidator { private validateSpecialCharacters(name: string, errors: string[]): void { - let pattern = /^[a-zA-Z_0-9.]*$/g; + const pattern = /^[a-zA-Z_0-9.]*$/g; if (!pattern.test(name)) { errors.push('Only dot(.) and underscore(_) special characters are allowed.'); } } private validateClassicLock(warnings: string[]): void { - let lockoutDate = AWSProviderSettings.classicLaunchLockout; + const lockoutDate = AWSProviderSettings.classicLaunchLockout; if (lockoutDate && lockoutDate < new Date().getTime()) { warnings.push('New applications deployed to AWS are restricted to VPC; you cannot create server groups, ' + 'load balancers, or security groups in EC2 Classic.'); @@ -38,7 +38,7 @@ class AmazonApplicationNameValidator implements IApplicationNameValidator { if (name.length >= 248) { warnings.push('You will not be able to include a stack or detail field for clusters or security groups.'); } else { - let remaining = 248 - name.length; + const remaining = 248 - name.length; warnings.push(`If you plan to include a stack or detail field for clusters, you will only have ~${remaining} characters to do so.`); } @@ -53,7 +53,7 @@ class AmazonApplicationNameValidator implements IApplicationNameValidator { for load balancer names is 32 (currently: ${name.length} characters). With separators ("-"), you will not be able to add a stack and detail field to any load balancer.`); } else { - let remaining = 30 - name.length; + const remaining = 30 - name.length; warnings.push(`If you plan to create load balancers for this application, be aware that the character limit for load balancer names is 32. You will only have ~${remaining} characters to add a stack or detail field to any load balancer.`); diff --git a/app/scripts/modules/appengine/appengine.module.ts b/app/scripts/modules/appengine/appengine.module.ts index 926fa755bbb..33a90fbaf75 100644 --- a/app/scripts/modules/appengine/appengine.module.ts +++ b/app/scripts/modules/appengine/appengine.module.ts @@ -19,7 +19,7 @@ import {CLOUD_PROVIDER_REGISTRY, CloudProviderRegistry} from 'core/cloudProvider import './logo/appengine.logo.less'; -let templates = require.context('./', true, /\.html$/); +const templates = require.context('./', true, /\.html$/); templates.keys().forEach(function(key) { templates(key); }); diff --git a/app/scripts/modules/appengine/helpContents/appengineHelpContents.ts b/app/scripts/modules/appengine/helpContents/appengineHelpContents.ts index 1fafce2b037..4fad4e58661 100644 --- a/app/scripts/modules/appengine/helpContents/appengineHelpContents.ts +++ b/app/scripts/modules/appengine/helpContents/appengineHelpContents.ts @@ -5,7 +5,7 @@ import {HELP_CONTENTS_REGISTRY, HelpContentsRegistry} from 'core/help/helpConten export const APPENGINE_HELP_CONTENTS_REGISTRY = 'spinnaker.appengine.helpContents.registry'; module(APPENGINE_HELP_CONTENTS_REGISTRY, [HELP_CONTENTS_REGISTRY]) .run((helpContentsRegistry: HelpContentsRegistry) => { - let helpContents = [ + const helpContents = [ { key: 'appengine.serverGroup.repositoryUrl', value: `The full URL to the git repository containing the source files for this deployment, diff --git a/app/scripts/modules/appengine/instance/details/details.controller.ts b/app/scripts/modules/appengine/instance/details/details.controller.ts index bb0d59d9617..d429075599e 100644 --- a/app/scripts/modules/appengine/instance/details/details.controller.ts +++ b/app/scripts/modules/appengine/instance/details/details.controller.ts @@ -52,12 +52,12 @@ class AppengineInstanceDetailsController { } public terminateInstance(): void { - let instance = cloneDeep(this.instance) as any; - let shortName = `${this.instance.name.substring(0, 10)}...`; + const instance = cloneDeep(this.instance) as any; + const shortName = `${this.instance.name.substring(0, 10)}...`; instance.placement = {}; instance.instanceId = instance.name; - let taskMonitor = { + const taskMonitor = { application: this.app, title: 'Terminating ' + shortName, onTaskComplete: function() { @@ -67,7 +67,7 @@ class AppengineInstanceDetailsController { } }; - let submitMethod = () => { + const submitMethod = () => { return this.instanceWriter.terminateInstance(instance, this.app, {cloudProvider: 'appengine'}); }; @@ -81,20 +81,20 @@ class AppengineInstanceDetailsController { } private retrieveInstance(instance: InstanceFromStateParams): IPromise { - let instanceLocatorPredicate = (dataSource: InstanceContainer) => { + const instanceLocatorPredicate = (dataSource: InstanceContainer) => { return dataSource.instances.some((possibleMatch) => possibleMatch.id === instance.instanceId); }; - let dataSources: InstanceContainer[] = flattenDeep([ + const dataSources: InstanceContainer[] = flattenDeep([ this.app.getDataSource('serverGroups').data, this.app.getDataSource('loadBalancers').data, this.app.getDataSource('loadBalancers').data.map((loadBalancer) => loadBalancer.serverGroups), ]); - let instanceContainer = dataSources.find(instanceLocatorPredicate); + const instanceContainer = dataSources.find(instanceLocatorPredicate); if (instanceContainer) { - let recentHistoryExtraData: {[key: string]: string} = { + const recentHistoryExtraData: {[key: string]: string} = { region: instanceContainer.region, account: instanceContainer.account, }; diff --git a/app/scripts/modules/appengine/loadBalancer/configure/wizard/advancedSettings.component.ts b/app/scripts/modules/appengine/loadBalancer/configure/wizard/advancedSettings.component.ts index 56d1fef303e..b476bb07192 100644 --- a/app/scripts/modules/appengine/loadBalancer/configure/wizard/advancedSettings.component.ts +++ b/app/scripts/modules/appengine/loadBalancer/configure/wizard/advancedSettings.component.ts @@ -9,8 +9,8 @@ class AppengineLoadBalancerAdvancedSettingsCtrl implements ng.IComponentControll if (this.loadBalancer.splitDescription.allocationDescriptions.length !== 1) { return true; } else { - let targetServerGroupName = this.loadBalancer.splitDescription.allocationDescriptions[0].serverGroupName; - let targetServerGroup = this.loadBalancer.serverGroups.find(candidate => candidate.name === targetServerGroupName); + const targetServerGroupName = this.loadBalancer.splitDescription.allocationDescriptions[0].serverGroupName; + const targetServerGroup = this.loadBalancer.serverGroups.find(candidate => candidate.name === targetServerGroupName); if (targetServerGroup) { return !targetServerGroup.allowsGradualTrafficMigration; diff --git a/app/scripts/modules/appengine/loadBalancer/configure/wizard/basicSettings.component.ts b/app/scripts/modules/appengine/loadBalancer/configure/wizard/basicSettings.component.ts index 01fda2f6c72..1b13e5bccbd 100644 --- a/app/scripts/modules/appengine/loadBalancer/configure/wizard/basicSettings.component.ts +++ b/app/scripts/modules/appengine/loadBalancer/configure/wizard/basicSettings.component.ts @@ -13,7 +13,7 @@ class AppengineLoadBalancerSettingsController implements ng.IComponentController } public addAllocation(): void { - let remainingServerGroups = this.serverGroupsWithoutAllocation(); + const remainingServerGroups = this.serverGroupsWithoutAllocation(); if (remainingServerGroups.length) { this.loadBalancer.splitDescription.allocationDescriptions.push({serverGroupName: remainingServerGroups[0], allocation: 0, locatorType: 'fromExisting'}); if (this.loadBalancer.splitDescription.allocationDescriptions.length > 1 && !this.loadBalancer.splitDescription.shardBy) { @@ -60,8 +60,8 @@ class AppengineLoadBalancerSettingsController implements ng.IComponentController } private serverGroupsWithoutAllocation(): string[] { - let serverGroupsWithAllocation = this.loadBalancer.splitDescription.allocationDescriptions.map(description => description.serverGroupName); - let allServerGroups = this.loadBalancer.serverGroups.map(serverGroup => serverGroup.name); + const serverGroupsWithAllocation = this.loadBalancer.splitDescription.allocationDescriptions.map(description => description.serverGroupName); + const allServerGroups = this.loadBalancer.serverGroups.map(serverGroup => serverGroup.name); return difference(allServerGroups, serverGroupsWithAllocation); } } diff --git a/app/scripts/modules/appengine/loadBalancer/configure/wizard/stageAllocationConfigurationRow.component.ts b/app/scripts/modules/appengine/loadBalancer/configure/wizard/stageAllocationConfigurationRow.component.ts index 48a2579a5a8..e922554c382 100644 --- a/app/scripts/modules/appengine/loadBalancer/configure/wizard/stageAllocationConfigurationRow.component.ts +++ b/app/scripts/modules/appengine/loadBalancer/configure/wizard/stageAllocationConfigurationRow.component.ts @@ -9,7 +9,7 @@ class AppengineStageAllocationLabelCtrl implements ng.IComponentController { private allocationDescription: IAppengineAllocationDescription; private static mapTargetCoordinateToLabel(targetCoordinate: string): string { - let target = StageConstants.TARGET_LIST.find(t => t.val === targetCoordinate); + const target = StageConstants.TARGET_LIST.find(t => t.val === targetCoordinate); if (target) { return target.label; } else { @@ -31,7 +31,7 @@ class AppengineStageAllocationLabelCtrl implements ng.IComponentController { break; case 'targetCoordinate': if (this.allocationDescription.cluster && this.allocationDescription.target) { - let targetLabel = AppengineStageAllocationLabelCtrl.mapTargetCoordinateToLabel(this.allocationDescription.target); + const targetLabel = AppengineStageAllocationLabelCtrl.mapTargetCoordinateToLabel(this.allocationDescription.target); this.inputViewValue = `${targetLabel} (${this.allocationDescription.cluster})`; } else { this.inputViewValue = null; @@ -63,7 +63,7 @@ class AppengineStageAllocationConfigurationRowCtrl implements ng.IComponentContr public static get $inject() { return ['appListExtractorService']; } constructor(private appListExtractorService: any) { - let clusterFilter = this.appListExtractorService.clusterFilterForCredentialsAndRegion(this.account, this.region); + const clusterFilter = this.appListExtractorService.clusterFilterForCredentialsAndRegion(this.account, this.region); this.clusterList = this.appListExtractorService.getClusters([this.application], clusterFilter); } diff --git a/app/scripts/modules/appengine/loadBalancer/configure/wizard/wizard.controller.ts b/app/scripts/modules/appengine/loadBalancer/configure/wizard/wizard.controller.ts index 600c44d5ce8..ed82fde1181 100644 --- a/app/scripts/modules/appengine/loadBalancer/configure/wizard/wizard.controller.ts +++ b/app/scripts/modules/appengine/loadBalancer/configure/wizard/wizard.controller.ts @@ -59,7 +59,7 @@ class AppengineLoadBalancerWizardController { } public submit(): any { - let description = cloneDeep(this.loadBalancer); + const description = cloneDeep(this.loadBalancer); description.mapAllocationsToDecimals(); delete description.serverGroups; @@ -119,7 +119,7 @@ class AppengineLoadBalancerWizardController { } this.$uibModalInstance.dismiss(); - let newStateParams = { + const newStateParams = { name: this.loadBalancer.name, accountId: this.loadBalancer.credentials, region: this.loadBalancer.region, diff --git a/app/scripts/modules/appengine/loadBalancer/details/details.controller.ts b/app/scripts/modules/appengine/loadBalancer/details/details.controller.ts index a351012cd5a..81f113a8525 100644 --- a/app/scripts/modules/appengine/loadBalancer/details/details.controller.ts +++ b/app/scripts/modules/appengine/loadBalancer/details/details.controller.ts @@ -54,12 +54,12 @@ class AppengineLoadBalancerDetailsController { } public deleteLoadBalancer(): void { - let taskMonitor = { + const taskMonitor = { application: this.app, title: 'Deleting ' + this.loadBalancer.name, }; - let submitMethod = () => { + const submitMethod = () => { const loadBalancer: ILoadBalancerDeleteDescription = { cloudProvider: this.loadBalancer.cloudProvider, loadBalancerName: this.loadBalancer.name, @@ -109,14 +109,14 @@ class AppengineLoadBalancerDetailsController { } private getConfirmationModalBodyHtml(): string { - let serverGroupNames = this.loadBalancer.serverGroups.map(serverGroup => serverGroup.name); - let hasAny = serverGroupNames ? serverGroupNames.length > 0 : false; - let hasMoreThanOne = serverGroupNames ? serverGroupNames.length > 1 : false; + const serverGroupNames = this.loadBalancer.serverGroups.map(serverGroup => serverGroup.name); + const hasAny = serverGroupNames ? serverGroupNames.length > 0 : false; + const hasMoreThanOne = serverGroupNames ? serverGroupNames.length > 1 : false; // HTML accepted by the confirmationModalService is static (i.e., not managed by angular). if (hasAny) { if (hasMoreThanOne) { - let listOfServerGroupNames = serverGroupNames.map(name => `
  • ${name}
  • `).join(''); + const listOfServerGroupNames = serverGroupNames.map(name => `
  • ${name}
  • `).join(''); return `

    diff --git a/app/scripts/modules/appengine/loadBalancer/transformer.ts b/app/scripts/modules/appengine/loadBalancer/transformer.ts index 69b9d25bfc6..3cd6291d772 100644 --- a/app/scripts/modules/appengine/loadBalancer/transformer.ts +++ b/app/scripts/modules/appengine/loadBalancer/transformer.ts @@ -32,7 +32,7 @@ export class AppengineLoadBalancerUpsertDescription implements ILoadBalancerUpse public serverGroups?: any[]; public static convertTrafficSplitToTrafficSplitDescription(split: IAppengineTrafficSplit): IAppengineTrafficSplitDescription { - let allocationDescriptions = reduce(split.allocations, (acc: IAppengineAllocationDescription[], allocation: number, serverGroupName: string) => { + const allocationDescriptions = reduce(split.allocations, (acc: IAppengineAllocationDescription[], allocation: number, serverGroupName: string) => { return acc.concat({serverGroupName, allocation, locatorType: 'fromExisting'}); }, []); @@ -85,7 +85,7 @@ export class AppengineLoadBalancerTransformer { .map((instance: any) => this.transformInstance(instance, loadBalancer)); }); - let activeServerGroups = filter(loadBalancer.serverGroups, {isDisabled: false}); + const activeServerGroups = filter(loadBalancer.serverGroups, {isDisabled: false}); loadBalancer.instances = chain(activeServerGroups).map('instances').flatten().value() as Instance[]; return this.$q.resolve(loadBalancer); } @@ -93,7 +93,7 @@ export class AppengineLoadBalancerTransformer { public convertLoadBalancerForEditing(loadBalancer: IAppengineLoadBalancer, application: Application): ng.IPromise { return application.getDataSource('loadBalancers').ready().then(() => { - let upToDateLoadBalancer = application.getDataSource('loadBalancers').data.find((candidate: ILoadBalancer) => { + const upToDateLoadBalancer = application.getDataSource('loadBalancers').data.find((candidate: ILoadBalancer) => { return candidate.name === loadBalancer.name && (candidate.account === loadBalancer.account || candidate.account === loadBalancer.credentials); }); @@ -110,7 +110,7 @@ export class AppengineLoadBalancerTransformer { } private buildInstanceCounts(serverGroups: ServerGroup[]): InstanceCounts { - let instanceCounts: InstanceCounts = chain(serverGroups) + const instanceCounts: InstanceCounts = chain(serverGroups) .map('instances') .flatten() .reduce((acc: InstanceCounts, instance: any) => { @@ -129,7 +129,7 @@ export class AppengineLoadBalancerTransformer { instance.account = loadBalancer.account; instance.region = loadBalancer.region; instance.loadBalancers = [loadBalancer.name]; - let health = instance.health || {}; + const health = instance.health || {}; instance.healthState = get(instance, 'health.state') || 'OutOfService'; instance.health = [health]; diff --git a/app/scripts/modules/appengine/pipeline/stages/appengineStage.controller.ts b/app/scripts/modules/appengine/pipeline/stages/appengineStage.controller.ts index 8923def13eb..62f737c4518 100644 --- a/app/scripts/modules/appengine/pipeline/stages/appengineStage.controller.ts +++ b/app/scripts/modules/appengine/pipeline/stages/appengineStage.controller.ts @@ -11,7 +11,7 @@ export class AppengineStageCtrl { } public setStageRegion(): void { - let selected = this.$scope.accounts.find((account) => account.name === this.$scope.stage.credentials); + const selected = this.$scope.accounts.find((account) => account.name === this.$scope.stage.credentials); if (selected && selected.name) { this.accountService.getAccountDetails(selected.name) .then((accountDetails: IAppengineAccount) => { diff --git a/app/scripts/modules/appengine/pipeline/stages/editLoadBalancer/appengineEditLoadBalancerStage.ts b/app/scripts/modules/appengine/pipeline/stages/editLoadBalancer/appengineEditLoadBalancerStage.ts index c2a028f0d59..6dbbcaff07c 100644 --- a/app/scripts/modules/appengine/pipeline/stages/editLoadBalancer/appengineEditLoadBalancerStage.ts +++ b/app/scripts/modules/appengine/pipeline/stages/editLoadBalancer/appengineEditLoadBalancerStage.ts @@ -31,7 +31,7 @@ class AppengineEditLoadBalancerStageCtrl { } public editLoadBalancer(index: number) { - let config = this.cloudProviderRegistry.getValue('appengine', 'loadBalancer'); + const config = this.cloudProviderRegistry.getValue('appengine', 'loadBalancer'); this.$uibModal.open({ templateUrl: config.createLoadBalancerTemplateUrl, controller: `${config.createLoadBalancerController} as ctrl`, diff --git a/app/scripts/modules/appengine/pipeline/stages/editLoadBalancer/loadBalancerChoice.modal.controller.ts b/app/scripts/modules/appengine/pipeline/stages/editLoadBalancer/loadBalancerChoice.modal.controller.ts index 5df9d6db149..c80742faa2a 100644 --- a/app/scripts/modules/appengine/pipeline/stages/editLoadBalancer/loadBalancerChoice.modal.controller.ts +++ b/app/scripts/modules/appengine/pipeline/stages/editLoadBalancer/loadBalancerChoice.modal.controller.ts @@ -21,8 +21,8 @@ class AppengineLoadBalancerChoiceModalCtrl { } public submit(): void { - let config = this.cloudProviderRegistry.getValue('appengine', 'loadBalancer'); - let updatedLoadBalancerPromise = this.$uibModal.open({ + const config = this.cloudProviderRegistry.getValue('appengine', 'loadBalancer'); + const updatedLoadBalancerPromise = this.$uibModal.open({ templateUrl: config.createLoadBalancerTemplateUrl, controller: `${config.createLoadBalancerController} as ctrl`, size: 'lg', diff --git a/app/scripts/modules/appengine/pipeline/stages/shrinkCluster/appengineShrinkClusterStage.ts b/app/scripts/modules/appengine/pipeline/stages/shrinkCluster/appengineShrinkClusterStage.ts index 42068034761..cf661e8bae1 100644 --- a/app/scripts/modules/appengine/pipeline/stages/shrinkCluster/appengineShrinkClusterStage.ts +++ b/app/scripts/modules/appengine/pipeline/stages/shrinkCluster/appengineShrinkClusterStage.ts @@ -20,7 +20,7 @@ class AppengineShrinkClusterStageCtrl extends AppengineStageCtrl { super.setStageCloudProvider(); super.setStageCredentials(); - let stage = $scope.stage as IAppengineShrinkClusterStage; + const stage = $scope.stage as IAppengineShrinkClusterStage; if (stage.shrinkToSize === undefined) { stage.shrinkToSize = 1; } diff --git a/app/scripts/modules/appengine/serverGroup/configure/serverGroupCommandBuilder.service.ts b/app/scripts/modules/appengine/serverGroup/configure/serverGroupCommandBuilder.service.ts index 2c39c57d1c4..8f6a498bbf2 100644 --- a/app/scripts/modules/appengine/serverGroup/configure/serverGroupCommandBuilder.service.ts +++ b/app/scripts/modules/appengine/serverGroup/configure/serverGroupCommandBuilder.service.ts @@ -60,11 +60,11 @@ export class AppengineServerGroupCommandBuilder { public buildNewServerGroupCommand(app: Application, selectedProvider = 'appengine', mode = 'create'): IPromise { - let dataToFetch = { + const dataToFetch = { accounts: this.accountService.getAllAccountDetailsForProvider('appengine'), }; - let viewState: IViewState = { + const viewState: IViewState = { mode: mode, submitButtonLabel: this.getSubmitButtonLabel(mode), disableStrategySelection: mode === 'create' ? true : false, @@ -72,8 +72,8 @@ export class AppengineServerGroupCommandBuilder { return this.$q.all(dataToFetch) .then((backingData: any) => { - let credentials: string = this.getCredentials(backingData.accounts, app); - let region: string = this.getRegion(backingData.accounts, credentials); + const credentials: string = this.getCredentials(backingData.accounts, app); + const region: string = this.getRegion(backingData.accounts, credentials); return { application: app.name, @@ -115,9 +115,9 @@ export class AppengineServerGroupCommandBuilder { } private getCredentials(accounts: IAppengineAccount[], application: Application): string { - let accountNames: string[] = (accounts || []).map((account) => account.name); - let defaultCredentials: string = AppengineProviderSettings.defaults.account; - let firstApplicationAccount: string = intersection(application.accounts || [], accountNames)[0]; + const accountNames: string[] = (accounts || []).map((account) => account.name); + const defaultCredentials: string = AppengineProviderSettings.defaults.account; + const firstApplicationAccount: string = intersection(application.accounts || [], accountNames)[0]; return accountNames.includes(defaultCredentials) ? defaultCredentials : @@ -125,7 +125,7 @@ export class AppengineServerGroupCommandBuilder { } private getRegion(accounts: IAppengineAccount[], credentials: string): string { - let account = accounts.find((_account) => _account.name === credentials); + const account = accounts.find((_account) => _account.name === credentials); return account ? account.region : null; } diff --git a/app/scripts/modules/appengine/serverGroup/configure/wizard/basicSettings.controller.ts b/app/scripts/modules/appengine/serverGroup/configure/wizard/basicSettings.controller.ts index 5f9d03d14ac..f412993a114 100644 --- a/app/scripts/modules/appengine/serverGroup/configure/wizard/basicSettings.controller.ts +++ b/app/scripts/modules/appengine/serverGroup/configure/wizard/basicSettings.controller.ts @@ -43,7 +43,7 @@ class AppengineServerGroupBasicSettingsCtrl { } public onAccountChange(): void { - let account = this.findAccountInBackingData(); + const account = this.findAccountInBackingData(); if (account) { this.$scope.command.gitCredentialType = account.supportedGitCredentialTypes[0]; } else { @@ -52,7 +52,7 @@ class AppengineServerGroupBasicSettingsCtrl { } public getSupportedGitCredentialTypes(): GitCredentialType[] { - let account = this.findAccountInBackingData(); + const account = this.findAccountInBackingData(); if (account) { return account.supportedGitCredentialTypes; } else { diff --git a/app/scripts/modules/appengine/serverGroup/configure/wizard/cloneServerGroup.controller.ts b/app/scripts/modules/appengine/serverGroup/configure/wizard/cloneServerGroup.controller.ts index ee8d584a41a..bf65089f2c3 100644 --- a/app/scripts/modules/appengine/serverGroup/configure/wizard/cloneServerGroup.controller.ts +++ b/app/scripts/modules/appengine/serverGroup/configure/wizard/cloneServerGroup.controller.ts @@ -55,14 +55,14 @@ class AppengineCloneServerGroupCtrl { } public submit(): ng.IPromise { - let mode = this.$scope.command.viewState.mode; + const mode = this.$scope.command.viewState.mode; if (['editPipeline', 'createPipeline'].includes(mode)) { return this.$uibModalInstance.close(this.$scope.command); } else { - let command = copy(this.$scope.command); + const command = copy(this.$scope.command); // Make sure we're sending off a create operation, because there's no such thing as clone for App Engine. command.viewState.mode = 'create'; - let submitMethod = () => this.serverGroupWriter.cloneServerGroup(command, this.$scope.application); + const submitMethod = () => this.serverGroupWriter.cloneServerGroup(command, this.$scope.application); this.taskMonitor.submit(submitMethod); return null; diff --git a/app/scripts/modules/appengine/serverGroup/configure/wizard/configFiles.component.ts b/app/scripts/modules/appengine/serverGroup/configure/wizard/configFiles.component.ts index 679911e0b0c..2e2bf40214f 100644 --- a/app/scripts/modules/appengine/serverGroup/configure/wizard/configFiles.component.ts +++ b/app/scripts/modules/appengine/serverGroup/configure/wizard/configFiles.component.ts @@ -20,8 +20,8 @@ class AppengineConfigFileConfigurerCtrl implements ng.IComponentController { public mapTabToSpaces(event: any) { if (event.which === 9) { event.preventDefault(); - let cursorPosition = event.target.selectionStart; - let inputValue = event.target.value; + const cursorPosition = event.target.selectionStart; + const inputValue = event.target.value; event.target.value = `${inputValue.substring(0, cursorPosition)} ${inputValue.substring(cursorPosition)}`; event.target.selectionStart += 2; } diff --git a/app/scripts/modules/appengine/serverGroup/details/details.controller.ts b/app/scripts/modules/appengine/serverGroup/details/details.controller.ts index 03f621b7e15..1ebb99311e4 100644 --- a/app/scripts/modules/appengine/serverGroup/details/details.controller.ts +++ b/app/scripts/modules/appengine/serverGroup/details/details.controller.ts @@ -39,7 +39,7 @@ class AppengineServerGroupDetailsController { } private static buildExpectedAllocationsTable(expectedAllocations: {[key: string]: number}): string { - let tableRows = map(expectedAllocations, (allocation, serverGroupName) => { + const tableRows = map(expectedAllocations, (allocation, serverGroupName) => { return ` ${serverGroupName} @@ -90,7 +90,7 @@ class AppengineServerGroupDetailsController { return false; } - let expectedAllocations = this.expectedAllocationsAfterDisableOperation(this.serverGroup, this.app); + const expectedAllocations = this.expectedAllocationsAfterDisableOperation(this.serverGroup, this.app); if (expectedAllocations) { return Object.keys(expectedAllocations).length > 0; } else { @@ -107,7 +107,7 @@ class AppengineServerGroupDetailsController { return true; } - let expectedAllocations = this.expectedAllocationsAfterDisableOperation(this.serverGroup, this.app); + const expectedAllocations = this.expectedAllocationsAfterDisableOperation(this.serverGroup, this.app); if (expectedAllocations) { return Object.keys(expectedAllocations).length > 0; } else { @@ -119,20 +119,20 @@ class AppengineServerGroupDetailsController { } public destroyServerGroup(): void { - let taskMonitor = { + const taskMonitor = { application: this.app, title: 'Destroying ' + this.serverGroup.name, }; - let submitMethod = (params: any) => this.serverGroupWriter.destroyServerGroup(this.serverGroup, this.app, params); + const submitMethod = (params: any) => this.serverGroupWriter.destroyServerGroup(this.serverGroup, this.app, params); - let stateParams = { + const stateParams = { name: this.serverGroup.name, accountId: this.serverGroup.account, region: this.serverGroup.region }; - let confirmationModalParams = { + const confirmationModalParams = { header: 'Really destroy ' + this.serverGroup.name + '?', buttonText: 'Destroy ' + this.serverGroup.name, account: this.serverGroup.account, @@ -159,14 +159,14 @@ class AppengineServerGroupDetailsController { }; public enableServerGroup(): void { - let taskMonitor: ITaskMonitorConfig = { + const taskMonitor: ITaskMonitorConfig = { application: this.app, title: 'Enabling ' + this.serverGroup.name, }; - let submitMethod = (params: any) => this.serverGroupWriter.enableServerGroup(this.serverGroup, this.app, Object.assign(params)); + const submitMethod = (params: any) => this.serverGroupWriter.enableServerGroup(this.serverGroup, this.app, Object.assign(params)); - let modalBody = ` + const modalBody = `

    Enabling ${this.serverGroup.name} will set its traffic allocation for @@ -179,7 +179,7 @@ class AppengineServerGroupDetailsController {

    `; - let confirmationModalParams = { + const confirmationModalParams = { header: 'Really enable ' + this.serverGroup.name + '?', buttonText: 'Enable ' + this.serverGroup.name, provider: 'appengine', @@ -201,15 +201,15 @@ class AppengineServerGroupDetailsController { } public disableServerGroup(): void { - let taskMonitor = { + const taskMonitor = { application: this.app, title: 'Disabling ' + this.serverGroup.name, }; - let submitMethod = (params: any) => this.serverGroupWriter.disableServerGroup(this.serverGroup, this.app.name, params); + const submitMethod = (params: any) => this.serverGroupWriter.disableServerGroup(this.serverGroup, this.app.name, params); - let expectedAllocations = this.expectedAllocationsAfterDisableOperation(this.serverGroup, this.app); - let modalBody = ` + const expectedAllocations = this.expectedAllocationsAfterDisableOperation(this.serverGroup, this.app); + const modalBody = `

    For App Engine, a disable operation sets this server group's allocation @@ -228,7 +228,7 @@ class AppengineServerGroupDetailsController {

    `; - let confirmationModalParams = { + const confirmationModalParams = { header: 'Really disable ' + this.serverGroup.name + '?', buttonText: 'Disable ' + this.serverGroup.name, provider: 'appengine', @@ -250,12 +250,12 @@ class AppengineServerGroupDetailsController { } public stopServerGroup(): void { - let taskMonitor = { + const taskMonitor = { application: this.app, title: 'Stopping ' + this.serverGroup.name, }; - let submitMethod = () => this.appengineServerGroupWriter.stopServerGroup(this.serverGroup, this.app); + const submitMethod = () => this.appengineServerGroupWriter.stopServerGroup(this.serverGroup, this.app); let modalBody: string; if (!this.serverGroup.disabled) { @@ -269,7 +269,7 @@ class AppengineServerGroupDetailsController {
    `; } - let confirmationModalParams = { + const confirmationModalParams = { header: 'Really stop ' + this.serverGroup.name + '?', buttonText: 'Stop ' + this.serverGroup.name, provider: 'appengine', @@ -286,14 +286,14 @@ class AppengineServerGroupDetailsController { } public startServerGroup(): void { - let taskMonitor = { + const taskMonitor = { application: this.app, title: 'Starting ' + this.serverGroup.name, }; - let submitMethod = () => this.appengineServerGroupWriter.startServerGroup(this.serverGroup, this.app); + const submitMethod = () => this.appengineServerGroupWriter.startServerGroup(this.serverGroup, this.app); - let confirmationModalParams = { + const confirmationModalParams = { header: 'Really start ' + this.serverGroup.name + '?', buttonText: 'Start ' + this.serverGroup.name, provider: 'appengine', @@ -339,9 +339,9 @@ class AppengineServerGroupDetailsController { } private canStartOrStopServerGroup(): boolean { - let isFlex = this.serverGroup.env === 'FLEXIBLE'; - let usesManualScaling = get(this.serverGroup, 'scalingPolicy.type') === 'MANUAL'; - let usesBasicScaling = get(this.serverGroup, 'scalingPolicy.type') === 'BASIC'; + const isFlex = this.serverGroup.env === 'FLEXIBLE'; + const usesManualScaling = get(this.serverGroup, 'scalingPolicy.type') === 'MANUAL'; + const usesBasicScaling = get(this.serverGroup, 'scalingPolicy.type') === 'BASIC'; return isFlex || usesManualScaling || usesBasicScaling; } @@ -354,7 +354,7 @@ class AppengineServerGroupDetailsController { } if (!serverGroup.disabled) { - let expectedAllocations = this.expectedAllocationsAfterDisableOperation(serverGroup, app); + const expectedAllocations = this.expectedAllocationsAfterDisableOperation(serverGroup, app); template += `
    @@ -383,17 +383,17 @@ class AppengineServerGroupDetailsController { } private expectedAllocationsAfterDisableOperation(serverGroup: ServerGroup, app: Application): {[key: string]: number} { - let loadBalancer = app.getDataSource('loadBalancers').data.find((toCheck: IAppengineLoadBalancer): boolean => { - let allocations = get(toCheck, 'split.allocations', {}); - let enabledServerGroups = Object.keys(allocations); + const loadBalancer = app.getDataSource('loadBalancers').data.find((toCheck: IAppengineLoadBalancer): boolean => { + const allocations = get(toCheck, 'split.allocations', {}); + const enabledServerGroups = Object.keys(allocations); return enabledServerGroups.includes(serverGroup.name); }); if (loadBalancer) { let allocations = cloneDeep(loadBalancer.split.allocations); delete allocations[serverGroup.name]; - let denominator = reduce(allocations, (partialSum: number, allocation: number) => partialSum + allocation, 0); - let precision = loadBalancer.split.shardBy === 'COOKIE' ? 1000 : 100; + const denominator = reduce(allocations, (partialSum: number, allocation: number) => partialSum + allocation, 0); + const precision = loadBalancer.split.shardBy === 'COOKIE' ? 1000 : 100; allocations = mapValues( allocations, (allocation) => Math.round(allocation / denominator * precision) / precision diff --git a/app/scripts/modules/appengine/serverGroup/writer/serverGroup.write.service.ts b/app/scripts/modules/appengine/serverGroup/writer/serverGroup.write.service.ts index 54fca8cd0b5..727dc2390c5 100644 --- a/app/scripts/modules/appengine/serverGroup/writer/serverGroup.write.service.ts +++ b/app/scripts/modules/appengine/serverGroup/writer/serverGroup.write.service.ts @@ -18,9 +18,9 @@ export class AppengineServerGroupWriter { constructor(private taskExecutor: TaskExecutor) {} public startServerGroup(serverGroup: IAppengineServerGroup, application: Application): ng.IPromise { - let job = this.buildJob(serverGroup, application, 'startAppEngineServerGroup'); + const job = this.buildJob(serverGroup, application, 'startAppEngineServerGroup'); - let command: ITaskCommand = { + const command: ITaskCommand = { job: [job], application, description: `Start Server Group: ${serverGroup.name}`, @@ -30,9 +30,9 @@ export class AppengineServerGroupWriter { } public stopServerGroup(serverGroup: IAppengineServerGroup, application: Application): ng.IPromise { - let job = this.buildJob(serverGroup, application, 'stopAppEngineServerGroup'); + const job = this.buildJob(serverGroup, application, 'stopAppEngineServerGroup'); - let command: ITaskCommand = { + const command: ITaskCommand = { job: [job], application, description: `Stop Server Group: ${serverGroup.name}`, diff --git a/app/scripts/modules/appengine/validation/applicationName.validator.ts b/app/scripts/modules/appengine/validation/applicationName.validator.ts index 78967e0fb04..9de1a4af4a4 100644 --- a/app/scripts/modules/appengine/validation/applicationName.validator.ts +++ b/app/scripts/modules/appengine/validation/applicationName.validator.ts @@ -7,7 +7,7 @@ import { // See https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version class AppengineApplicationNameValidator implements IApplicationNameValidator { public validate(name = ''): IValidationResult { - let warnings: string[] = [], + const warnings: string[] = [], errors: string[] = []; if (name.length) { this.validateSpecialCharacters(name, errors); @@ -17,7 +17,7 @@ class AppengineApplicationNameValidator implements IApplicationNameValidator { } private validateSpecialCharacters(name: string, errors: string[]): void { - let pattern = /^[a-z0-9]*$/g; + const pattern = /^[a-z0-9]*$/g; if (!pattern.test(name)) { errors.push('Only numbers and lowercase letters are allowed.'); } @@ -32,7 +32,7 @@ class AppengineApplicationNameValidator implements IApplicationNameValidator { if (name.length >= 56) { warnings.push('You will not be able to include a stack or detail field for clusters.'); } else { - let remaining = 56 - name.length; + const remaining = 56 - name.length; warnings.push(`If you plan to include a stack or detail field for clusters, you will only have ${remaining} character${remaining > 1 ? 's' : ''} to do so.`); } diff --git a/app/scripts/modules/core/api/api.service.spec.ts b/app/scripts/modules/core/api/api.service.spec.ts index 7fcad0ec138..d1c54ab387d 100644 --- a/app/scripts/modules/core/api/api.service.spec.ts +++ b/app/scripts/modules/core/api/api.service.spec.ts @@ -98,25 +98,25 @@ describe('API Service', function () { describe('creating the config with "one" function', function () { it('missing url should create a default config with the base url', function () { - let result = API.one(); + const result = API.one(); expected.url = baseUrl; expect(result.config).toEqual(expected); }); it('single url should create a default config with the base url', function () { - let result = API.one('foo'); + const result = API.one('foo'); expected.url = `${baseUrl}/foo`; expect(result.config).toEqual(expected); }); it('multiple calls to "one" should create a default config with the base url and build out the url', function () { - let result = API.one('foo').one('bar'); + const result = API.one('foo').one('bar'); expected.url = `${baseUrl}/foo/bar`; expect(result.config).toEqual(expected); }); it('should allow for multiple urls to be added to the url', function () { - let result = API.one('foo', 'bar'); + const result = API.one('foo', 'bar'); expected.url = `${baseUrl}/foo/bar`; expect(result.config).toEqual(expected); }); @@ -124,25 +124,25 @@ describe('API Service', function () { describe('creating the config with "all" function', function () { it('missing url should create a default config with the base url', function () { - let result = API.all(); + const result = API.all(); expected.url = baseUrl; expect(result.config).toEqual(expected); }); it('single url should create a default config with the base url', function () { - let result = API.all('foo'); + const result = API.all('foo'); expected.url = `${baseUrl}/foo`; expect(result.config).toEqual(expected); }); it('multiple calls to "all" should create a default config with the base url and build out the url', function () { - let result = API.all('foo').all('bar'); + const result = API.all('foo').all('bar'); expected.url = `${baseUrl}/foo/bar`; expect(result.config).toEqual(expected); }); it('should allow for multiple urls to be added to the url', function () { - let result = API.all('foo', 'bar'); + const result = API.all('foo', 'bar'); expected.url = `${baseUrl}/foo/bar`; expect(result.config).toEqual(expected); }); @@ -150,19 +150,19 @@ describe('API Service', function () { describe('creating the config with mix of "one" and "all" function', function () { it('single url should create a default config with the base url', function () { - let result = API.all('foo').one('bar'); + const result = API.all('foo').one('bar'); expected.url = `${baseUrl}/foo/bar`; expect(result.config).toEqual(expected); }); it('multiple calls to "all" should create a default config with the base url and build out the url', function () { - let result = API.one('foo').all('bar'); + const result = API.one('foo').all('bar'); expected.url = `${baseUrl}/foo/bar`; expect(result.config).toEqual(expected); }); it('should allow for multiple urls to be added to the url', function () { - let result = API.all('foo', 'bar').one('baz'); + const result = API.all('foo', 'bar').one('baz'); expected.url = `${baseUrl}/foo/bar/baz`; expect(result.config).toEqual(expected); }); @@ -170,8 +170,8 @@ describe('API Service', function () { describe('creating multiple endpoints', function () { it('should not stomp on each other', function () { - let first = API.one('bar'); - let second = API.one('foo'); + const first = API.one('bar'); + const second = API.one('foo'); expect(first.config).toEqual({method: '', url: `${baseUrl}/bar`}); expect(second.config).toEqual({method: '', url: `${baseUrl}/foo`}); @@ -180,14 +180,14 @@ describe('API Service', function () { describe('create config with data', function () { it('should not alter the config if no data object passed', function () { - let result = API.one('foo').data(); + const result = API.one('foo').data(); expected.url = `${baseUrl}/foo`; expect(result.config).toEqual(expected); }); it('should add data to the config if data object passed', function () { - let data = {bar: 'baz'}; - let result = API.one('foo').data(data); + const data = {bar: 'baz'}; + const result = API.one('foo').data(data); expected.url = `${baseUrl}/foo`; expected.data = data; expect(result.config).toEqual(expected); @@ -197,30 +197,30 @@ describe('API Service', function () { describe('create a config with params', function () { it('when no params are provided do not alter config', function () { - let result = API.one('foo').withParams(); + const result = API.one('foo').withParams(); expect(result.config).toEqual({method: '', url: `${baseUrl}/foo`}); }); it('when params are provided', function () { - let result = API.one('foo').withParams({one: 1}); + const result = API.one('foo').withParams({one: 1}); expect(result.config).toEqual({method: '', url: `${baseUrl}/foo`, params: {one: 1} }); }); }); describe('useCache()', function () { it('should set cache to "true" if no params set', function () { - let result = API.one('foo').useCache(); + const result = API.one('foo').useCache(); expect(result.config.cache).toBe(true); }); it('should set cache to "false" if explicitly set', function () { - let result = API.one('foo').useCache(false); + const result = API.one('foo').useCache(false); expect(result.config.cache).toBe(false); }); it('should set cache to cache object if explicitly set', function () { - let cacheObj = {count: 1}; - let result = API.one('foo').useCache(cacheObj); + const cacheObj = {count: 1}; + const result = API.one('foo').useCache(cacheObj); expect(result.config.cache).toBe(cacheObj); }); }); @@ -304,7 +304,7 @@ describe('API Service', function () { }); it('should create the url and POST with data', function () { - let data = {bar: 7}; + const data = {bar: 7}; $httpBackend.expectPOST(`${baseUrl}/foo`, data).respond(200); API.one('foo').post(data); @@ -323,7 +323,7 @@ describe('API Service', function () { }); it('should create the url and PUT with data', function () { - let data = {bar: 7}; + const data = {bar: 7}; $httpBackend.expectPUT(`${baseUrl}/foo`, data).respond(200); API.one('foo').put(data); @@ -342,7 +342,7 @@ describe('API Service', function () { }); it('should create the url with params and make a DELETE call', function () { - let params = {bar: 7}; + const params = {bar: 7}; $httpBackend.expectDELETE(`${baseUrl}/foo?bar=7`).respond(200); API.one('foo').remove(params); diff --git a/app/scripts/modules/core/application/application.model.spec.ts b/app/scripts/modules/core/application/application.model.spec.ts index fe0427d102e..932498f270b 100644 --- a/app/scripts/modules/core/application/application.model.spec.ts +++ b/app/scripts/modules/core/application/application.model.spec.ts @@ -187,7 +187,7 @@ describe ('Application Model', function () { it('sets default credentials and region from server group when only one account/region found', function () { - let serverGroups: ServerGroup[] = [{ + const serverGroups: ServerGroup[] = [{ name: 'deck-test-v001', cluster: 'deck-test', account: 'test', @@ -206,7 +206,7 @@ describe ('Application Model', function () { }); it('sets default credentials and region from load balancer when only one account/region found', function () { - let serverGroups: ServerGroup[] = [], + const serverGroups: ServerGroup[] = [], loadBalancers: ILoadBalancer[] = [{name: 'deck-frontend', cloudProvider: 'gce', vpcId: 'vpc0', region: 'us-central-1', account: 'prod' }], securityGroupsByApplicationName: any[] = []; @@ -216,7 +216,7 @@ describe ('Application Model', function () { }); it('sets default credentials and region from security group', function () { - let serverGroups: any[] = [], + const serverGroups: any[] = [], loadBalancers: ILoadBalancer[] = [], securityGroupsByApplicationName: any[] = [{name: 'deck-test', provider: 'cf', accountName: 'test', region: 'us-south-7'}]; @@ -226,7 +226,7 @@ describe ('Application Model', function () { }); it('does not set defaults when multiple values found for the same provider', function () { - let serverGroups: ServerGroup[] = [], + const serverGroups: ServerGroup[] = [], loadBalancers: ILoadBalancer[] = [ {name: 'deck-frontend', cloudProvider: 'aws', vpcId: 'vpcId', region: 'us-west-1', account: 'prod'} ], securityGroupsByApplicationName: any[] = [{name: 'deck-test', provider: 'aws', accountName: 'test', region: 'us-east-1'}]; @@ -236,7 +236,7 @@ describe ('Application Model', function () { }); it('sets default region or default credentials if possible', function () { - let serverGroups: ServerGroup[] = [], + const serverGroups: ServerGroup[] = [], loadBalancers: ILoadBalancer[] = [{name: 'deck-frontend', cloudProvider: 'aws', vpcId: 'vpcId', region: 'us-east-1', account: 'prod'}], securityGroupsByApplicationName: any[] = [{name: 'deck-test', provider: 'aws', accountName: 'test', region: 'us-east-1'}]; @@ -246,7 +246,7 @@ describe ('Application Model', function () { }); it('sets default credentials, even if region cannot be set', function () { - let serverGroups: ServerGroup[] = [], + const serverGroups: ServerGroup[] = [], loadBalancers: ILoadBalancer[] = [{name: 'deck-frontend', cloudProvider: 'aws', vpcId: 'vpc0', region: 'us-east-1', account: 'test'}], securityGroupsByApplicationName: any[] = [{name: 'deck-test', provider: 'aws', accountName: 'test', region: 'us-west-1'}]; @@ -256,7 +256,7 @@ describe ('Application Model', function () { }); it('should set defaults for multiple providers', function () { - let serverGroups: any[] = [ + const serverGroups: any[] = [ { name: 'deck-test-v001', account: 'test', diff --git a/app/scripts/modules/core/application/application.model.ts b/app/scripts/modules/core/application/application.model.ts index abbb4aee8c0..b564f52c929 100644 --- a/app/scripts/modules/core/application/application.model.ts +++ b/app/scripts/modules/core/application/application.model.ts @@ -128,10 +128,10 @@ export class Application { * @param failureMethod a method to call if the refresh fails */ public onRefresh($scope: ng.IScope, method: any, failureMethod: any): void { - let success = this.refreshStream.subscribe(method); + const success = this.refreshStream.subscribe(method); $scope.$on('$destroy', () => success.unsubscribe()); if (failureMethod) { - let failure = this.refreshFailureStream.subscribe(failureMethod); + const failure = this.refreshFailureStream.subscribe(failureMethod); $scope.$on('$destroy', () => failure.unsubscribe()); } } @@ -142,7 +142,7 @@ export class Application { * @param scope */ public enableAutoRefresh(scope: ng.IScope): void { - let dataLoader = this.scheduler.subscribe(() => this.refresh()); + const dataLoader = this.scheduler.subscribe(() => this.refresh()); scope.$on('$destroy', () => { dataLoader.unsubscribe(); this.scheduler.unsubscribe(); @@ -171,16 +171,16 @@ export class Application { } private extractProviderDefault(field: string): Map { - let results = new Map(); - let sources = this.dataSources.filter(d => d[field] !== undefined); - let providers = sources.map(ds => ds.data.map(d => d[ds.providerField])).filter(p => p.length > 0); + const results = new Map(); + const sources = this.dataSources.filter(d => d[field] !== undefined); + const providers = sources.map(ds => ds.data.map(d => d[ds.providerField])).filter(p => p.length > 0); let allProviders: any; // typescript made me do it this way allProviders = union(...providers); allProviders.forEach((provider: string) => { - let vals = sources + const vals = sources .map(ds => map(ds.data.filter(d => d[ds.providerField] === provider), ds[field])) .filter(v => v.length > 0); - let allRegions = union(...vals); + const allRegions = union(...vals); if (allRegions.length === 1) { (results)[provider] = allRegions[0]; } diff --git a/app/scripts/modules/core/application/application.state.provider.ts b/app/scripts/modules/core/application/application.state.provider.ts index fdf9532f661..269dbba5198 100644 --- a/app/scripts/modules/core/application/application.state.provider.ts +++ b/app/scripts/modules/core/application/application.state.provider.ts @@ -74,7 +74,7 @@ export class ApplicationStateProvider implements ng.IServiceProvider { * @param relativeUrl (optional) the prefix used for the application view */ public addParentState(parentState: INestedState, mainView: string, relativeUrl = '') { - let applicationConfig: INestedState = { + const applicationConfig: INestedState = { name: 'application', abstract: true, url: `${relativeUrl}/:application`, diff --git a/app/scripts/modules/core/application/applicationModel.builder.ts b/app/scripts/modules/core/application/applicationModel.builder.ts index 710c3f793bc..1c2931d4ccc 100644 --- a/app/scripts/modules/core/application/applicationModel.builder.ts +++ b/app/scripts/modules/core/application/applicationModel.builder.ts @@ -20,7 +20,7 @@ export class ApplicationModelBuilder { if (Array.isArray(dataSources[0])) { dataSources = dataSources[0]; } - let application = new Application('app', this.schedulerFactory.createScheduler(), this.$q, this.$log); + const application = new Application('app', this.schedulerFactory.createScheduler(), this.$q, this.$log); dataSources.forEach(ds => this.addDataSource(new DataSourceConfig(ds), application)); return application; } @@ -38,7 +38,7 @@ export class ApplicationModelBuilder { } private addDataSource(config: DataSourceConfig, application: Application): void { - let source = new ApplicationDataSource(config, application, this.$q, this.$log, this.$filter); + const source = new ApplicationDataSource(config, application, this.$q, this.$log, this.$filter); application.dataSources.push(source); application[config.key] = source; } diff --git a/app/scripts/modules/core/application/config/appConfig.states.ts b/app/scripts/modules/core/application/config/appConfig.states.ts index f6f3000701d..7476098437d 100644 --- a/app/scripts/modules/core/application/config/appConfig.states.ts +++ b/app/scripts/modules/core/application/config/appConfig.states.ts @@ -15,7 +15,7 @@ module(APP_CONFIG_STATES, [ 'insight': { templateProvider: ['$templateCache', 'overrideRegistry', ($templateCache: ng.ITemplateCacheService, overrideRegistry: OverrideRegistry) => { - let template: string = overrideRegistry.getTemplate('applicationConfigView', require('./applicationConfig.view.html')); + const template: string = overrideRegistry.getTemplate('applicationConfigView', require('./applicationConfig.view.html')); return $templateCache.get(template); }], controller: 'ApplicationConfigController', diff --git a/app/scripts/modules/core/application/config/dataSources/applicationDataSourceEditor.component.spec.ts b/app/scripts/modules/core/application/config/dataSources/applicationDataSourceEditor.component.spec.ts index ed53baef36b..b9fa996d93c 100644 --- a/app/scripts/modules/core/application/config/dataSources/applicationDataSourceEditor.component.spec.ts +++ b/app/scripts/modules/core/application/config/dataSources/applicationDataSourceEditor.component.spec.ts @@ -14,7 +14,7 @@ describe('Component: Application Data Source Editor', () => { $q: ng.IQService, $scope: ng.IScope; - let initialize = () => { + const initialize = () => { ctrl = $componentController( 'applicationDataSourceEditor', { $scope: null, applicationWriter: applicationWriter }, diff --git a/app/scripts/modules/core/application/config/dataSources/applicationDataSourceEditor.component.ts b/app/scripts/modules/core/application/config/dataSources/applicationDataSourceEditor.component.ts index 7c23ce5ce48..44b18b04b0c 100644 --- a/app/scripts/modules/core/application/config/dataSources/applicationDataSourceEditor.component.ts +++ b/app/scripts/modules/core/application/config/dataSources/applicationDataSourceEditor.component.ts @@ -65,7 +65,7 @@ export class DataSourceEditorController implements ng.IComponentController { public save() { this.saving = true; this.saveError = false; - let newDataSources = { enabled: this.explicitlyEnabled, disabled: this.explicitlyDisabled }; + const newDataSources = { enabled: this.explicitlyEnabled, disabled: this.explicitlyDisabled }; this.applicationWriter.updateApplication({ name: this.application.name, accounts: this.application.attributes.accounts, diff --git a/app/scripts/modules/core/application/config/footer/configSectionFooter.component.spec.ts b/app/scripts/modules/core/application/config/footer/configSectionFooter.component.spec.ts index 07e3453b15c..667b85db9af 100644 --- a/app/scripts/modules/core/application/config/footer/configSectionFooter.component.spec.ts +++ b/app/scripts/modules/core/application/config/footer/configSectionFooter.component.spec.ts @@ -10,7 +10,7 @@ describe('Component: ConfigSectionFooter', () => { $q: ng.IQService, $scope: ng.IScope; - let initializeController = (data: any) => { + const initializeController = (data: any) => { $ctrl = $componentController( 'configSectionFooter', { $scope: null, applicationWriter: applicationWriter }, @@ -34,7 +34,7 @@ describe('Component: ConfigSectionFooter', () => { describe('revert', () => { it('replaces contents of config with original config', () => { - let data = { + const data = { viewState: { originalConfig: { exceptions: ([] as any), enabled: false } }, @@ -76,7 +76,7 @@ describe('Component: ConfigSectionFooter', () => { }); it ('sets state to saving, saves, then sets flags appropriately', () => { - let viewState = data.viewState; + const viewState = data.viewState; spyOn(applicationWriter, 'updateApplication').and.returnValue($q.when(null)); initializeController(data); $ctrl.save(); @@ -93,7 +93,7 @@ describe('Component: ConfigSectionFooter', () => { }); it('sets appropriate flags when save fails', () => { - let viewState = data.viewState; + const viewState = data.viewState; spyOn(applicationWriter, 'updateApplication').and.returnValue($q.reject(null)); initializeController(data); $ctrl.save(); diff --git a/app/scripts/modules/core/application/listExtractor/listExtractor.service.spec.ts b/app/scripts/modules/core/application/listExtractor/listExtractor.service.spec.ts index 0e828443b19..de19d269f51 100644 --- a/app/scripts/modules/core/application/listExtractor/listExtractor.service.spec.ts +++ b/app/scripts/modules/core/application/listExtractor/listExtractor.service.spec.ts @@ -10,8 +10,8 @@ describe('appListExtractorService', function () { let service: AppListExtractor, applicationModelBuilder: ApplicationModelBuilder; - let buildApplication = (serverGroups: any[] = []): Application => { - let application: Application = applicationModelBuilder.createApplication({key: 'serverGroups', lazy: true}); + const buildApplication = (serverGroups: any[] = []): Application => { + const application: Application = applicationModelBuilder.createApplication({key: 'serverGroups', lazy: true}); application.getDataSource('serverGroups').data = serverGroups; return application; }; @@ -33,34 +33,34 @@ describe('appListExtractorService', function () { describe('Get Regions from a list of applications', function () { it('should get a empty list for one application w/ no clusters', function () { - let application: Application = buildApplication(); + const application: Application = buildApplication(); - let result = service.getRegions([application]); + const result = service.getRegions([application]); expect(result.length).toEqual(0); expect(result).toEqual([]); }); it('should get a list of 1 aws region for one application w/ one cluster with one server group in one region', function () { - let application: Application = buildApplication([{region: 'us-west-1'}]); - let result = service.getRegions([application]); + const application: Application = buildApplication([{region: 'us-west-1'}]); + const result = service.getRegions([application]); expect(result.length).toEqual(1); expect(result).toEqual(['us-west-1']); }); it('should get a list of 2 aws region for one application w/ one cluster with two server groups in 2 region', function () { - let application: Application = buildApplication([{region: 'us-west-1'}, {region: 'us-west-2'}]); - let result = service.getRegions([application]); + const application: Application = buildApplication([{region: 'us-west-1'}, {region: 'us-west-2'}]); + const result = service.getRegions([application]); expect(result.length).toEqual(2); expect(result).toEqual(['us-west-1', 'us-west-2']); }); it('should get a unique list of 2 aws region for one application w/ 3 server groups in 2 regions', function () { - let application: Application = buildApplication([{region: 'us-west-1'}, {region: 'us-west-2'}, {region: 'us-west-1'}]); + const application: Application = buildApplication([{region: 'us-west-1'}, {region: 'us-west-2'}, {region: 'us-west-1'}]); - let result = service.getRegions([application]); + const result = service.getRegions([application]); expect(result.length).toEqual(2); expect(result).toEqual(['us-west-1', 'us-west-2']); }); @@ -68,43 +68,43 @@ describe('appListExtractorService', function () { describe('Get Stacks from a list of applications', function() { it('should get a empty list for one application w/ no clusters', function () { - let application: Application = buildApplication(); + const application: Application = buildApplication(); - let result = service.getStacks([application]); + const result = service.getStacks([application]); expect(result.length).toEqual(0); expect(result).toEqual([]); }); it('should get a list of 1 stack for one application w/ one cluster with one server group in one stack', function () { - let application: Application = buildApplication([ {stack: 'prod'} ]); + const application: Application = buildApplication([ {stack: 'prod'} ]); - let result = service.getStacks([application]); + const result = service.getStacks([application]); expect(result.length).toEqual(1); expect(result).toEqual(['prod']); }); it('should get a list of 2 stacks for one application w/ multi cluster with one server group in one stack', function () { - let application: Application = buildApplication([ {stack: 'prod'}, {stack: 'test'} ]); + const application: Application = buildApplication([ {stack: 'prod'}, {stack: 'test'} ]); - let result = service.getStacks([application]); + const result = service.getStacks([application]); expect(result.length).toEqual(2); expect(result).toEqual(['prod', 'test']); }); it('should get a list of 2 stacks for two application w/ one cluster each with one server group in one stack', function () { - let applicationA: Application = buildApplication([ {stack: 'prod'} ]); - let applicationB: Application = buildApplication([ {stack: 'mceprod'} ]); + const applicationA: Application = buildApplication([ {stack: 'prod'} ]); + const applicationB: Application = buildApplication([ {stack: 'mceprod'} ]); - let result = service.getStacks([applicationA, applicationB]); + const result = service.getStacks([applicationA, applicationB]); expect(result.length).toEqual(2); expect(result).toEqual(['mceprod', 'prod']); }); it('should get a list of 1 stacks with a filter on the serverGroup name', function () { - let application: Application = buildApplication([ {name: 'foo', stack: 'prod'}, {name: 'bar', stack: 'test'} ]); + const application: Application = buildApplication([ {name: 'foo', stack: 'prod'}, {name: 'bar', stack: 'test'} ]); - let filterByBar = (serverGroup: ServerGroup) => serverGroup.name === 'bar'; - let result = service.getStacks([application], filterByBar); + const filterByBar = (serverGroup: ServerGroup) => serverGroup.name === 'bar'; + const result = service.getStacks([application], filterByBar); expect(result.length).toEqual(1); expect(result).toEqual(['test']); }); @@ -113,43 +113,43 @@ describe('appListExtractorService', function () { describe('Get Clusters from a list of applications', function() { it('should get a empty list for one application w/ no clusters', function () { - let application: Application = buildApplication(); + const application: Application = buildApplication(); - let result = service.getClusters([application]); + const result = service.getClusters([application]); expect(result.length).toEqual(0); expect(result).toEqual([]); }); it('should get a list of 1 cluster for one application w/ one cluster', function () { - let application: Application = buildApplication([ {cluster: 'mahe-prod'} ]); + const application: Application = buildApplication([ {cluster: 'mahe-prod'} ]); - let result = service.getClusters([application]); + const result = service.getClusters([application]); expect(result.length).toEqual(1); expect(result).toEqual(['mahe-prod']); }); it('should get a list of 2 cluster names for one application w/ multi clusters', function () { - let application: Application = buildApplication([ {cluster: 'mahe-prod'}, {cluster: 'mahe-prestaging'} ]); + const application: Application = buildApplication([ {cluster: 'mahe-prod'}, {cluster: 'mahe-prestaging'} ]); - let result = service.getClusters([application]); + const result = service.getClusters([application]); expect(result.length).toEqual(2); expect(result).toEqual(['mahe-prestaging', 'mahe-prod']); }); it('should get a list of 2 clusters for two application w/ one cluster each', function () { - let applicationA: Application = buildApplication([ {cluster: 'deck-main'} ]); - let applicationB: Application = buildApplication([ {cluster: 'gate-main'} ]); + const applicationA: Application = buildApplication([ {cluster: 'deck-main'} ]); + const applicationB: Application = buildApplication([ {cluster: 'gate-main'} ]); - let result = service.getClusters([applicationA, applicationB]); + const result = service.getClusters([applicationA, applicationB]); expect(result.length).toEqual(2); expect(result).toEqual(['deck-main', 'gate-main']); }); it('should get a list of 1 cluster with a filter on the cluster name', function () { - let application: Application = buildApplication([ {cluster: 'deck-main'}, {cluster: 'gate-main'} ]); + const application: Application = buildApplication([ {cluster: 'deck-main'}, {cluster: 'gate-main'} ]); - let filterByGate = (serverGroup: ServerGroup) => serverGroup.cluster === 'gate-main'; - let result = service.getClusters([application], filterByGate); + const filterByGate = (serverGroup: ServerGroup) => serverGroup.cluster === 'gate-main'; + const result = service.getClusters([application], filterByGate); expect(result.length).toEqual(1); expect(result).toEqual(['gate-main']); }); @@ -157,41 +157,41 @@ describe('appListExtractorService', function () { describe('Get ASGs from a list of applications', function() { it('should get a empty list for one application w/ no clusters', function () { - let application: Application = buildApplication(); - let result = service.getAsgs([application]); + const application: Application = buildApplication(); + const result = service.getAsgs([application]); expect(result.length).toEqual(0); expect(result).toEqual([]); }); it('should get a list of 1 ASG for one application w/ one cluster', function () { - let application: Application = buildApplication([ {name: 'mahe-main-v000'} ]); - let result = service.getAsgs([application]); + const application: Application = buildApplication([ {name: 'mahe-main-v000'} ]); + const result = service.getAsgs([application]); expect(result.length).toEqual(1); expect(result).toEqual(['mahe-main-v000']); }); it('should get a list of 2 ASG names for one application w/ multi clusters', function () { - let application: Application = buildApplication([{name: 'mahe-main-v000'}, {name: 'mahe-prestaging-v002'}]); - let result = service.getAsgs([application]); + const application: Application = buildApplication([{name: 'mahe-main-v000'}, {name: 'mahe-prestaging-v002'}]); + const result = service.getAsgs([application]); expect(result.length).toEqual(2); expect(result).toEqual(['mahe-main-v000', 'mahe-prestaging-v002' ]); }); it('should get a list of 2 ASGs for two application w/ one cluster each', function () { - let applicationA: Application = buildApplication([{name: 'mahe-prestaging-v002'}]); - let applicationB: Application = buildApplication([{name: 'deck-main-v002'}]); - let result = service.getAsgs([applicationA, applicationB]); + const applicationA: Application = buildApplication([{name: 'mahe-prestaging-v002'}]); + const applicationB: Application = buildApplication([{name: 'deck-main-v002'}]); + const result = service.getAsgs([applicationA, applicationB]); expect(result.length).toEqual(2); expect(result).toEqual(['deck-main-v002', 'mahe-prestaging-v002']); }); it('should get a list of 1 cluster with a filter on the cluster name', function () { - let application: Application = buildApplication([ + const application: Application = buildApplication([ {cluster: 'gate-main', name: 'gate-main-v000'}, {cluster: 'deck-main', name: 'deck-main-v002'} ]); - let filterByGate = (serverGroup: ServerGroup) => serverGroup.cluster === 'gate-main'; - let result = service.getAsgs([application], filterByGate); + const filterByGate = (serverGroup: ServerGroup) => serverGroup.cluster === 'gate-main'; + const result = service.getAsgs([application], filterByGate); expect(result.length).toEqual(1); expect(result).toEqual(['gate-main-v000']); }); @@ -201,69 +201,69 @@ describe('appListExtractorService', function () { describe('Get Zones from a list of applications', function() { it('should get a empty list for one application w/ no clusters', function () { - let application: Application = buildApplication(); - let result = service.getZones([application]); + const application: Application = buildApplication(); + const result = service.getZones([application]); expect(result.length).toEqual(0); expect(result).toEqual([]); }); it('should get a list of 1 zone for one application w/ one cluster', function () { - let application: Application = buildApplication([ + const application: Application = buildApplication([ { name: 'mahe-main-v000', instances: [ { availabilityZone: 'us-west-2a' } ] } ]); - let result = service.getZones([application]); + const result = service.getZones([application]); expect(result.length).toEqual(1); expect(result).toEqual(['us-west-2a']); }); it('should get a list of 2 Zones names for one application w/ multi clusters', function () { - let application: Application = buildApplication([ + const application: Application = buildApplication([ { instances: [ { availabilityZone: 'us-west-2a' } ] }, { instances: [ { availabilityZone: 'us-west-2d' } ] }, ]); - let result = service.getZones([application]); + const result = service.getZones([application]); expect(result.length).toEqual(2); expect(result).toEqual(['us-west-2a', 'us-west-2d' ]); }); it('should get a list of 2 Zones for two application w/ one cluster each', function () { - let applicationA: Application = buildApplication([ + const applicationA: Application = buildApplication([ { instances: [ { availabilityZone: 'us-west-2a' } ] } ]); - let applicationB: Application = buildApplication([ + const applicationB: Application = buildApplication([ { instances: [ { availabilityZone: 'us-west-2d' } ] } ]); - let result = service.getZones([applicationA, applicationB]); + const result = service.getZones([applicationA, applicationB]); expect(result.length).toEqual(2); expect(result).toEqual(['us-west-2a', 'us-west-2d']); }); it('should get a list of 1 cluster with a filter on the cluster name and region', function () { - let application: Application = buildApplication([ + const application: Application = buildApplication([ { cluster: 'deck-main', region: 'us-west-2', instances: [ { availabilityZone: 'us-west-2a' } ] }, { cluster: 'gate-main', region: 'us-west-2', instances: [ { availabilityZone: 'us-west-2d' } ] }, { cluster: 'gate-main', region: 'us-east-1', instances: [ { availabilityZone: 'us-east-1d' } ] }, ]); - let filterByGate = (serverGroup: ServerGroup) => serverGroup.cluster === 'gate-main'; - let filterByRegion = (serverGroup: ServerGroup) => serverGroup.region === 'us-east-1'; - let result = service.getZones([application], filterByGate, filterByRegion); + const filterByGate = (serverGroup: ServerGroup) => serverGroup.cluster === 'gate-main'; + const filterByRegion = (serverGroup: ServerGroup) => serverGroup.region === 'us-east-1'; + const result = service.getZones([application], filterByGate, filterByRegion); expect(result.length).toEqual(1); expect(result).toEqual(['us-east-1d']); }); it('should get a list of 1 cluster with a filter on the cluster name and region and serverGroupName', function () { - let application: Application = buildApplication([ + const application: Application = buildApplication([ { cluster: 'deck-main', region: 'us-west-2', name: 'deck-main-v001', instances: [ { availabilityZone: 'us-west-2a' } ] }, { cluster: 'gate-main', region: 'us-west-2', name: 'gate-main-v002', instances: [ { availabilityZone: 'us-west-2d' } ] }, { cluster: 'gate-main', region: 'us-east-1', name: 'gate-main-v003', instances: [ { availabilityZone: 'us-east-1d' } ] }, { cluster: 'gate-main', region: 'eu-west-1', name: 'gate-main-v004', instances: [ { availabilityZone: 'eu-west-1b' } ] }, ]); - let filterByGate = (serverGroup: ServerGroup) => serverGroup.cluster === 'gate-main'; - let filterByRegion = (serverGroup: ServerGroup) => serverGroup.region === 'eu-west-1'; - let filterByServerGroupName = (serverGroup: ServerGroup) => serverGroup.name === 'gate-main-v004'; - let result = service.getZones([application], filterByGate, filterByRegion, filterByServerGroupName); + const filterByGate = (serverGroup: ServerGroup) => serverGroup.cluster === 'gate-main'; + const filterByRegion = (serverGroup: ServerGroup) => serverGroup.region === 'eu-west-1'; + const filterByServerGroupName = (serverGroup: ServerGroup) => serverGroup.name === 'gate-main-v004'; + const result = service.getZones([application], filterByGate, filterByRegion, filterByServerGroupName); expect(result.length).toEqual(1); expect(result).toEqual(['eu-west-1b']); }); @@ -271,27 +271,27 @@ describe('appListExtractorService', function () { describe('Get Instances from a list of applications', function() { it('should get a empty list for one application w/ no clusters', function () { - let application: Application = buildApplication(); - let result = service.getInstances([application]); + const application: Application = buildApplication(); + const result = service.getInstances([application]); expect(result.length).toEqual(0); expect(result).toEqual([]); }); it('should get a list of 1 instance for one application w/ one cluster with one instance', function () { - let application: Application = buildApplication([ + const application: Application = buildApplication([ { instances: [ { id: 'i-1234' } ] } ]); - let result = service.getInstances([application]); + const result = service.getInstances([application]); expect(result.length).toEqual(1); expect(result[0].id).toEqual('i-1234'); }); it('should get a list of 2 instances names for one application w/ multi clusters that have 1 instance each', function () { - let application: Application = buildApplication([ + const application: Application = buildApplication([ { instances: [ { availabilityZone: 'us-west-2a', id: 'i-1234' } ] }, { instances: [ { availabilityZone: 'us-west-2d', id: 'i-4321' } ] } ]); - let result = service.getInstances([application]); + const result = service.getInstances([application]); expect(result.length).toEqual(2); expect(result).toEqual([ { @@ -306,14 +306,14 @@ describe('appListExtractorService', function () { }); it('should get a list of 2 Instances for two application w/ one cluster each with one instance', function () { - let applicationA: Application = buildApplication([ + const applicationA: Application = buildApplication([ { instances: [ { availabilityZone: 'us-west-2a', id: 'i-4321' } ] } ]); - let applicationB: Application = buildApplication([ + const applicationB: Application = buildApplication([ { instances: [ { availabilityZone: 'us-west-2d', id: 'i-1111' } ] } ]); - let result = service.getInstances([applicationA, applicationB]); + const result = service.getInstances([applicationA, applicationB]); expect(result.length).toEqual(2); expect(result).toEqual([ { @@ -330,15 +330,15 @@ describe('appListExtractorService', function () { }); it('should get a list of 1 cluster with a filter on the cluster name and region', function () { - let application: Application = buildApplication([ + const application: Application = buildApplication([ { cluster: 'deck-main', region: 'us-west-2', instances: [ { availabilityZone: 'us-west-2a', id: 'i-1234' } ] }, { cluster: 'gate-main', region: 'us-west-2', instances: [ { availabilityZone: 'us-west-2d', id: 'i-3949' } ] }, { cluster: 'gate-main', region: 'us-east-1', instances: [ { availabilityZone: 'us-east-1d', id: 'i-3333' } ] } ]); - let filterByGate = (serverGroup: ServerGroup) => serverGroup.cluster === 'gate-main'; - let filterByRegion = (serverGroup: ServerGroup) => serverGroup.region === 'us-east-1'; - let result = service.getInstances([application], filterByGate, filterByRegion); + const filterByGate = (serverGroup: ServerGroup) => serverGroup.cluster === 'gate-main'; + const filterByRegion = (serverGroup: ServerGroup) => serverGroup.region === 'us-east-1'; + const result = service.getInstances([application], filterByGate, filterByRegion); expect(result.length).toEqual(1); expect(result).toEqual([ { @@ -350,17 +350,17 @@ describe('appListExtractorService', function () { it('should get a list of 1 instance with a filter on the cluster name and region and availabilityZone', function () { - let application: Application = buildApplication([ + const application: Application = buildApplication([ { cluster: 'deck-main', region: 'us-west-2', instances: [ { availabilityZone: 'us-west-2a' } ] }, { cluster: 'gate-main', region: 'us-west-2', instances: [ { availabilityZone: 'us-west-2d' } ] }, { cluster: 'gate-main', region: 'us-east-1', instances: [ { availabilityZone: 'us-east-1d' } ] }, { cluster: 'gate-main', region: 'eu-west-1', instances: [ { availabilityZone: 'eu-west-1b', id: 'i-12344' } ] }, ]); - let filterByGate = (serverGroup: ServerGroup) => serverGroup.cluster === 'gate-main'; - let filterByRegion = (serverGroup: ServerGroup) => serverGroup.region === 'eu-west-1'; - let filterByAvailabilityZone = (instance: Instance) => instance.availabilityZone === 'eu-west-1b'; - let result = service.getInstances([application], filterByGate, filterByRegion, filterByAvailabilityZone); + const filterByGate = (serverGroup: ServerGroup) => serverGroup.cluster === 'gate-main'; + const filterByRegion = (serverGroup: ServerGroup) => serverGroup.region === 'eu-west-1'; + const filterByAvailabilityZone = (instance: Instance) => instance.availabilityZone === 'eu-west-1b'; + const result = service.getInstances([application], filterByGate, filterByRegion, filterByAvailabilityZone); expect(result.length).toEqual(1); expect(result).toEqual([ { diff --git a/app/scripts/modules/core/application/listExtractor/listExtractor.service.ts b/app/scripts/modules/core/application/listExtractor/listExtractor.service.ts index 1eeb0bce6db..89832444da5 100644 --- a/app/scripts/modules/core/application/listExtractor/listExtractor.service.ts +++ b/app/scripts/modules/core/application/listExtractor/listExtractor.service.ts @@ -12,7 +12,7 @@ export interface IInstanceFilter { (i: Instance): boolean; } -let defaultFilter = () => true; +const defaultFilter = () => true; export class AppListExtractor { diff --git a/app/scripts/modules/core/application/modal/validation/exampleApplicationName.validator.ts b/app/scripts/modules/core/application/modal/validation/exampleApplicationName.validator.ts index ea1ee1b82b8..fa3ebc50b18 100644 --- a/app/scripts/modules/core/application/modal/validation/exampleApplicationName.validator.ts +++ b/app/scripts/modules/core/application/modal/validation/exampleApplicationName.validator.ts @@ -19,7 +19,7 @@ export class ExampleApplicationNameValidator implements IApplicationNameValidato public get provider() { return 'example'; } public validate(name = ''): IValidationResult { - let warnings: string[] = [], + const warnings: string[] = [], errors: string[] = []; name = name || ''; if (name === this.WARNING_CONDITION) { @@ -54,7 +54,7 @@ export class ExampleApplicationNameValidator2 implements IApplicationNameValidat public get provider() { return 'example2'; } public validate(name = ''): IValidationResult { - let warnings: string[] = [], + const warnings: string[] = [], errors: string[] = []; name = name || ''; if (name === this.WARNING_CONDITION) { diff --git a/app/scripts/modules/core/application/modal/validation/validateApplicationName.directive.ts b/app/scripts/modules/core/application/modal/validation/validateApplicationName.directive.ts index 150c7197bad..339cefd7b07 100644 --- a/app/scripts/modules/core/application/modal/validation/validateApplicationName.directive.ts +++ b/app/scripts/modules/core/application/modal/validation/validateApplicationName.directive.ts @@ -26,7 +26,7 @@ class ValidateApplicationNameController implements ng.IComponentController { public initialize() { this.model.$asyncValidators['validateApplicationName'] = (value: string) => { - let deferred: ng.IDeferred = this.$q.defer(); + const deferred: ng.IDeferred = this.$q.defer(); this.applicationNameValidator.validate(value, this.cloudProviders) .then((result: IApplicationNameValidationResult) => { if (result.errors.length) { diff --git a/app/scripts/modules/core/application/service/application.read.service.spec.ts b/app/scripts/modules/core/application/service/application.read.service.spec.ts index 106f106c8b3..08f0d583786 100644 --- a/app/scripts/modules/core/application/service/application.read.service.spec.ts +++ b/app/scripts/modules/core/application/service/application.read.service.spec.ts @@ -53,7 +53,7 @@ describe('Service: applicationReader', function () { let application: Application = null; function loadApplication(dataSources?: IApplicationDataSourceAttribute) { - let response = {applicationName: 'deck', attributes: {} as any}; + const response = {applicationName: 'deck', attributes: {} as any}; if (dataSources !== undefined) { response.attributes['dataSources'] = dataSources; } @@ -88,7 +88,7 @@ describe('Service: applicationReader', function () { }); it ('only loads configured dataSources if attribute is non-empty', function () { - let dataSources = { enabled: ['serverGroups'], disabled: ['securityGroups', 'loadBalancers'] }; + const dataSources = { enabled: ['serverGroups'], disabled: ['securityGroups', 'loadBalancers'] }; loadApplication(dataSources); expect((clusterService.loadServerGroups).calls.count()).toBe(1); expect((securityGroupReader.getApplicationSecurityGroups).calls.count()).toBe(0); diff --git a/app/scripts/modules/core/application/service/application.write.service.spec.ts b/app/scripts/modules/core/application/service/application.write.service.spec.ts index b5feedb818d..25eac82796b 100644 --- a/app/scripts/modules/core/application/service/application.write.service.spec.ts +++ b/app/scripts/modules/core/application/service/application.write.service.spec.ts @@ -27,7 +27,7 @@ describe('Service: applicationWriter', function () { it('should execute one task for an application with one account', function () { spyOn(taskExecutor, 'executeTask'); - let application: IApplicationAttributes = { + const application: IApplicationAttributes = { name: 'foo', accounts: ['test'], cloudProviders: [], @@ -43,7 +43,7 @@ describe('Service: applicationWriter', function () { let jobs: IJob[] = []; spyOn(taskExecutor, 'executeTask').and.callFake((task: any) => jobs = task.job); - let application: IApplicationAttributes = { + const application: IApplicationAttributes = { name: 'foo', accounts: ['test', 'prod'], cloudProviders: [], @@ -60,7 +60,7 @@ describe('Service: applicationWriter', function () { let job: IJob = null; spyOn(taskExecutor, 'executeTask').and.callFake((task: any) => job = task.job[0]); - let application: IApplicationAttributes = { + const application: IApplicationAttributes = { name: 'foo', accounts: ['test'], cloudProviders: ['titus', 'cf'], @@ -78,7 +78,7 @@ describe('Service: applicationWriter', function () { it('should execute one task if the application has one account', function () { spyOn(taskExecutor, 'executeTask').and.returnValue($q.when({})); - let application: IApplicationAttributes = { + const application: IApplicationAttributes = { name: 'foo', accounts: ['test'], }; @@ -96,7 +96,7 @@ describe('Service: applicationWriter', function () { return $q.when(task); }); - let application: IApplicationAttributes = { + const application: IApplicationAttributes = { name: 'foo', accounts: ['test', 'prod'], }; diff --git a/app/scripts/modules/core/application/service/applicationDataSource.ts b/app/scripts/modules/core/application/service/applicationDataSource.ts index e872dd45a11..3a72db2cae2 100644 --- a/app/scripts/modules/core/application/service/applicationDataSource.ts +++ b/app/scripts/modules/core/application/service/applicationDataSource.ts @@ -323,10 +323,10 @@ export class ApplicationDataSource { * @param failureMethod (optional) a method to call if the data source refresh fails */ public onNextRefresh($scope: ng.IScope, method: any, failureMethod?: any): void { - let success = this.refreshStream.take(1).subscribe(method); + const success = this.refreshStream.take(1).subscribe(method); $scope.$on('$destroy', () => success.unsubscribe()); if (failureMethod) { - let failure = this.refreshFailureStream.take(1).subscribe(failureMethod); + const failure = this.refreshFailureStream.take(1).subscribe(failureMethod); $scope.$on('$destroy', () => failure.unsubscribe()); } } @@ -340,10 +340,10 @@ export class ApplicationDataSource { * @param failureMethod (optional) a method to call if the data source refresh fails */ public onRefresh($scope: ng.IScope, method: any, failureMethod?: any): void { - let success = this.refreshStream.subscribe(method); + const success = this.refreshStream.subscribe(method); $scope.$on('$destroy', () => success.unsubscribe()); if (failureMethod) { - let failure = this.refreshFailureStream.subscribe(failureMethod); + const failure = this.refreshFailureStream.subscribe(failureMethod); $scope.$on('$destroy', () => failure.unsubscribe()); } } @@ -361,7 +361,7 @@ export class ApplicationDataSource { * @returns {IPromise} */ public ready(): ng.IPromise { - let deferred = this.$q.defer(); + const deferred = this.$q.defer(); if (this.disabled || this.loaded || (this.lazy && !this.active)) { deferred.resolve(); } else if (this.loadFailure) { diff --git a/app/scripts/modules/core/authentication/authentication.initializer.service.ts b/app/scripts/modules/core/authentication/authentication.initializer.service.ts index 8ac0ff2c2cb..9460b906985 100644 --- a/app/scripts/modules/core/authentication/authentication.initializer.service.ts +++ b/app/scripts/modules/core/authentication/authentication.initializer.service.ts @@ -114,7 +114,7 @@ export class AuthenticationInitializer { public logOut(): void { if (!this.userLoggedOut) { - let config = { + const config = { headers: {'Content-Type': 'text/plain'}, transformResponse: (response: string) => response, }; diff --git a/app/scripts/modules/core/authentication/authentication.module.ts b/app/scripts/modules/core/authentication/authentication.module.ts index 1aa17166a30..901d36c40e6 100644 --- a/app/scripts/modules/core/authentication/authentication.module.ts +++ b/app/scripts/modules/core/authentication/authentication.module.ts @@ -5,7 +5,7 @@ import {AUTHENTICATION_SERVICE} from './authentication.service'; import {SCHEDULER_FACTORY, SchedulerFactory} from 'core/scheduler/scheduler.factory'; import {SETTINGS} from 'core/config/settings'; -let angular = require('angular'); +const angular = require('angular'); export const AUTHENTICATION = 'spinnaker.authentication'; angular.module(AUTHENTICATION, [ diff --git a/app/scripts/modules/core/authentication/authentication.provider.spec.ts b/app/scripts/modules/core/authentication/authentication.provider.spec.ts index 5d0e1a2d003..5f1ffbdec05 100644 --- a/app/scripts/modules/core/authentication/authentication.provider.spec.ts +++ b/app/scripts/modules/core/authentication/authentication.provider.spec.ts @@ -6,7 +6,7 @@ import {AuthenticationService} from './authentication.service'; import {AUTHENTICATION} from './authentication.module'; import {SETTINGS} from 'core/config/settings'; -declare let window: any; +declare const window: any; describe('authenticationProvider: application startup', function () { beforeEach(function () { SETTINGS.authEnabled = true; diff --git a/app/scripts/modules/core/chaosMonkey/chaosMonkeyExceptions.component.spec.ts b/app/scripts/modules/core/chaosMonkey/chaosMonkeyExceptions.component.spec.ts index 8f4ff67858c..4b82d66a192 100644 --- a/app/scripts/modules/core/chaosMonkey/chaosMonkeyExceptions.component.spec.ts +++ b/app/scripts/modules/core/chaosMonkey/chaosMonkeyExceptions.component.spec.ts @@ -14,7 +14,7 @@ describe('Controller: ChaosMonkeyExceptions', () => { $q: IQService, applicationBuilder: ApplicationModelBuilder; - let initializeController = (data: any) => { + const initializeController = (data: any) => { $ctrl = $componentController( 'chaosMonkeyExceptions', { $scope: null, accountService: accountService, $q: $q }, @@ -40,8 +40,8 @@ describe('Controller: ChaosMonkeyExceptions', () => { describe('data initialization', () => { it('gets all accounts, then adds wildcard and regions per account to vm', () => { - let accounts = [ {name: 'prod'}, {name: 'test'} ]; - let details: any = { + const accounts = [ {name: 'prod'}, {name: 'test'} ]; + const details: any = { prod: { name: 'prod', regions: [ {name: 'us-east-1'}, {name: 'us-west-1'}] }, test: { name: 'test', regions: [ {name: 'us-west-2'}, {name: 'eu-west-1'}] } }; diff --git a/app/scripts/modules/core/cloudProvider/cloudProvider.registry.ts b/app/scripts/modules/core/cloudProvider/cloudProvider.registry.ts index f246c956d85..75d0c17360c 100644 --- a/app/scripts/modules/core/cloudProvider/cloudProvider.registry.ts +++ b/app/scripts/modules/core/cloudProvider/cloudProvider.registry.ts @@ -43,10 +43,10 @@ export class CloudProviderRegistry { console.warn(`Cannot override "${key}" for provider "${cloudProvider}" (provider not registered)`); return; } - let config = this.providers.get(cloudProvider), + const config = this.providers.get(cloudProvider), parentKeys = key.split('.'), - lastKey = parentKeys.pop(), - current = config; + lastKey = parentKeys.pop(); + let current = config; parentKeys.forEach((parentKey) => { if (!current[parentKey]) { @@ -66,9 +66,9 @@ export class CloudProviderRegistry { if (!key || !this.providers.has(cloudProvider)) { return null; } - let config = this.getProvider(cloudProvider), - keyParts = key.split('.'), - current = config, + const config = this.getProvider(cloudProvider), + keyParts = key.split('.'); + let current = config, notFound = false; keyParts.forEach((keyPart) => { diff --git a/app/scripts/modules/core/cluster/cluster.service.spec.ts b/app/scripts/modules/core/cluster/cluster.service.spec.ts index cacea26075c..ae32b28eee1 100644 --- a/app/scripts/modules/core/cluster/cluster.service.spec.ts +++ b/app/scripts/modules/core/cluster/cluster.service.spec.ts @@ -51,7 +51,7 @@ describe('Service: Cluster', function () { describe('lazy cluster fetching', () => { it('switches to lazy cluster fetching if there are more than 250 clusters', () => { - let clusters = Array(251); + const clusters = Array(251); $http.expectGET(API.baseUrl + '/applications/app/clusters').respond(200, {test: clusters}); $http.expectGET(API.baseUrl + '/applications/app/serverGroups?clusters=').respond(200, []); let serverGroups: ServerGroup[] = null; @@ -62,7 +62,7 @@ describe('Service: Cluster', function () { }); it('does boring regular fetching when there are less than 251 clusters', () => { - let clusters = Array(250); + const clusters = Array(250); $http.expectGET(API.baseUrl + '/applications/app/clusters').respond(200, {test: clusters}); $http.expectGET(API.baseUrl + '/applications/app/serverGroups').respond(200, []); let serverGroups: ServerGroup[] = null; @@ -73,7 +73,7 @@ describe('Service: Cluster', function () { }); it('converts clusters parameter to q and account params when there are fewer than 251 clusters', () => { - let clusters = Array(250); + const clusters = Array(250); ClusterFilterModel.sortFilter.clusters = {'test:myapp': true}; $http.expectGET(API.baseUrl + '/applications/app/clusters').respond(200, {test: clusters}); $http.expectGET(API.baseUrl + '/applications/app/serverGroups').respond(200, []); @@ -350,7 +350,7 @@ describe('Service: Cluster', function () { }); it('should successfully add a matched execution to a server group', function () { - let executions = [ + const executions = [ { stages: [ { @@ -374,7 +374,7 @@ describe('Service: Cluster', function () { it('should NOT add a execution to a server group if the region does not match', function () { - let executions = [ + const executions = [ { stages: [ { @@ -398,7 +398,7 @@ describe('Service: Cluster', function () { it('should NOT add a execution to a server group if the account does not match', function () { - let executions = [ + const executions = [ { stages: [ { @@ -434,7 +434,7 @@ describe('Service: Cluster', function () { }); it('should successfully add a matched execution to a server group', function () { - let executions = [ + const executions = [ { stages: [ { @@ -457,7 +457,7 @@ describe('Service: Cluster', function () { it('should NOT add a execution to a server group if the region does not match', function () { - let executions = [ + const executions = [ { stages: [ { diff --git a/app/scripts/modules/core/cluster/cluster.service.ts b/app/scripts/modules/core/cluster/cluster.service.ts index 86816f6a130..52072563506 100644 --- a/app/scripts/modules/core/cluster/cluster.service.ts +++ b/app/scripts/modules/core/cluster/cluster.service.ts @@ -66,11 +66,11 @@ export class ClusterService { public addServerGroupsToApplication(application: Application, serverGroups: ServerGroup[] = []): ServerGroup[] { if (application.serverGroups.data) { - let data = application.serverGroups.data; + const data = application.serverGroups.data; // remove any that have dropped off, update any that have changed - let toRemove: number[] = []; + const toRemove: number[] = []; data.forEach((serverGroup: ServerGroup, idx: number) => { - let matches = serverGroups.filter((test) => + const matches = serverGroups.filter((test) => test.name === serverGroup.name && test.account === serverGroup.account && test.region === serverGroup.region && diff --git a/app/scripts/modules/core/cluster/filter/clusterFilter.component.ts b/app/scripts/modules/core/cluster/filter/clusterFilter.component.ts index 69455c9dda0..f470c6b88d4 100644 --- a/app/scripts/modules/core/cluster/filter/clusterFilter.component.ts +++ b/app/scripts/modules/core/cluster/filter/clusterFilter.component.ts @@ -6,7 +6,7 @@ import {Application} from '../../application/application.model'; export const CLUSTER_FILTER = 'spinnaker.core.cluster.filter.component'; -let ngmodule = module(CLUSTER_FILTER, [ +const ngmodule = module(CLUSTER_FILTER, [ require('./collapsibleFilterSection.directive'), CLUSTER_FILTER_SERVICE, require('./clusterFilter.model'), diff --git a/app/scripts/modules/core/cluster/filter/clusterFilter.service.spec.ts b/app/scripts/modules/core/cluster/filter/clusterFilter.service.spec.ts index 108e8cf2b80..46a05dc7896 100644 --- a/app/scripts/modules/core/cluster/filter/clusterFilter.service.spec.ts +++ b/app/scripts/modules/core/cluster/filter/clusterFilter.service.spec.ts @@ -58,7 +58,7 @@ describe('Service: clusterFilterService', function () { }; this.verifyTags = function(expectedTags: any[]) { - let actual: any = ClusterFilterModel.tags; + const actual: any = ClusterFilterModel.tags; expect(actual.length).toBe(expectedTags.length); expectedTags.forEach(function(expected: any) { expect(actual.some(function(test: any) { @@ -516,7 +516,7 @@ describe('Service: clusterFilterService', function () { it('should remove all instanceIds if server group is no longer visible, and add back when visible again', function () { ClusterFilterModel.sortFilter.listInstances = true; - let serverGroup = application.getDataSource('serverGroups').data[0], + const serverGroup = application.getDataSource('serverGroups').data[0], multiselectGroup = MultiselectModel.getOrCreateInstanceGroup(serverGroup); serverGroup.instances.push({id: 'i-1234'}); @@ -539,7 +539,7 @@ describe('Service: clusterFilterService', function () { it('should remove instances that are no longer visible', function () { ClusterFilterModel.sortFilter.listInstances = true; - let serverGroup = application.getDataSource('serverGroups').data[0]; + const serverGroup = application.getDataSource('serverGroups').data[0]; MultiselectModel.toggleInstance(serverGroup, 'i-1234'); MultiselectModel.toggleInstance(serverGroup, 'i-2345'); @@ -559,7 +559,7 @@ describe('Service: clusterFilterService', function () { it('should add all instances when selectAll is selected and new instances appear in server group', function () { ClusterFilterModel.sortFilter.listInstances = true; - let serverGroup = application.getDataSource('serverGroups').data[0]; + const serverGroup = application.getDataSource('serverGroups').data[0]; MultiselectModel.getOrCreateInstanceGroup(serverGroup).selectAll = true; MultiselectModel.toggleInstance(serverGroup, 'i-1234'); @@ -576,7 +576,7 @@ describe('Service: clusterFilterService', function () { it('should remove all instance groups when listInstances is false', function () { ClusterFilterModel.sortFilter.listInstances = false; - let serverGroup = application.getDataSource('serverGroups').data[0]; + const serverGroup = application.getDataSource('serverGroups').data[0]; MultiselectModel.toggleInstance(serverGroup, 'i-1234'); diff --git a/app/scripts/modules/core/cluster/filter/clusterFilter.service.ts b/app/scripts/modules/core/cluster/filter/clusterFilter.service.ts index 27a0a042ed7..0f04df772b0 100644 --- a/app/scripts/modules/core/cluster/filter/clusterFilter.service.ts +++ b/app/scripts/modules/core/cluster/filter/clusterFilter.service.ts @@ -49,8 +49,8 @@ export class ClusterFilterService { } } - let groups: IClusterGroup[] = []; - let serverGroups: ServerGroup[] = this.filterServerGroupsForDisplay(application.getDataSource('serverGroups').data); + const groups: IClusterGroup[] = []; + const serverGroups: ServerGroup[] = this.filterServerGroupsForDisplay(application.getDataSource('serverGroups').data); const accountGroupings = groupBy(serverGroups, 'account'); @@ -183,7 +183,7 @@ export class ClusterFilterService { } private filterServerGroupsForDisplay(serverGroups: ServerGroup[]): ServerGroup[] { - let filtered: ServerGroup[] = serverGroups.filter(g => this.textFilter(g)) + const filtered: ServerGroup[] = serverGroups.filter(g => this.textFilter(g)) .filter(g => this.instanceCountFilter(g)) .filter(g => this.filterModelService.checkAccountFilters(this.ClusterFilterModel)(g)) .filter(g => this.filterModelService.checkRegionFilters(this.ClusterFilterModel)(g)) @@ -205,7 +205,7 @@ export class ClusterFilterService { if (this.ClusterFilterModel.sortFilter.listInstances && this.ClusterFilterModel.sortFilter.multiselect) { let instancesSelected = 0; this.MultiselectModel.instanceGroups.forEach((instanceGroup: any) => { - let match = serverGroups.find((serverGroup) => { + const match = serverGroups.find((serverGroup) => { return serverGroup.name === instanceGroup.serverGroup && serverGroup.region === instanceGroup.region && serverGroup.account === instanceGroup.account && @@ -217,7 +217,7 @@ export class ClusterFilterService { // back in subsequent filter operations instanceGroup.instanceIds.length = 0; } else { - let filteredInstances = match.instances.filter(i => this.shouldShowInstance(i)); + const filteredInstances = match.instances.filter(i => this.shouldShowInstance(i)); if (instanceGroup.selectAll) { instanceGroup.instanceIds = filteredInstances.map(i => i.id); } else { @@ -238,8 +238,8 @@ export class ClusterFilterService { private updateMultiselectServerGroups(serverGroups: ServerGroup[]): void { if (this.ClusterFilterModel.sortFilter.multiselect) { if (this.MultiselectModel.serverGroups.length) { - let remainingKeys = serverGroups.map(s => this.MultiselectModel.makeServerGroupKey(s)); - let toRemove: number[] = []; + const remainingKeys = serverGroups.map(s => this.MultiselectModel.makeServerGroupKey(s)); + const toRemove: number[] = []; this.MultiselectModel.serverGroups.forEach((group: any, index: number) => { if (!remainingKeys.includes(group.key)) { toRemove.push(index); @@ -255,7 +255,7 @@ export class ClusterFilterService { private instanceTypeFilters(serverGroup: ServerGroup): boolean { if (this.isFilterable(this.ClusterFilterModel.sortFilter.instanceType)) { - let checkedInstanceTypes: string[] = this.filterModelService.getCheckValues(this.ClusterFilterModel.sortFilter.instanceType); + const checkedInstanceTypes: string[] = this.filterModelService.getCheckValues(this.ClusterFilterModel.sortFilter.instanceType); return checkedInstanceTypes.includes(serverGroup.instanceType); } else { return true; @@ -295,13 +295,13 @@ export class ClusterFilterService { } if (filter.includes('vpc:')) { - let vpcName: string = filter.split('vpc:')[1]; + const vpcName: string = filter.split('vpc:')[1]; return serverGroup.vpcName.toLowerCase() === vpcName.toLowerCase(); } if (filter.includes('tag:')) { let match = false; - let [, tag] = filter.split('tag:'); + const [, tag] = filter.split('tag:'); let tagKey: string = null; let tagValue: string = null; if (tag.includes('=')) { @@ -320,12 +320,12 @@ export class ClusterFilterService { } if (filter.includes('detail:')) { - let detailName: string = filter.split('detail:')[1]; + const detailName: string = filter.split('detail:')[1]; return serverGroup.detail === detailName.toLowerCase(); } if (filter.includes('cluster:')) { - let clusterName: string = filter.split('cluster:')[1]; + const clusterName: string = filter.split('cluster:')[1]; return serverGroup.cluster === clusterName; } else { this.addSearchField(serverGroup); @@ -392,7 +392,7 @@ export class ClusterFilterService { private diffSubgroups(oldGroups: Grouping[], newGroups: Grouping[]): void { const groupsToRemove: number[] = []; oldGroups.forEach((oldGroup: Grouping, idx: number) => { - let newGroup = (newGroups || []).find(group => group.key === oldGroup.key); + const newGroup = (newGroups || []).find(group => group.key === oldGroup.key); if (!newGroup) { groupsToRemove.push(idx); } else { diff --git a/app/scripts/modules/core/delivery/details/executionDetailsSection.service.spec.ts b/app/scripts/modules/core/delivery/details/executionDetailsSection.service.spec.ts index 7434f7ae503..22f153b2855 100644 --- a/app/scripts/modules/core/delivery/details/executionDetailsSection.service.spec.ts +++ b/app/scripts/modules/core/delivery/details/executionDetailsSection.service.spec.ts @@ -75,7 +75,7 @@ describe('executionDetailsSectionService', function() { it('calls initialization after timeout', function() { let completed = false; - let init = () => completed = true; + const init = () => completed = true; spyOn($state, 'includes').and.returnValue(true); spyOn($state, 'go'); @@ -88,7 +88,7 @@ describe('executionDetailsSectionService', function() { it('cancels prior initialization on second synchronization call', function() { let completed = false; - let init = () => completed = true; + const init = () => completed = true; spyOn($state, 'includes').and.returnValue(true); spyOn($state, 'go'); diff --git a/app/scripts/modules/core/delivery/executionGroup/execution/execution.component.ts b/app/scripts/modules/core/delivery/executionGroup/execution/execution.component.ts index cfc5238b40b..1e1d48713a5 100644 --- a/app/scripts/modules/core/delivery/executionGroup/execution/execution.component.ts +++ b/app/scripts/modules/core/delivery/executionGroup/execution/execution.component.ts @@ -56,7 +56,7 @@ class ExecutionController implements IComponentController { showStageDuration: this.executionFilterModel.sortFilter.showStageDuration, }; - let restartedStage = this.execution.stages.find(stage => stage.context.restartDetails !== undefined); + const restartedStage = this.execution.stages.find(stage => stage.context.restartDetails !== undefined); if (restartedStage) { this.restartDetails = restartedStage.context.restartDetails; } else { @@ -109,7 +109,7 @@ class ExecutionController implements IComponentController { this.$state.go('^'); return; } - let index = node.index || 0; + const index = node.index || 0; const params = { executionId: node.executionId, stage: index, @@ -151,7 +151,7 @@ class ExecutionController implements IComponentController { }; public cancelExecution(): void { - let hasDeployStage = this.execution.stages && this.execution.stages.some(stage => stage.type === 'deploy' || stage.type === 'cloneServerGroup'); + const hasDeployStage = this.execution.stages && this.execution.stages.some(stage => stage.type === 'deploy' || stage.type === 'cloneServerGroup'); this.cancelModalService.confirm({ header: `Really stop execution of ${this.execution.name}?`, buttonText: `Stop running ${this.execution.name}`, diff --git a/app/scripts/modules/core/delivery/filter/executionFilter.service.spec.ts b/app/scripts/modules/core/delivery/filter/executionFilter.service.spec.ts index 38155c0edff..8c3847a8b97 100644 --- a/app/scripts/modules/core/delivery/filter/executionFilter.service.spec.ts +++ b/app/scripts/modules/core/delivery/filter/executionFilter.service.spec.ts @@ -34,13 +34,13 @@ describe('Service: executionFilterService', function () { describe('Sorting', () => { it('sorts pipeline groups by index, always putting strategies at the end, followed by ad-hoc pipelines', () => { - let firstGroup = { config: { index: 1} }; - let secondGroup = { config: { index: 2} }; - let strategy = { config: { index: 0, strategy: true } }; - let adHocA = { heading: 'a' }; - let adHocB = { heading: 'b' }; - let groups = [strategy, adHocB, adHocA, secondGroup, firstGroup]; - let sorted = groups.sort((a: any, b: any) => service.executionGroupSorter(a, b)); + const firstGroup = { config: { index: 1} }; + const secondGroup = { config: { index: 2} }; + const strategy = { config: { index: 0, strategy: true } }; + const adHocA = { heading: 'a' }; + const adHocB = { heading: 'b' }; + const groups = [strategy, adHocB, adHocA, secondGroup, firstGroup]; + const sorted = groups.sort((a: any, b: any) => service.executionGroupSorter(a, b)); expect(sorted).toEqual([firstGroup, secondGroup, strategy, adHocA, adHocB]); }); @@ -49,7 +49,7 @@ describe('Service: executionFilterService', function () { describe('Updating execution groups', function () { it('limits executions per pipeline', function () { - let application: Application = modelBuilder.createApplication({key: 'executions', lazy: true}, {key: 'pipelineConfigs', lazy: true}); + const application: Application = modelBuilder.createApplication({key: 'executions', lazy: true}, {key: 'pipelineConfigs', lazy: true}); application.getDataSource('executions').data = [ { pipelineConfigId: '1', name: 'pipeline 1', endTime: 1, stages: [] }, { pipelineConfigId: '1', name: 'pipeline 1', endTime: 2, stages: [] }, diff --git a/app/scripts/modules/core/delivery/filter/executionFilter.service.ts b/app/scripts/modules/core/delivery/filter/executionFilter.service.ts index 320bae41cc3..e50de2876f7 100644 --- a/app/scripts/modules/core/delivery/filter/executionFilter.service.ts +++ b/app/scripts/modules/core/delivery/filter/executionFilter.service.ts @@ -89,7 +89,7 @@ export class ExecutionFilterService { if (execution.searchField) { return; } - let searchText = [execution.name]; + const searchText = [execution.name]; searchText.push(execution.id); searchText.push(this.getValuesAsString(execution.appConfig)); searchText.push(this.getValuesAsString(execution.trigger)); @@ -124,7 +124,7 @@ export class ExecutionFilterService { } private addEmptyPipelines(groups: IGroup[], application: Application): void { - let configs = application.pipelineConfigs.data || []; + const configs = application.pipelineConfigs.data || []; if (!this.isFilterable(this.executionFilterModel.sortFilter.pipeline) && !this.isFilterable(this.executionFilterModel.sortFilter.status) && !this.executionFilterModel.sortFilter.filter) { @@ -141,7 +141,7 @@ export class ExecutionFilterService { } private extractAccounts(config: IPipeline): string[] { - let configAccounts: string[] = []; + const configAccounts: string[] = []; (config.stages || []).forEach(stage => { const stageConfig = this.pipelineConfig.getStageConfig(stage); if (stageConfig && stageConfig.configAccountExtractor) { @@ -169,8 +169,8 @@ export class ExecutionFilterService { if (this.executionFilterModel.sortFilter.groupBy === 'name') { const executionGroups = groupBy(executions, 'name'); forOwn(executionGroups, (groupExecutions, key) => { - let matchId = (config: IPipeline) => config.id === groupExecutions[0].pipelineConfigId; - let config = application.pipelineConfigs.data.find(matchId) || get(application, 'strategyConfigs.data', []).find(matchId); + const matchId = (config: IPipeline) => config.id === groupExecutions[0].pipelineConfigId; + const config = application.pipelineConfigs.data.find(matchId) || get(application, 'strategyConfigs.data', []).find(matchId); groupExecutions.sort((a, b) => this.executionSorter(a, b)); groups.push({ heading: key, diff --git a/app/scripts/modules/core/delivery/service/execution.service.ts b/app/scripts/modules/core/delivery/service/execution.service.ts index d99904bc262..e5b07bf0b38 100644 --- a/app/scripts/modules/core/delivery/service/execution.service.ts +++ b/app/scripts/modules/core/delivery/service/execution.service.ts @@ -27,7 +27,7 @@ export class ExecutionService { } private getFilteredExecutions(applicationName: string, {statuses = Object.keys(pickBy(this.executionFilterModel.sortFilter.status || {}, identity)), limit = this.executionFilterModel.sortFilter.count} = {}): IPromise { - let statusString = statuses.map((status) => status.toUpperCase()).join(',') || null; + const statusString = statuses.map((status) => status.toUpperCase()).join(',') || null; return this.API.one('applications', applicationName).all('pipelines').getList({ limit: limit, statuses: statusString}) .then((data: IExecution[]) => { if (data) { @@ -59,9 +59,9 @@ export class ExecutionService { return; } executions.forEach((execution) => { - let stringVal = JSON.stringify(execution, this.jsonReplacer); + const stringVal = JSON.stringify(execution, this.jsonReplacer); // do not transform if it hasn't changed - let match = (application.executions.data || []).find((test: IExecution) => test.id === execution.id); + const match = (application.executions.data || []).find((test: IExecution) => test.id === execution.id); if (!match || !match.stringVal || match.stringVal !== stringVal) { execution.stringVal = stringVal; this.executionsTransformer.transformExecution(application, execution); @@ -276,7 +276,7 @@ export class ExecutionService { public synchronizeExecution(current: IExecution, updated: IExecution): void { (updated.stageSummaries || []).forEach((updatedSummary, idx) => { - let currentSummary = current.stageSummaries[idx]; + const currentSummary = current.stageSummaries[idx]; if (!currentSummary) { current.stageSummaries.push(updatedSummary); } else { diff --git a/app/scripts/modules/core/entityTag/entityTags.read.service.ts b/app/scripts/modules/core/entityTag/entityTags.read.service.ts index 61a72cfc36f..b49d9195eb7 100644 --- a/app/scripts/modules/core/entityTag/entityTags.read.service.ts +++ b/app/scripts/modules/core/entityTag/entityTags.read.service.ts @@ -30,7 +30,7 @@ export class EntityTagsReader { succeeded, 1, 0) ); - let result: IDeferred = this.$q.defer(); + const result: IDeferred = this.$q.defer(); this.$q.all(sources).then( (entityTagGroups: IEntityTags[][]) => { @@ -77,8 +77,8 @@ export class EntityTagsReader { if (joinedEntityIds.length > maxIdGroupLength) { let index = 0, - currentLength = 0, - currentGroup: string[] = []; + currentLength = 0; + const currentGroup: string[] = []; while (index < entityIds.length) { if (currentLength + entityIds[index].length + 1 > maxIdGroupLength) { idGroups.push(currentGroup.join(',')); diff --git a/app/scripts/modules/core/forms/numberList/numberList.component.spec.ts b/app/scripts/modules/core/forms/numberList/numberList.component.spec.ts index a1a6c74c80f..0a5df797c2a 100644 --- a/app/scripts/modules/core/forms/numberList/numberList.component.spec.ts +++ b/app/scripts/modules/core/forms/numberList/numberList.component.spec.ts @@ -18,7 +18,7 @@ describe('Component: numberList', () => { $scope = $rootScope.$new(); })); - let initialize = (startModel: number[]) => { + const initialize = (startModel: number[]) => { model = startModel; $scope['data'] = { model: startModel, @@ -29,7 +29,7 @@ describe('Component: numberList', () => { $scope['data'].model = stringModel; } - let dom = ``; + const dom = ``; elem = $compile(dom)($scope); $scope.$digest(); }; diff --git a/app/scripts/modules/core/forms/numberList/numberList.component.ts b/app/scripts/modules/core/forms/numberList/numberList.component.ts index 68f3c11fbb8..7314fa25bbe 100644 --- a/app/scripts/modules/core/forms/numberList/numberList.component.ts +++ b/app/scripts/modules/core/forms/numberList/numberList.component.ts @@ -15,7 +15,7 @@ export class NumberListController implements ng.IComponentController { public onChange: () => any; public synchronize(): void { - let model: number[] | string = this.model; // typescript union type woes + const model: number[] | string = this.model; // typescript union type woes if (model instanceof Array) { ( model).length = 0; this.backingModel.forEach(num => { diff --git a/app/scripts/modules/core/help/helpField.component.spec.ts b/app/scripts/modules/core/help/helpField.component.spec.ts index fe9143c7944..9a6b0f69101 100644 --- a/app/scripts/modules/core/help/helpField.component.spec.ts +++ b/app/scripts/modules/core/help/helpField.component.spec.ts @@ -10,14 +10,14 @@ describe('Component: helpField', () => { $scope: ng.IScope, $compile: ng.ICompileService; - let executeTest = (htmlString: string, expected: string, attr = 'uib-popover-html') => { - let helpField: JQuery = $compile(htmlString)($scope); + const executeTest = (htmlString: string, expected: string, attr = 'uib-popover-html') => { + const helpField: JQuery = $compile(htmlString)($scope); $scope.$digest(); expect(helpField.find('a').attr(attr)).toBe(expected); }; - let testContent = (htmlString: string, expected: string) => { - let helpField: JQuery = $compile(htmlString)($scope); + const testContent = (htmlString: string, expected: string) => { + const helpField: JQuery = $compile(htmlString)($scope); $scope.$digest(); expect(element(helpField.find('a')).scope()['$ctrl']['contents']['content']).toBe(expected); }; diff --git a/app/scripts/modules/core/history/recentHistory.service.spec.ts b/app/scripts/modules/core/history/recentHistory.service.spec.ts index a54cb1b7255..23db7506ff0 100644 --- a/app/scripts/modules/core/history/recentHistory.service.spec.ts +++ b/app/scripts/modules/core/history/recentHistory.service.spec.ts @@ -38,8 +38,8 @@ describe('recent history service', () => { describe('addItem is fancy', () => { function initializeCache(count: number) { - let start = Date.now() - 1; - let currentItems = range(0, count).map((idx: number) => { + const start = Date.now() - 1; + const currentItems = range(0, count).map((idx: number) => { return { id: '' + idx, params: {id: idx}, accessTime: start - idx}; }); backingCache.put('whatever', currentItems); @@ -48,27 +48,27 @@ describe('recent history service', () => { it('puts items in cache most recent first', () => { initializeCache(2); service.addItem('whatever', 'state', {id: 'new item'}); - let ids = service.getItems('whatever').map((item) => { return item.params.id; }); + const ids = service.getItems('whatever').map((item) => { return item.params.id; }); expect(ids).toEqual(['new item', 0, 1]); }); it('replaces oldest item if cache is full', () => { initializeCache(15); service.addItem('whatever', 'state', {id: 'new item'}); - let ids = service.getItems('whatever').map((item) => { return item.params.id; }); + const ids = service.getItems('whatever').map((item) => { return item.params.id; }); expect(ids).toEqual(['new item', 0, 1, 2, 3]); }); it('removes previous entry and adds replacement if params match', () => { initializeCache(3); service.addItem('whatever', 'state', {id: 1}); - let ids = service.getItems('whatever').map((item) => { return item.params.id; }); + const ids = service.getItems('whatever').map((item) => { return item.params.id; }); expect(ids).toEqual([1, 0, 2]); }); it('only matches on specified params if supplied', () => { - let start = Date.now() - 1; - let currentItems = range(0, 3).map((idx: number) => { + const start = Date.now() - 1; + const currentItems = range(0, 3).map((idx: number) => { return { params: {id: idx, importantParam: idx, ignoredParam: idx + 1}, accessTime: start - idx}; }); backingCache.put('whatever', currentItems); @@ -83,8 +83,8 @@ describe('recent history service', () => { describe('remove item from history cache by app name', () => { beforeEach(() => { - let start = Date.now() - 1; - let currentItems = ['foo', 'bar', 'baz'].map((appName, index) => { + const start = Date.now() - 1; + const currentItems = ['foo', 'bar', 'baz'].map((appName, index) => { return { params: {application: appName, accessTime: start - index}}; }); backingCache.put('applications', currentItems); @@ -92,13 +92,13 @@ describe('recent history service', () => { ); it('should have 3 items in the "applications" cache', () => { - let items = service.getItems('applications'); + const items = service.getItems('applications'); expect(items.length).toBe(3); }); it('should have 2 items in the "application" cache when we remove "foo" by application name', () => { service.removeByAppName('foo'); - let items = service.getItems('applications'); + const items = service.getItems('applications'); expect(items.length).toBe(2); expect(some(items, {params: {application: 'foo'}})).toBeFalsy(); }); diff --git a/app/scripts/modules/core/instance/instance.write.service.spec.ts b/app/scripts/modules/core/instance/instance.write.service.spec.ts index 0696c5fc5b1..c78364dc6e3 100644 --- a/app/scripts/modules/core/instance/instance.write.service.spec.ts +++ b/app/scripts/modules/core/instance/instance.write.service.spec.ts @@ -46,7 +46,7 @@ describe('Service: instance writer', function () { describe('terminate and decrement server group', () => { it('should set setMaxToNewDesired flag based on current server group capacity', function () { - let serverGroup = { + const serverGroup = { asg: { minSize: 4, maxSize: 4 @@ -93,7 +93,7 @@ describe('Service: instance writer', function () { } function addInstance(serverGroup: ServerGroup, instance: Instance) { - let instanceGroup: IMultiInstanceGroup = getInstanceGroup(serverGroup); + const instanceGroup: IMultiInstanceGroup = getInstanceGroup(serverGroup); instanceGroup.instanceIds.push(instance.id); instanceGroup.instances.push(instance); } @@ -107,7 +107,7 @@ describe('Service: instance writer', function () { }); it('only sends jobs for groups with instances', () => { - let application: Application = applicationModelBuilder.createApplication(); + const application: Application = applicationModelBuilder.createApplication(); addInstance(serverGroupB, {id: 'i-234', health: [], healthState: 'Up', zone: 'a', launchTime: 2}); addInstance(serverGroupB, {id: 'i-345', health: [], healthState: 'Up', zone: 'a', launchTime: 2}); service.terminateInstances( @@ -116,7 +116,7 @@ describe('Service: instance writer', function () { expect(task.job.length).toBe(1); - let job = task.job[0]; + const job = task.job[0]; expect(job.type).toBe('terminateInstances'); expect(job['instanceIds']).toEqual(['i-234', 'i-345']); @@ -127,7 +127,7 @@ describe('Service: instance writer', function () { }); it('includes additional job properties for terminate and shrink', () => { - let application: Application = applicationModelBuilder.createApplication(); + const application: Application = applicationModelBuilder.createApplication(); addInstance(serverGroupA, {id: 'i-234', health: [], healthState: 'Up', zone: 'a', launchTime: 2}); addInstance(serverGroupA, {id: 'i-345', health: [], healthState: 'Up', zone: 'a', launchTime: 2}); service.terminateInstancesAndShrinkServerGroups( @@ -136,7 +136,7 @@ describe('Service: instance writer', function () { expect(task.job.length).toBe(1); - let job: IJob = task.job[0]; + const job: IJob = task.job[0]; expect(job.type).toBe('detachInstances'); expect(job['instanceIds']).toEqual(['i-234', 'i-345']); @@ -149,7 +149,7 @@ describe('Service: instance writer', function () { }); it('includes a useful descriptor on terminate instances', () => { - let application: Application = applicationModelBuilder.createApplication(); + const application: Application = applicationModelBuilder.createApplication(); addInstance(serverGroupA, {id: 'i-123', health: [], healthState: 'Up', zone: 'a', launchTime: 2}); service.terminateInstances([getInstanceGroup(serverGroupA)], application); @@ -161,7 +161,7 @@ describe('Service: instance writer', function () { }); it('includes a useful descriptor on reboot instances', function () { - let application: Application = applicationModelBuilder.createApplication(); + const application: Application = applicationModelBuilder.createApplication(); addInstance(serverGroupA, {id: 'i-123', health: [], healthState: 'Up', zone: 'a', launchTime: 2}); service.rebootInstances([getInstanceGroup(serverGroupA)], application); @@ -173,7 +173,7 @@ describe('Service: instance writer', function () { }); it('includes a useful descriptor on disable in discovery', function () { - let application: Application = applicationModelBuilder.createApplication(); + const application: Application = applicationModelBuilder.createApplication(); addInstance(serverGroupA, {id: 'i-123', health: [], healthState: 'Up', zone: 'a', launchTime: 2}); service.disableInstancesInDiscovery([getInstanceGroup(serverGroupA)], application); @@ -185,7 +185,7 @@ describe('Service: instance writer', function () { }); it('includes a useful descriptor on enable in discovery', function () { - let application: Application = applicationModelBuilder.createApplication(); + const application: Application = applicationModelBuilder.createApplication(); addInstance(serverGroupA, {id: 'i-123', health: [], healthState: 'Up', zone: 'a', launchTime: 2}); service.enableInstancesInDiscovery([getInstanceGroup(serverGroupA)], application); diff --git a/app/scripts/modules/core/instance/instance.write.service.ts b/app/scripts/modules/core/instance/instance.write.service.ts index a242e46e0b3..71fb7411287 100644 --- a/app/scripts/modules/core/instance/instance.write.service.ts +++ b/app/scripts/modules/core/instance/instance.write.service.ts @@ -57,8 +57,8 @@ export class InstanceWriter { private executeMultiInstanceTask(instanceGroups: IMultiInstanceGroup[], application: Application, type: string, baseDescriptor: string, descriptorSuffix?: string, additionalJobProperties: any = {}): ng.IPromise { - let jobs = this.buildMultiInstanceJob(instanceGroups, type, additionalJobProperties); - let descriptor = this.buildMultiInstanceDescriptor(jobs, baseDescriptor, descriptorSuffix); + const jobs = this.buildMultiInstanceJob(instanceGroups, type, additionalJobProperties); + const descriptor = this.buildMultiInstanceDescriptor(jobs, baseDescriptor, descriptorSuffix); return this.taskExecutor.executeTask({ job: jobs, application: application, @@ -88,9 +88,9 @@ export class InstanceWriter { public deregisterInstancesFromLoadBalancer(instanceGroups: IMultiInstanceGroup[], application: Application, loadBalancerNames: string[]): ng.IPromise { - let jobs = this.buildMultiInstanceJob(instanceGroups, 'deregisterInstancesFromLoadBalancer'); + const jobs = this.buildMultiInstanceJob(instanceGroups, 'deregisterInstancesFromLoadBalancer'); jobs.forEach((job) => job.loadBalancerNames = loadBalancerNames); - let descriptor = this.buildMultiInstanceDescriptor(jobs, 'Deregister', `from ${loadBalancerNames.join(' and ')}`); + const descriptor = this.buildMultiInstanceDescriptor(jobs, 'Deregister', `from ${loadBalancerNames.join(' and ')}`); return this.taskExecutor.executeTask({ job: jobs, application: application, @@ -113,9 +113,9 @@ export class InstanceWriter { } public registerInstancesWithLoadBalancer(instanceGroups: IMultiInstanceGroup[], application: Application, loadBalancerNames: string[]) { - let jobs = this.buildMultiInstanceJob(instanceGroups, 'registerInstancesWithLoadBalancer'); + const jobs = this.buildMultiInstanceJob(instanceGroups, 'registerInstancesWithLoadBalancer'); jobs.forEach((job) => job.loadBalancerNames = loadBalancerNames); - let descriptor = this.buildMultiInstanceDescriptor(jobs, 'Register', `with ${loadBalancerNames.join(' and ')}`); + const descriptor = this.buildMultiInstanceDescriptor(jobs, 'Register', `with ${loadBalancerNames.join(' and ')}`); return this.taskExecutor.executeTask({ job: jobs, application: application, @@ -231,7 +231,7 @@ export class InstanceWriter { } private convertGroupToJob(instanceGroup: IMultiInstanceGroup, type: string, additionalJobProperties: any = {}): IMultiInstanceJob { - let job: IMultiInstanceJob = { + const job: IMultiInstanceJob = { type: type, cloudProvider: instanceGroup.cloudProvider, instanceIds: instanceGroup.instanceIds, @@ -249,10 +249,10 @@ export class InstanceWriter { } private transform(instanceGroup: IMultiInstanceGroup, job: IMultiInstanceJob) { - let hasTransformer: boolean = this.serviceDelegate.hasDelegate( + const hasTransformer: boolean = this.serviceDelegate.hasDelegate( instanceGroup.cloudProvider, 'instance.multiInstanceTaskTransformer'); if (hasTransformer) { - let transformer: any = this.serviceDelegate.getDelegate( + const transformer: any = this.serviceDelegate.getDelegate( instanceGroup.cloudProvider, 'instance.multiInstanceTaskTransformer'); transformer.transform(instanceGroup, job); } diff --git a/app/scripts/modules/core/loadBalancer/filter/loadBalancer.filter.component.ts b/app/scripts/modules/core/loadBalancer/filter/loadBalancer.filter.component.ts index 1568aecd29e..4597b2a3b8e 100644 --- a/app/scripts/modules/core/loadBalancer/filter/loadBalancer.filter.component.ts +++ b/app/scripts/modules/core/loadBalancer/filter/loadBalancer.filter.component.ts @@ -4,7 +4,7 @@ import {Application} from '../../application/application.model'; export const LOAD_BALANCER_FILTER = 'spinnaker.core.loadBalancer.filter.controller'; -let ngmodule = module('spinnaker.core.loadBalancer.filter.controller', [ +const ngmodule = module('spinnaker.core.loadBalancer.filter.controller', [ require('./loadBalancer.filter.service'), require('./loadBalancer.filter.model'), require('../../filterModel/dependentFilter/dependentFilter.service'), diff --git a/app/scripts/modules/core/loadBalancer/loadBalancersTag.component.spec.ts b/app/scripts/modules/core/loadBalancer/loadBalancersTag.component.spec.ts index 11f3ae465ed..e048ded4921 100644 --- a/app/scripts/modules/core/loadBalancer/loadBalancersTag.component.spec.ts +++ b/app/scripts/modules/core/loadBalancer/loadBalancersTag.component.spec.ts @@ -15,7 +15,7 @@ describe('Component: loadBalancersTag', () => { $q: ng.IQService, $scope: ng.IScope; - let initialize = () => { + const initialize = () => { application = applicationModelBuilder.createApplication({ key: 'loadBalancers', loader: () => $q.when(null), diff --git a/app/scripts/modules/core/loadBalancer/loadBalancersTag.component.ts b/app/scripts/modules/core/loadBalancer/loadBalancersTag.component.ts index 458a1e16b4b..9b20c3dcba4 100644 --- a/app/scripts/modules/core/loadBalancer/loadBalancersTag.component.ts +++ b/app/scripts/modules/core/loadBalancer/loadBalancersTag.component.ts @@ -15,9 +15,9 @@ export class LoadBalancersTagController implements ng.IComponentController { public $onInit() { this.application.getDataSource('loadBalancers').ready().then(() => { - let serverGroup: ServerGroup = this.serverGroup; + const serverGroup: ServerGroup = this.serverGroup; this.loadBalancers = serverGroup.loadBalancers.map( (lbName: string) => { - let match = this.application.getDataSource('loadBalancers') + const match = this.application.getDataSource('loadBalancers') .data .find((lb: ILoadBalancer): boolean => { return lb.name === lbName @@ -35,14 +35,14 @@ export class LoadBalancersTagController implements ng.IComponentController { return null; } - let loadBalancer: ILoadBalancer = { name: match.name, vpcId: match.vpcId, cloudProvider: match.cloudProvider }; + const loadBalancer: ILoadBalancer = { name: match.name, vpcId: match.vpcId, cloudProvider: match.cloudProvider }; loadBalancer.instanceCounts = {up: 0, down: 0, succeeded: 0, failed: 0, unknown: 0}; this.serverGroup.instances.forEach(instance => { - let lbHealth: Health = instance.health.find(h => h.type === 'LoadBalancer'); + const lbHealth: Health = instance.health.find(h => h.type === 'LoadBalancer'); if (lbHealth) { - let matchedHealth: ILoadBalancer = lbHealth.loadBalancers.find(lb => lb.name === match.name); + const matchedHealth: ILoadBalancer = lbHealth.loadBalancers.find(lb => lb.name === match.name); if (matchedHealth !== undefined && matchedHealth.healthState !== undefined && loadBalancer.instanceCounts[matchedHealth.healthState.toLowerCase()] !== undefined) { loadBalancer.instanceCounts[matchedHealth.healthState.toLowerCase()]++; diff --git a/app/scripts/modules/core/modal/wizard/v2modalWizard.component.ts b/app/scripts/modules/core/modal/wizard/v2modalWizard.component.ts index 118279accad..d13a7942f33 100644 --- a/app/scripts/modules/core/modal/wizard/v2modalWizard.component.ts +++ b/app/scripts/modules/core/modal/wizard/v2modalWizard.component.ts @@ -17,7 +17,7 @@ export class V2ModalWizard implements ng.IComponentController { public $onInit() { this.$scope.$on('waypoints-changed', (_event: any, snapshot: any) => { - let ids = snapshot.lastWindow + const ids = snapshot.lastWindow .map((entry: any) => entry.elem) .filter((key: string) => this.wizard.getPage(key)); ids.reverse().forEach((id: string) => { diff --git a/app/scripts/modules/core/modal/wizard/v2modalWizard.service.ts b/app/scripts/modules/core/modal/wizard/v2modalWizard.service.ts index 4fbc309f568..d9e33b9e78b 100644 --- a/app/scripts/modules/core/modal/wizard/v2modalWizard.service.ts +++ b/app/scripts/modules/core/modal/wizard/v2modalWizard.service.ts @@ -80,7 +80,7 @@ export class V2ModalWizardService { } public renderPages(): void { - let renderedPages: WizardPage[] = this.pageRegistry.filter((page) => page.state.rendered); + const renderedPages: WizardPage[] = this.pageRegistry.filter((page) => page.state.rendered); this.renderedPages = renderedPages; if (renderedPages.length === 1) { this.setCurrentPage(renderedPages[0]); diff --git a/app/scripts/modules/core/navigation/stateHelper.provider.ts b/app/scripts/modules/core/navigation/stateHelper.provider.ts index ee06a58b73b..ad2f0d2e609 100644 --- a/app/scripts/modules/core/navigation/stateHelper.provider.ts +++ b/app/scripts/modules/core/navigation/stateHelper.provider.ts @@ -37,7 +37,7 @@ export class StateHelper implements ng.IServiceProvider { } private fixStateViews(state: INestedState) { - let views = state.views || {}, + const views = state.views || {}, replaced: string[] = []; Object.keys(views).forEach((key) => { const relative: RegExpMatchArray = key.match('../'); diff --git a/app/scripts/modules/core/orchestratedItem/orchestratedItem.transformer.spec.ts b/app/scripts/modules/core/orchestratedItem/orchestratedItem.transformer.spec.ts index 9f5564e714c..b4715a1dc44 100644 --- a/app/scripts/modules/core/orchestratedItem/orchestratedItem.transformer.spec.ts +++ b/app/scripts/modules/core/orchestratedItem/orchestratedItem.transformer.spec.ts @@ -13,7 +13,7 @@ describe('orchestratedItem transformer', () => { describe('failure message extraction', () => { - let getMessage = (obj: any) => { + const getMessage = (obj: any) => { transformer.defineProperties(obj); return obj.failureMessage; }; @@ -32,7 +32,7 @@ describe('orchestratedItem transformer', () => { }); it('returns null when last kato task has no exception', () => { - let stage = { + const stage = { context: { 'kato.tasks': [ { @@ -56,7 +56,7 @@ describe('orchestratedItem transformer', () => { }); it('returns general exception even if a kato task is present', () => { - let stage = { + const stage = { context: { 'kato.tasks': [ { @@ -79,7 +79,7 @@ describe('orchestratedItem transformer', () => { }); it('returns exception when it is in the last kato task', () => { - let stage = { + const stage = { context: { 'kato.tasks': [ { @@ -100,7 +100,7 @@ describe('orchestratedItem transformer', () => { }); it ('extracts exception object from variables', () => { - let task = { + const task = { variables: [ { key: 'exception', @@ -117,7 +117,7 @@ describe('orchestratedItem transformer', () => { }); it('prefers "errors" to "error" and expects them to be an array in exception object', () => { - let task = { + const task = { variables: [ { key: 'exception', @@ -137,7 +137,7 @@ describe('orchestratedItem transformer', () => { }); it('returns null if an exception variable is present but has no details', () => { - let task = { + const task = { variables: [ { key: 'exception', @@ -149,7 +149,7 @@ describe('orchestratedItem transformer', () => { }); it('falls back to extracting last orchestration message if no exception found in variables', () => { - let task = { + const task = { variables: [ { key: 'kato.tasks', @@ -171,7 +171,7 @@ describe('orchestratedItem transformer', () => { }); it('prefers message from kato exception object if present', () => { - let task = { + const task = { variables: [ { key: 'kato.tasks', @@ -195,7 +195,7 @@ describe('orchestratedItem transformer', () => { }); it('returns null if kato exception object does not have a message property', () => { - let task = { + const task = { variables: [ { key: 'kato.tasks', @@ -214,7 +214,7 @@ describe('orchestratedItem transformer', () => { }); it('returns null if no kato exception and no history', () => { - let task = { + const task = { variables: [ { key: 'kato.tasks', @@ -230,7 +230,7 @@ describe('orchestratedItem transformer', () => { }); it('gets orchestration message from failed kato task', () => { - let task = { + const task = { variables: [ { key: 'kato.tasks', diff --git a/app/scripts/modules/core/pipeline/config/copyStage/copyStage.modal.controller.ts b/app/scripts/modules/core/pipeline/config/copyStage/copyStage.modal.controller.ts index ddd191d81bb..61469bdadae 100644 --- a/app/scripts/modules/core/pipeline/config/copyStage/copyStage.modal.controller.ts +++ b/app/scripts/modules/core/pipeline/config/copyStage/copyStage.modal.controller.ts @@ -75,14 +75,14 @@ class CopyStageModalCtrl implements ng.IComponentController { } private getStagesForApplication (applicationName: string): ng.IPromise { - let configType = this.forStrategyConfig ? 'strategyConfigs' : 'pipelineConfigs'; + const configType = this.forStrategyConfig ? 'strategyConfigs' : 'pipelineConfigs'; return this.API.one('applications') .one(applicationName) .all(configType) .getList() .then((configs: (IPipeline | IStrategy)[]) => { - let nestedStageWrappers = configs + const nestedStageWrappers = configs .map((config) => { return (config.stages || []) .filter((stage: IStage) => !this.uncopiableStageTypes.has(stage.type)) diff --git a/app/scripts/modules/core/pipeline/config/graph/pipeline.graph.component.ts b/app/scripts/modules/core/pipeline/config/graph/pipeline.graph.component.ts index 3e3ae5a9e1b..a7b04e0786e 100644 --- a/app/scripts/modules/core/pipeline/config/graph/pipeline.graph.component.ts +++ b/app/scripts/modules/core/pipeline/config/graph/pipeline.graph.component.ts @@ -42,7 +42,7 @@ export class PipelineGraphController implements ng.IComponentController { } private setLinkClass(link: IPipelineLink): void { - let child = link.child, + const child = link.child, parent = link.parent; const linkClasses: string[] = []; if (link.isHighlighted) { @@ -224,7 +224,7 @@ export class PipelineGraphController implements ng.IComponentController { // get the saved horizontal scroll position for executions if (this.execution) { - let offsetForId = this.pipelineGraphService.xScrollOffset[this.execution.id] || 0; + const offsetForId = this.pipelineGraphService.xScrollOffset[this.execution.id] || 0; this.$element.scrollLeft(offsetForId); } } diff --git a/app/scripts/modules/core/pipeline/config/services/piplineConfig.service.spec.ts b/app/scripts/modules/core/pipeline/config/services/piplineConfig.service.spec.ts index ded041d6eb9..3e16c788505 100644 --- a/app/scripts/modules/core/pipeline/config/services/piplineConfig.service.spec.ts +++ b/app/scripts/modules/core/pipeline/config/services/piplineConfig.service.spec.ts @@ -14,8 +14,8 @@ describe('pipelineConfigService', () => { $scope: ng.IScope, API: Api; - let buildStage = (base: any): IStage => { - let stageDefaults: IStage = { + const buildStage = (base: any): IStage => { + const stageDefaults: IStage = { name: 'a', type: 'wait', refId: null, @@ -27,8 +27,8 @@ describe('pipelineConfigService', () => { return stageDefaults; }; - let buildPipeline = (base: any): IPipeline => { - let defaults: IPipeline = { + const buildPipeline = (base: any): IPipeline => { + const defaults: IPipeline = { id: null, index: 1, name: 'some pipeline', @@ -69,7 +69,7 @@ describe('pipelineConfigService', () => { describe('savePipeline', () => { it('clears isNew flags, stage name if not present', () => { - let pipeline: IPipeline = buildPipeline({ + const pipeline: IPipeline = buildPipeline({ stages: [ { name: 'explicit name', type: 'bake', isNew: true}, { name: null, type: 'bake', isNew: true}, @@ -95,7 +95,7 @@ describe('pipelineConfigService', () => { describe('getPipelines', () => { it('should return pipelines sorted by index', () => { let result: IPipeline[] = null; - let fromServer: IPipeline[] = [ + const fromServer: IPipeline[] = [ buildPipeline({ id: 'a', name: 'second', application: 'app', index: 1, stages: [], triggers: []}), buildPipeline({ id: 'b', name: 'last', application: 'app', index: 3, stages: [], triggers: []}), buildPipeline({ id: 'c', name: 'first', application: 'app', index: 0, stages: []}), @@ -113,7 +113,7 @@ describe('pipelineConfigService', () => { }); it('should fix sort order of pipelines on initialization: 0..n, index collisions sorted alphabetically', () => { - let fromServer: IPipeline[] = [ + const fromServer: IPipeline[] = [ buildPipeline({ name: 'second', index: 1, stages: []}), buildPipeline({ name: 'last', index: 5, stages: []}), buildPipeline({ name: 'first', index: -3, stages: []}), @@ -144,15 +144,15 @@ describe('pipelineConfigService', () => { let a: IStage, b: IStage, c: IStage, d: IStage; let pipeline: IPipeline; - let connect = (child: IStage, parent: IStage) => { + const connect = (child: IStage, parent: IStage) => { child.requisiteStageRefIds.push(parent.refId); }; - let expectCandidates = (test: IStage, expected: IStage[]) => { + const expectCandidates = (test: IStage, expected: IStage[]) => { expect(service.getDependencyCandidateStages(pipeline, test)).toEqual(expected); }; - let expectDependencies = (test: IStage, expected: IStage[]) => { + const expectDependencies = (test: IStage, expected: IStage[]) => { expect(service.getAllUpstreamDependencies(pipeline, test)).toEqual(expected); }; diff --git a/app/scripts/modules/core/pipeline/config/stages/executionWindows/atlasGraph.component.ts b/app/scripts/modules/core/pipeline/config/stages/executionWindows/atlasGraph.component.ts index 2ee9da6bb56..ae0549b8023 100644 --- a/app/scripts/modules/core/pipeline/config/stages/executionWindows/atlasGraph.component.ts +++ b/app/scripts/modules/core/pipeline/config/stages/executionWindows/atlasGraph.component.ts @@ -104,11 +104,11 @@ class ExecutionWindowAtlasGraphController implements ng.IComponentController { this.chartOptions.series.length = 1; this.chartData.SPS.length = 0; this.chartData.windows.length = 0; - let metadata = data.find((e: any) => e.type === 'graph-metadata'); + const metadata = data.find((e: any) => e.type === 'graph-metadata'); if (!metadata) { return; } - let timeseries = data.filter((e: any) => e.type === 'timeseries' && e.data.values.some((v: any) => v !== 'NaN')); + const timeseries = data.filter((e: any) => e.type === 'timeseries' && e.data.values.some((v: any) => v !== 'NaN')); timeseries.forEach((series: any) => { const datapoints = series.data.values .filter((v: any) => !isNaN(v)) @@ -209,7 +209,7 @@ class ExecutionWindowAtlasGraphController implements ng.IComponentController { } private getDefaultRegion(): string { - let deployedRegions = new Set(); + const deployedRegions = new Set(); if (this.stage.clusters) { this.stage.clusters.forEach((c: any) => Object.keys(c.availabilityZones).forEach((r: string) => deployedRegions.add(r))); if (deployedRegions.size === 1 && this.regions.some(r => deployedRegions.has(r.label))) { @@ -228,8 +228,8 @@ class ExecutionWindowAtlasGraphController implements ng.IComponentController { const windows: IWindowData[] = []; const today = new Date(); - let restrictedDays = this.stage.restrictedExecutionWindow.days as number[]; - let days = restrictedDays ? restrictedDays.map(d => (today.getDay() + d) % 7) : [0, 1, 2, 3, 4, 5, 6]; + const restrictedDays = this.stage.restrictedExecutionWindow.days as number[]; + const days = restrictedDays ? restrictedDays.map(d => (today.getDay() + d) % 7) : [0, 1, 2, 3, 4, 5, 6]; if (days.includes(0)) { days.push(7); // in case there are windows later today } @@ -273,7 +273,7 @@ class ExecutionWindowAtlasGraphController implements ng.IComponentController { } private getAtlasUrl(): string { - let base: string = SETTINGS.executionWindow.atlas.regions.find((r: IAtlasRegion) => r.label === this.stage.restrictedExecutionWindow.currentRegion).baseUrl; + const base: string = SETTINGS.executionWindow.atlas.regions.find((r: IAtlasRegion) => r.label === this.stage.restrictedExecutionWindow.currentRegion).baseUrl; return base + SETTINGS.executionWindow.atlas.url; } diff --git a/app/scripts/modules/core/pipeline/config/stages/travis/travisStage.controller.spec.ts b/app/scripts/modules/core/pipeline/config/stages/travis/travisStage.controller.spec.ts index f4d5e70efb5..05d59ebb8e2 100644 --- a/app/scripts/modules/core/pipeline/config/stages/travis/travisStage.controller.spec.ts +++ b/app/scripts/modules/core/pipeline/config/stages/travis/travisStage.controller.spec.ts @@ -74,7 +74,7 @@ describe('Travis Stage Controller', () => { it('clears job if no longer present when retrieving from igor', () => { spyOn(igorService, 'listJobsForMaster').and.returnValue($q.when(['a', 'b'])); spyOn(igorService, 'getJobConfig').and.returnValue($q.when(null)); - let stage = { + const stage = { master: 'not-parameterized', job: 'c', }; @@ -123,7 +123,7 @@ describe('Travis Stage Controller', () => { }); it('gets job config and adds parameters to scope, setting defaults if present and not overridden', () => { - let params: ParameterDefinitionList[] = [ + const params: ParameterDefinitionList[] = [ {name: 'overridden', defaultValue: 'z'}, {name: 'notSet', defaultValue: 'a'}, {name: 'noDefault', defaultValue: null} diff --git a/app/scripts/modules/core/pipeline/config/stages/travis/travisStage.ts b/app/scripts/modules/core/pipeline/config/stages/travis/travisStage.ts index 6560a034b40..deaed785e64 100644 --- a/app/scripts/modules/core/pipeline/config/stages/travis/travisStage.ts +++ b/app/scripts/modules/core/pipeline/config/stages/travis/travisStage.ts @@ -159,7 +159,7 @@ module(TRAVIS_STAGE, [ if (!stage.masterStage.context || !stage.masterStage.context.buildInfo) { return 0; } - let lines = stage.masterStage.context.buildInfo.number ? 1 : 0; + const lines = stage.masterStage.context.buildInfo.number ? 1 : 0; return lines + (stage.masterStage.context.buildInfo.testResults || []).length; }, defaultTimeoutMs: moment.duration(2, 'hours').asMilliseconds(), diff --git a/app/scripts/modules/core/pipeline/config/triggers/travis/travisTriggerOptions.component.spec.ts b/app/scripts/modules/core/pipeline/config/triggers/travis/travisTriggerOptions.component.spec.ts index 4ed695e53e9..01cd6c51c10 100644 --- a/app/scripts/modules/core/pipeline/config/triggers/travis/travisTriggerOptions.component.spec.ts +++ b/app/scripts/modules/core/pipeline/config/triggers/travis/travisTriggerOptions.component.spec.ts @@ -49,7 +49,7 @@ describe('Travis Trigger: TravisTriggerOptionsCtrl', () => { }; it('loads jobs on initialization, setting state flags', () => { - let builds: IBuild[] = []; + const builds: IBuild[] = []; spyOn(igorService, 'listBuildsForJob').and.returnValue($q.when(builds)); const controller = initialize(); @@ -62,7 +62,7 @@ describe('Travis Trigger: TravisTriggerOptionsCtrl', () => { }); it('sets build to first one available when returned on initialization', function () { - let build = {number: '1', result: 'SUCCESS'}; + const build = {number: '1', result: 'SUCCESS'}; spyOn(igorService, 'listBuildsForJob').and.returnValue($q.when([build])); const controller = initialize(); @@ -89,7 +89,7 @@ describe('Travis Trigger: TravisTriggerOptionsCtrl', () => { }); it('re-initializes when trigger changes', function () { - let firstBuild: IBuild = {number: '1', result: 'SUCCESS'}, + const firstBuild: IBuild = {number: '1', result: 'SUCCESS'}, secondBuild: IBuild = {number: '3', result: 'SUCCESS'}, secondTrigger: IBuildTrigger = {type: 'travis', master: 'b', job: 'c'}; diff --git a/app/scripts/modules/core/pipeline/config/validation/pipelineConfig.validator.spec.ts b/app/scripts/modules/core/pipeline/config/validation/pipelineConfig.validator.spec.ts index c5b4ddc442a..ed12d89e9bd 100644 --- a/app/scripts/modules/core/pipeline/config/validation/pipelineConfig.validator.spec.ts +++ b/app/scripts/modules/core/pipeline/config/validation/pipelineConfig.validator.spec.ts @@ -936,7 +936,7 @@ describe('pipelineConfigValidator', () => { }); it('calls service account access validator', () => { - let trigger = { type: 'targetCheck', name: 'git trigger', runAsUser: 'my-account' } as ITriggerWithServiceAccount; + const trigger = { type: 'targetCheck', name: 'git trigger', runAsUser: 'my-account' } as ITriggerWithServiceAccount; pipeline = buildPipeline([trigger]); validate(); diff --git a/app/scripts/modules/core/pipeline/config/validation/pipelineConfig.validator.ts b/app/scripts/modules/core/pipeline/config/validation/pipelineConfig.validator.ts index abfc8ae11fa..2cb83b3b4b9 100644 --- a/app/scripts/modules/core/pipeline/config/validation/pipelineConfig.validator.ts +++ b/app/scripts/modules/core/pipeline/config/validation/pipelineConfig.validator.ts @@ -78,7 +78,7 @@ export class PipelineConfigValidator implements ng.IServiceProvider { let preventSave = false; triggers.forEach((trigger, index) => { - let config: ITriggerTypeConfig = this.pipelineConfig.getTriggerConfig(trigger.type); + const config: ITriggerTypeConfig = this.pipelineConfig.getTriggerConfig(trigger.type); if (config && config.validators) { config.validators.forEach((validator) => { const typedValidator = this.getValidator(validator); @@ -102,7 +102,7 @@ export class PipelineConfigValidator implements ng.IServiceProvider { } }); stages.forEach((stage) => { - let config: IStageTypeConfig = this.pipelineConfig.getStageConfig(stage); + const config: IStageTypeConfig = this.pipelineConfig.getStageConfig(stage); if (config && config.validators) { config.validators.forEach((validator) => { if (validator.skipValidation && validator.skipValidation(pipeline, stage)) { diff --git a/app/scripts/modules/core/pipeline/config/validation/stageOrTriggerBeforeType.validator.ts b/app/scripts/modules/core/pipeline/config/validation/stageOrTriggerBeforeType.validator.ts index 867310cfd01..09a3e4c1da6 100644 --- a/app/scripts/modules/core/pipeline/config/validation/stageOrTriggerBeforeType.validator.ts +++ b/app/scripts/modules/core/pipeline/config/validation/stageOrTriggerBeforeType.validator.ts @@ -49,7 +49,7 @@ export class StageOrTriggerBeforeTypeValidator implements IStageOrTriggerValidat } private addTriggers(pipelines: IPipeline[], pipelineIdToFind: string, stagesToTest: (IStage | ITrigger)[]): void { - let match = pipelines.find(p => p.id === pipelineIdToFind); + const match = pipelines.find(p => p.id === pipelineIdToFind); if (match) { stagesToTest.push(...match.triggers); } @@ -64,10 +64,10 @@ export class StageOrTriggerBeforeTypeValidator implements IStageOrTriggerValidat } private addPipelineTriggers(pipeline: IPipeline, stagesToTest: (IStage | ITrigger)[]) { - let pipelineTriggers: IPipelineTrigger[] = pipeline.triggers.filter(t => t.type === 'pipeline') as IPipelineTrigger[]; - let parentTriggersToCheck: ng.IPromise[] = []; + const pipelineTriggers: IPipelineTrigger[] = pipeline.triggers.filter(t => t.type === 'pipeline') as IPipelineTrigger[]; + const parentTriggersToCheck: ng.IPromise[] = []; pipelineTriggers.forEach(trigger => { - let deferred: ng.IDeferred = this.$q.defer(); + const deferred: ng.IDeferred = this.$q.defer(); if (this.pipelineCache.has(trigger.application)) { this.addTriggers(this.pipelineCache.get(trigger.application), trigger.pipeline, stagesToTest); } else { diff --git a/app/scripts/modules/core/presentation/anyFieldFilter/anyField.filter.ts b/app/scripts/modules/core/presentation/anyFieldFilter/anyField.filter.ts index eb0163f61a9..f9d283759a5 100644 --- a/app/scripts/modules/core/presentation/anyFieldFilter/anyField.filter.ts +++ b/app/scripts/modules/core/presentation/anyFieldFilter/anyField.filter.ts @@ -18,10 +18,10 @@ export function anyFieldFilter() { items.forEach(function (item) { let itemMatches = false; - let keys: any[] = Object.keys(props); + const keys: any[] = Object.keys(props); for (let i = 0; i < keys.length; i++) { - let prop: any = keys[i]; - let text: string = (props)[prop].toLowerCase(); + const prop: any = keys[i]; + const text: string = (props)[prop].toLowerCase(); if (item[prop] && item[prop].toString().toLowerCase().includes(text)) { itemMatches = true; break; diff --git a/app/scripts/modules/core/presentation/navigation/pageNavigator.component.spec.ts b/app/scripts/modules/core/presentation/navigation/pageNavigator.component.spec.ts index 02f4df94de6..473f2a93193 100644 --- a/app/scripts/modules/core/presentation/navigation/pageNavigator.component.spec.ts +++ b/app/scripts/modules/core/presentation/navigation/pageNavigator.component.spec.ts @@ -28,7 +28,7 @@ describe('Component: Page Navigator', () => { beforeEach(() => jasmine.addMatchers(matchers)); - let initialize = (pages: INavigationPage[]) => { + const initialize = (pages: INavigationPage[]) => { $scope['pages'] = pages; let dom = ` @@ -86,7 +86,7 @@ describe('Component: Page Navigator', () => { ]; initialize(pages); $scope.$digest(); - let navigator: JQuery = elem.find('.page-navigation'); + const navigator: JQuery = elem.find('.page-navigation'); navigator.find('a:eq(1)').click(); expect(elem.find('[data-page-id=2]').hasClass('highlighted')).toBe(true); diff --git a/app/scripts/modules/core/scheduler/scheduler.factory.spec.ts b/app/scripts/modules/core/scheduler/scheduler.factory.spec.ts index d6a3cc63202..83fdaab555d 100644 --- a/app/scripts/modules/core/scheduler/scheduler.factory.spec.ts +++ b/app/scripts/modules/core/scheduler/scheduler.factory.spec.ts @@ -29,7 +29,7 @@ describe('scheduler', function() { const numSubscribers = 20; spyOn(this.test, 'call'); - for(let i = 0; i < numSubscribers; i++) { + for (let i = 0; i < numSubscribers; i++) { this.scheduler.subscribe(this.test.call); } const pre = this.test.call.calls.count(); diff --git a/app/scripts/modules/core/search/search.service.ts b/app/scripts/modules/core/search/search.service.ts index e75271a4be3..b1032c68e85 100644 --- a/app/scripts/modules/core/search/search.service.ts +++ b/app/scripts/modules/core/search/search.service.ts @@ -33,7 +33,7 @@ export class SearchService { pageSize: SearchService.defaultPageSize, }; - let requestBuilder = this.API.one('search').withParams(Object.assign(params, defaultParams)); + const requestBuilder = this.API.one('search').withParams(Object.assign(params, defaultParams)); if (cache) { requestBuilder.useCache(cache); } diff --git a/app/scripts/modules/core/securityGroup/filter/securityGroup.filter.component.ts b/app/scripts/modules/core/securityGroup/filter/securityGroup.filter.component.ts index 71bcab92a76..ee52d25efa3 100644 --- a/app/scripts/modules/core/securityGroup/filter/securityGroup.filter.component.ts +++ b/app/scripts/modules/core/securityGroup/filter/securityGroup.filter.component.ts @@ -4,7 +4,7 @@ import {Application} from '../../application/application.model'; export const SECURITY_GROUP_FILTER = 'securityGroup.filter.controller'; -let ngmodule = module(SECURITY_GROUP_FILTER, [ +const ngmodule = module(SECURITY_GROUP_FILTER, [ require('./securityGroup.filter.service'), require('./securityGroup.filter.model'), require('../../filterModel/dependentFilter/dependentFilter.service'), diff --git a/app/scripts/modules/core/securityGroup/securityGroupWriter.service.ts b/app/scripts/modules/core/securityGroup/securityGroupWriter.service.ts index a33752d1f0b..6829857a19b 100644 --- a/app/scripts/modules/core/securityGroup/securityGroupWriter.service.ts +++ b/app/scripts/modules/core/securityGroup/securityGroupWriter.service.ts @@ -46,7 +46,7 @@ export class SecurityGroupWriter { params.type = 'upsertSecurityGroup'; params.credentials = securityGroup.credentials || securityGroup.accountName; - let job: ISecurityGroupJob = Object.assign(securityGroup, params); + const job: ISecurityGroupJob = Object.assign(securityGroup, params); const operation: ng.IPromise = this.executor.executeTask({ job: [job], diff --git a/app/scripts/modules/core/serverGroup/details/scalingActivities/scalingActivities.controller.spec.ts b/app/scripts/modules/core/serverGroup/details/scalingActivities/scalingActivities.controller.spec.ts index 43f971acc38..3b62b7efb15 100644 --- a/app/scripts/modules/core/serverGroup/details/scalingActivities/scalingActivities.controller.spec.ts +++ b/app/scripts/modules/core/serverGroup/details/scalingActivities/scalingActivities.controller.spec.ts @@ -71,7 +71,7 @@ describe('Controller: ScalingActivitiesCtrl', () => { ctrl.$onInit(); $scope.$digest(); - let result: IScalingEventSummary[] = ctrl.activities; + const result: IScalingEventSummary[] = ctrl.activities; expect(result.length).toEqual(2); expect(result[0].cause).toBe('common cause'); expect(result[1].cause).toBe('some other cause'); @@ -116,7 +116,7 @@ describe('Controller: ScalingActivitiesCtrl', () => { ctrl.$onInit(); $scope.$digest(); - let result: IScalingEventSummary[] = ctrl.activities; + const result: IScalingEventSummary[] = ctrl.activities; expect(result.length).toEqual(1); expect(result[0].cause).toBe('some cause'); expect(result[0].events[0].availabilityZone).toBe('unknown'); diff --git a/app/scripts/modules/core/serverGroup/serverGroup.component.ts b/app/scripts/modules/core/serverGroup/serverGroup.component.ts index f8bb099308a..b5cb923768a 100644 --- a/app/scripts/modules/core/serverGroup/serverGroup.component.ts +++ b/app/scripts/modules/core/serverGroup/serverGroup.component.ts @@ -80,7 +80,7 @@ export class ServerGroupController implements IComponentController { const serverGroup = this.serverGroup; - let viewModel: ViewModel = { + const viewModel: ViewModel = { waypoint: [serverGroup.account, serverGroup.region, serverGroup.name].join(':'), serverGroup: serverGroup, serverGroupSequence: (this.$filter('serverGroupSequence'))(serverGroup.name), @@ -110,7 +110,7 @@ export class ServerGroupController implements IComponentController { viewModel.images = serverGroup.buildInfo.images.join(', '); } - let modelStringVal = JSON.stringify(viewModel, this.serverGroupTransformer.jsonReplacer); + const modelStringVal = JSON.stringify(viewModel, this.serverGroupTransformer.jsonReplacer); if (this.lastStringVal !== modelStringVal) { this.viewModel = viewModel; diff --git a/app/scripts/modules/core/task/displayableTasks.filter.ts b/app/scripts/modules/core/task/displayableTasks.filter.ts index 4b4d85dd544..c6990b372a5 100644 --- a/app/scripts/modules/core/task/displayableTasks.filter.ts +++ b/app/scripts/modules/core/task/displayableTasks.filter.ts @@ -3,7 +3,7 @@ import { module } from 'angular'; import { TaskStep } from '../domain/taskStep'; export function displayableTaskFilter() { - let blacklist = [ + const blacklist = [ 'stageStart', 'stageEnd', 'determineTargetServerGroup' ]; return function (input: TaskStep[]): TaskStep[] { diff --git a/app/scripts/modules/core/task/monitor/taskMonitor.builder.spec.ts b/app/scripts/modules/core/task/monitor/taskMonitor.builder.spec.ts index ecc42bb6524..856f82a08e4 100644 --- a/app/scripts/modules/core/task/monitor/taskMonitor.builder.spec.ts +++ b/app/scripts/modules/core/task/monitor/taskMonitor.builder.spec.ts @@ -49,11 +49,11 @@ describe('Service: taskMonitorBuilder', () => { describe('task submit', () => { it('waits for task to complete, then calls onComplete', () => { let completeCalled = false; - let task: any = { id: 'a', status: 'RUNNING' }; + const task: any = { id: 'a', status: 'RUNNING' }; orchestratedItemTransformer.defineProperties(task); - let operation = () => $q.when(task); - let monitor = taskMonitorBuilder.buildTaskMonitor({ + const operation = () => $q.when(task); + const monitor = taskMonitorBuilder.buildTaskMonitor({ application: applicationModelBuilder.createApplication({key: 'runningTasks', lazy: true}), title: 'some task', modalInstance: { result: $q.defer().promise } as IModalServiceInstance, @@ -84,9 +84,9 @@ describe('Service: taskMonitorBuilder', () => { it('sets error when task fails immediately', () => { let completeCalled = false; - let task = { failureMessage: 'it failed' }; - let operation = () => $q.reject(task); - let monitor = taskMonitorBuilder.buildTaskMonitor({ + const task = { failureMessage: 'it failed' }; + const operation = () => $q.reject(task); + const monitor = taskMonitorBuilder.buildTaskMonitor({ application: applicationModelBuilder.createApplication({key: 'runningTasks', lazy: true}), title: 'a task', modalInstance: { result: $q.defer().promise } as IModalServiceInstance, @@ -106,11 +106,11 @@ describe('Service: taskMonitorBuilder', () => { it('sets error when task fails while polling', () => { let completeCalled = false; - let task = { id: 'a', status: 'RUNNING' }; + const task = { id: 'a', status: 'RUNNING' }; orchestratedItemTransformer.defineProperties(task); - let operation = () => $q.when(task); - let monitor = taskMonitorBuilder.buildTaskMonitor({ + const operation = () => $q.when(task); + const monitor = taskMonitorBuilder.buildTaskMonitor({ application: applicationModelBuilder.createApplication({key: 'runningTasks', lazy: true}), title: 'a task', modalInstance: { result: $q.defer().promise } as IModalServiceInstance, diff --git a/app/scripts/modules/core/utils/json/json.utility.service.ts b/app/scripts/modules/core/utils/json/json.utility.service.ts index 65f9868b868..d359feeb1d1 100644 --- a/app/scripts/modules/core/utils/json/json.utility.service.ts +++ b/app/scripts/modules/core/utils/json/json.utility.service.ts @@ -32,9 +32,9 @@ export interface IJsonDiff { export class JsonUtilityService { private generateDiff(left: string, right: string): [[number, string]] { - let dmp: any = new DiffMatchPatch(); - let a = dmp.diff_linesToChars_(left, right); - let diffs = dmp.diff_main(a.chars1, a.chars2, false); + const dmp: any = new DiffMatchPatch(); + const a = dmp.diff_linesToChars_(left, right); + const diffs = dmp.diff_main(a.chars1, a.chars2, false); dmp.diff_charsToLines_(diffs, a.lineArray); return diffs; } @@ -69,12 +69,12 @@ export class JsonUtilityService { left = this.makeSortedString(left); right = this.makeSortedString(right); } - let diffs = this.generateDiff(left, right); - let diffLines: IDiffDetails[] = []; + const diffs = this.generateDiff(left, right); + const diffLines: IDiffDetails[] = []; let additions = 0, removals = 0, unchanged = 0, total = 0; - let changeBlocks: IChangeBlock[] = []; + const changeBlocks: IChangeBlock[] = []; diffs.forEach(diff => { - let lines = diff[1].split('\n'); + const lines = diff[1].split('\n'); if (lines[lines.length - 1] === '') { lines.pop(); // always a trailing new line... } diff --git a/app/scripts/modules/core/whatsNew/whatsNew.read.service.spec.ts b/app/scripts/modules/core/whatsNew/whatsNew.read.service.spec.ts index 74d0b4f9433..21f126edc42 100644 --- a/app/scripts/modules/core/whatsNew/whatsNew.read.service.spec.ts +++ b/app/scripts/modules/core/whatsNew/whatsNew.read.service.spec.ts @@ -25,8 +25,8 @@ describe('Service: whatsNew reader ', () => { }); it ('returns file contents with lastUpdated', () => { - let result: IWhatsNewContents = null, - response: IGistApiResponse = { + let result: IWhatsNewContents = null; + const response: IGistApiResponse = { 'updated_at': '1999', files: {}, }; diff --git a/app/scripts/modules/core/whatsNew/whatsNew.read.service.ts b/app/scripts/modules/core/whatsNew/whatsNew.read.service.ts index 0e4fa35851b..05e7c98480a 100644 --- a/app/scripts/modules/core/whatsNew/whatsNew.read.service.ts +++ b/app/scripts/modules/core/whatsNew/whatsNew.read.service.ts @@ -33,9 +33,9 @@ export class WhatsNewReader { constructor(private $http: IHttpService, private $log: ILogService) {} public getWhatsNewContents(): IPromise { - let gistId = NetflixSettings.whatsNew.gistId, - accessToken = NetflixSettings.whatsNew.accessToken || null, - url = `https://api.github.com/gists/${gistId}`; + const gistId = NetflixSettings.whatsNew.gistId, + accessToken = NetflixSettings.whatsNew.accessToken || null; + let url = `https://api.github.com/gists/${gistId}`; if (accessToken) { url += '?access_token=' + accessToken; } diff --git a/app/scripts/modules/docker/image/dockerImageAndTagSelector.component.spec.ts b/app/scripts/modules/docker/image/dockerImageAndTagSelector.component.spec.ts index 716d2ec06cb..3ed73818bcd 100644 --- a/app/scripts/modules/docker/image/dockerImageAndTagSelector.component.spec.ts +++ b/app/scripts/modules/docker/image/dockerImageAndTagSelector.component.spec.ts @@ -17,10 +17,12 @@ describe('dockerImageAndTagSelector controller', () => { let organization: string, registry: string, repository: string, - tag: string, - account: string, showRegistry: boolean; + const tag: string = undefined, + account: string = undefined; + + beforeEach(mock.module(DOCKER_IMAGE_AND_TAG_SELECTOR_COMPONENT)); beforeEach(mock.inject((_accountService_: AccountService, @@ -35,7 +37,7 @@ describe('dockerImageAndTagSelector controller', () => { $scope = $rootScope.$new(); })); - let initialize = (accounts: IAccount[], images: IDockerImage[]) => { + const initialize = (accounts: IAccount[], images: IDockerImage[]) => { spyOn(accountService, 'listAccounts').and.returnValue($q.when(accounts)); spyOn(dockerImageReader, 'findImages').and.returnValue($q.when(images)); $ctrl = $componentController( diff --git a/app/scripts/modules/google/address/address.reader.ts b/app/scripts/modules/google/address/address.reader.ts index 82a19510c17..d650fcf01ad 100644 --- a/app/scripts/modules/google/address/address.reader.ts +++ b/app/scripts/modules/google/address/address.reader.ts @@ -42,7 +42,7 @@ class GceAddressReader { return searchResults.results .filter(result => result.provider === 'gce') .map(result => { - let address = JSON.parse(result.address) as IGceAddress; + const address = JSON.parse(result.address) as IGceAddress; address.account = result.account; address.region = result.region; return address; diff --git a/app/scripts/modules/google/cache/cacheRefresh.component.ts b/app/scripts/modules/google/cache/cacheRefresh.component.ts index 9350b799e05..ebd7f2c0d37 100644 --- a/app/scripts/modules/google/cache/cacheRefresh.component.ts +++ b/app/scripts/modules/google/cache/cacheRefresh.component.ts @@ -18,7 +18,7 @@ class GceCacheRefreshCtrl implements IComponentController { private infrastructureCaches: InfrastructureCacheService) {} public $onInit(): void { - let cacheKeyAlias = this.cacheKeyAlias || this.cacheKey; + const cacheKeyAlias = this.cacheKeyAlias || this.cacheKey; this.capitalizedKey = cacheKeyAlias[0].toUpperCase() + cacheKeyAlias.substring(1); this.depluralizedKey = cacheKeyAlias.substring(0, cacheKeyAlias.length - 1); } diff --git a/app/scripts/modules/google/healthCheck/healthCheck.read.service.ts b/app/scripts/modules/google/healthCheck/healthCheck.read.service.ts index 402b25e2a76..4f3a02d75df 100644 --- a/app/scripts/modules/google/healthCheck/healthCheck.read.service.ts +++ b/app/scripts/modules/google/healthCheck/healthCheck.read.service.ts @@ -27,9 +27,9 @@ export class GceHealthCheckReader { .search({q: '', type: 'healthChecks'}, this.infrastructureCaches.get('healthChecks')) .then((searchResults: ISearchResults) => { if (searchResults && searchResults.results) { - let healthChecks = searchResults.results.filter(result => result.provider === 'gce') + const healthChecks = searchResults.results.filter(result => result.provider === 'gce') .map(result => { - let healthCheck = JSON.parse(result.healthCheck) as IGceHealthCheck; + const healthCheck = JSON.parse(result.healthCheck) as IGceHealthCheck; healthCheck.account = result.account; return healthCheck; }); diff --git a/app/scripts/modules/google/loadBalancer/configure/choice/gceLoadBalancerChoice.modal.ts b/app/scripts/modules/google/loadBalancer/configure/choice/gceLoadBalancerChoice.modal.ts index d9b6924fc7a..6b32222a4ae 100644 --- a/app/scripts/modules/google/loadBalancer/configure/choice/gceLoadBalancerChoice.modal.ts +++ b/app/scripts/modules/google/loadBalancer/configure/choice/gceLoadBalancerChoice.modal.ts @@ -21,7 +21,7 @@ class GceLoadBalancerChoiceCtrl implements ng.IComponentController { } public choose (choice: string): void { - let wizard = find(this.loadBalancerTypeToWizardMap, wizardConfig => wizardConfig.label === choice); + const wizard = find(this.loadBalancerTypeToWizardMap, wizardConfig => wizardConfig.label === choice); this.$uibModalInstance.dismiss(); this.$uibModal.open({ templateUrl: wizard.createTemplateUrl, diff --git a/app/scripts/modules/google/loadBalancer/configure/common/commonLoadBalancer.controller.ts b/app/scripts/modules/google/loadBalancer/configure/common/commonLoadBalancer.controller.ts index cd2d630d192..98fb9d11754 100644 --- a/app/scripts/modules/google/loadBalancer/configure/common/commonLoadBalancer.controller.ts +++ b/app/scripts/modules/google/loadBalancer/configure/common/commonLoadBalancer.controller.ts @@ -29,7 +29,7 @@ export class CommonGceLoadBalancerCtrl { } public getName (lb: IGceLoadBalancer, application: Application): string { - let loadBalancerName = [application.name, (lb.stack || ''), (lb.detail || '')].join('-'); + const loadBalancerName = [application.name, (lb.stack || ''), (lb.detail || '')].join('-'); return trimEnd(loadBalancerName, '-'); } @@ -40,7 +40,7 @@ export class CommonGceLoadBalancerCtrl { } this.$uibModalInstance.close(); - let newStateParams = { + const newStateParams = { name: loadBalancer.loadBalancerName, accountId: loadBalancer.credentials, region: loadBalancer.region, diff --git a/app/scripts/modules/google/loadBalancer/configure/common/commonLoadBalancerCommandBuilder.service.ts b/app/scripts/modules/google/loadBalancer/configure/common/commonLoadBalancerCommandBuilder.service.ts index 8a5ea057729..46857a427fa 100644 --- a/app/scripts/modules/google/loadBalancer/configure/common/commonLoadBalancerCommandBuilder.service.ts +++ b/app/scripts/modules/google/loadBalancer/configure/common/commonLoadBalancerCommandBuilder.service.ts @@ -55,7 +55,7 @@ export class GceCommonLoadBalancerCommandBuilder { private gceCertificateReader: GceCertificateReader) { } public getBackingData(dataTypes: string[]): IPromise { - let promises = dataTypes.reduce((promisesByDataType: { [dataType: string]: IPromise }, dataType: string) => { + const promises = dataTypes.reduce((promisesByDataType: { [dataType: string]: IPromise }, dataType: string) => { if (this.dataFetchers[dataType]) { promisesByDataType[dataType] = this.dataFetchers[dataType](); } diff --git a/app/scripts/modules/google/loadBalancer/configure/internal/gceCreateInternalLoadBalancer.controller.ts b/app/scripts/modules/google/loadBalancer/configure/internal/gceCreateInternalLoadBalancer.controller.ts index 595c86f1e82..c41f49f3dfc 100644 --- a/app/scripts/modules/google/loadBalancer/configure/internal/gceCreateInternalLoadBalancer.controller.ts +++ b/app/scripts/modules/google/loadBalancer/configure/internal/gceCreateInternalLoadBalancer.controller.ts @@ -120,7 +120,7 @@ class InternalLoadBalancerCtrl extends CommonGceLoadBalancerCtrl implements ng.I this.loadBalancer.loadBalancerName = this.getName(this.loadBalancer, this.application); - let accountNames: string[] = backingData.accounts.map((account: IAccount) => account.name); + const accountNames: string[] = backingData.accounts.map((account: IAccount) => account.name); if (accountNames.length && !accountNames.includes(this.loadBalancer.account)) { this.loadBalancer.credentials = accountNames[0]; } else { @@ -135,7 +135,7 @@ class InternalLoadBalancerCtrl extends CommonGceLoadBalancerCtrl implements ng.I .groupHealthChecksByAccountAndType(backingData.healthChecks as IGceHealthCheck[]); // We don't count the load balancer's health check in the existing health checks list. - let healthCheckNamesToOmit = this.isNew ? [] : [this.loadBalancer.backendService.healthCheck.name]; + const healthCheckNamesToOmit = this.isNew ? [] : [this.loadBalancer.backendService.healthCheck.name]; this.existingHealthCheckNamesByAccount = this.gceCommonLoadBalancerCommandBuilder .groupHealthCheckNamesByAccount(backingData.healthChecks as IGceHealthCheck[], healthCheckNamesToOmit); @@ -162,7 +162,7 @@ class InternalLoadBalancerCtrl extends CommonGceLoadBalancerCtrl implements ng.I this.healthChecksByAccountAndType = this.gceCommonLoadBalancerCommandBuilder .groupHealthChecksByAccountAndType(data.healthChecks as IGceHealthCheck[]); - let healthCheckNamesToOmit = this.isNew ? [] : [this.loadBalancer.backendService.healthCheck.name]; + const healthCheckNamesToOmit = this.isNew ? [] : [this.loadBalancer.backendService.healthCheck.name]; this.existingHealthCheckNamesByAccount = this.gceCommonLoadBalancerCommandBuilder .groupHealthCheckNamesByAccount(data.healthChecks as IGceHealthCheck[], healthCheckNamesToOmit); }); @@ -189,11 +189,11 @@ class InternalLoadBalancerCtrl extends CommonGceLoadBalancerCtrl implements ng.I } public accountUpdated (): void { - let existingHealthCheckNames = + const existingHealthCheckNames = _.get(this, ['existingHealthCheckNamesByAccount', this.loadBalancer.credentials]); this.existingHealthCheckNames = existingHealthCheckNames || []; - let existingLoadBalancerNames = + const existingLoadBalancerNames = _.get(this, ['existingLoadBalancerNamesByAccount', this.loadBalancer.credentials]); this.existingLoadBalancerNames = existingLoadBalancerNames || []; @@ -221,8 +221,8 @@ class InternalLoadBalancerCtrl extends CommonGceLoadBalancerCtrl implements ng.I } public submit (): void { - let descriptor = this.isNew ? 'Create' : 'Update'; - let toSubmitLoadBalancer = _.cloneDeep(this.loadBalancer) as any; + const descriptor = this.isNew ? 'Create' : 'Update'; + const toSubmitLoadBalancer = _.cloneDeep(this.loadBalancer) as any; toSubmitLoadBalancer.ports = toSubmitLoadBalancer.ports.split(',').map((port: string) => port.trim()); toSubmitLoadBalancer.cloudProvider = 'gce'; toSubmitLoadBalancer.name = toSubmitLoadBalancer.loadBalancerName; diff --git a/app/scripts/modules/google/loadBalancer/configure/ssl/gceCreateSslLoadBalancer.controller.ts b/app/scripts/modules/google/loadBalancer/configure/ssl/gceCreateSslLoadBalancer.controller.ts index da9ded55b01..432186be90f 100644 --- a/app/scripts/modules/google/loadBalancer/configure/ssl/gceCreateSslLoadBalancer.controller.ts +++ b/app/scripts/modules/google/loadBalancer/configure/ssl/gceCreateSslLoadBalancer.controller.ts @@ -122,7 +122,7 @@ class SslLoadBalancerCtrl extends CommonGceLoadBalancerCtrl implements ng.ICompo this.loadBalancer.loadBalancerName = this.getName(this.loadBalancer, this.application); - let accountNames: string[] = backingData.accounts.map((account: IAccount) => account.name); + const accountNames: string[] = backingData.accounts.map((account: IAccount) => account.name); if (accountNames.length && !accountNames.includes(this.loadBalancer.account)) { this.loadBalancer.credentials = accountNames[0]; } else { @@ -136,7 +136,7 @@ class SslLoadBalancerCtrl extends CommonGceLoadBalancerCtrl implements ng.ICompo .groupHealthChecksByAccountAndType(backingData.healthChecks as IGceHealthCheck[]); // We don't count the load balancer's health check in the existing health checks list. - let healthCheckNamesToOmit = this.isNew ? [] : [this.loadBalancer.backendService.healthCheck.name]; + const healthCheckNamesToOmit = this.isNew ? [] : [this.loadBalancer.backendService.healthCheck.name]; this.existingHealthCheckNamesByAccount = this.gceCommonLoadBalancerCommandBuilder .groupHealthCheckNamesByAccount(backingData.healthChecks as IGceHealthCheck[], healthCheckNamesToOmit); @@ -163,7 +163,7 @@ class SslLoadBalancerCtrl extends CommonGceLoadBalancerCtrl implements ng.ICompo this.healthChecksByAccountAndType = this.gceCommonLoadBalancerCommandBuilder .groupHealthChecksByAccountAndType(data.healthChecks as IGceHealthCheck[]); - let healthCheckNamesToOmit = this.isNew ? [] : [this.loadBalancer.backendService.healthCheck.name]; + const healthCheckNamesToOmit = this.isNew ? [] : [this.loadBalancer.backendService.healthCheck.name]; this.existingHealthCheckNamesByAccount = this.gceCommonLoadBalancerCommandBuilder .groupHealthCheckNamesByAccount(data.healthChecks as IGceHealthCheck[], healthCheckNamesToOmit); }); @@ -177,11 +177,11 @@ class SslLoadBalancerCtrl extends CommonGceLoadBalancerCtrl implements ng.ICompo } public accountUpdated (): void { - let existingHealthCheckNames = + const existingHealthCheckNames = _.get(this, ['existingHealthCheckNamesByAccount', this.loadBalancer.credentials]); this.existingHealthCheckNames = existingHealthCheckNames || []; - let existingLoadBalancerNames = + const existingLoadBalancerNames = _.get(this, ['existingLoadBalancerNamesByAccount', this.loadBalancer.credentials]); this.existingLoadBalancerNames = existingLoadBalancerNames || []; @@ -200,8 +200,8 @@ class SslLoadBalancerCtrl extends CommonGceLoadBalancerCtrl implements ng.ICompo } public submit (): void { - let descriptor = this.isNew ? 'Create' : 'Update'; - let toSubmitLoadBalancer = _.cloneDeep(this.loadBalancer) as ISslLoadBalancerUpsertDescription; + const descriptor = this.isNew ? 'Create' : 'Update'; + const toSubmitLoadBalancer = _.cloneDeep(this.loadBalancer) as ISslLoadBalancerUpsertDescription; toSubmitLoadBalancer.backendService.name = toSubmitLoadBalancer.name; toSubmitLoadBalancer.cloudProvider = 'gce'; delete toSubmitLoadBalancer['instances']; diff --git a/app/scripts/modules/google/loadBalancer/details/deleteModal/deleteModal.controller.ts b/app/scripts/modules/google/loadBalancer/details/deleteModal/deleteModal.controller.ts index 077648ea446..43fdb26700d 100644 --- a/app/scripts/modules/google/loadBalancer/details/deleteModal/deleteModal.controller.ts +++ b/app/scripts/modules/google/loadBalancer/details/deleteModal/deleteModal.controller.ts @@ -49,7 +49,7 @@ class DeleteLoadBalancerModalController implements ng.IComponentController { public $onInit (): void { - let taskMonitorConfig = { + const taskMonitorConfig = { application: this.application, title: 'Deleting ' + this.loadBalancer.name, modalInstance: this.$uibModalInstance, diff --git a/app/scripts/modules/google/loadBalancer/httpLoadBalancerUtils.service.ts b/app/scripts/modules/google/loadBalancer/httpLoadBalancerUtils.service.ts index 7dc942ef284..e032cc32fb6 100644 --- a/app/scripts/modules/google/loadBalancer/httpLoadBalancerUtils.service.ts +++ b/app/scripts/modules/google/loadBalancer/httpLoadBalancerUtils.service.ts @@ -16,9 +16,9 @@ export class GceHttpLoadBalancerUtils { loadBalancers: IGceLoadBalancer[]): string[] { // Assume that loadBalancers is a list of all GCE load balancers in an application // (but possibly from several accounts), and has already been normalized (listener names mapped to URL map names). - let normalizedLoadBalancerNames: string[] = []; + const normalizedLoadBalancerNames: string[] = []; loadBalancerNames.forEach(loadBalancerName => { - let matchingUrlMap = loadBalancers.find(loadBalancer => { + const matchingUrlMap = loadBalancers.find(loadBalancer => { return account === loadBalancer.account && this.isHttpLoadBalancer(loadBalancer) && loadBalancer.listeners.map(listener => listener.name).includes(loadBalancerName); diff --git a/app/scripts/modules/google/loadBalancer/loadBalancer.setTransformer.ts b/app/scripts/modules/google/loadBalancer/loadBalancer.setTransformer.ts index 94904a46f59..3b1cdf61f0d 100644 --- a/app/scripts/modules/google/loadBalancer/loadBalancer.setTransformer.ts +++ b/app/scripts/modules/google/loadBalancer/loadBalancer.setTransformer.ts @@ -7,10 +7,10 @@ import {IGceLoadBalancer, IGceHttpLoadBalancer} from 'google/domain/loadBalancer export class GceLoadBalancerSetTransformer { private static normalizeHttpLoadBalancerGroup(group: IGceHttpLoadBalancer[]): IGceHttpLoadBalancer { - let normalized = cloneDeep(group[0]); + const normalized = cloneDeep(group[0]); normalized.listeners = group.map((loadBalancer) => { - let port = loadBalancer.portRange ? GceLoadBalancerSetTransformer.parsePortRange(loadBalancer.portRange) : null; + const port = loadBalancer.portRange ? GceLoadBalancerSetTransformer.parsePortRange(loadBalancer.portRange) : null; return { port, name: loadBalancer.name, @@ -34,10 +34,10 @@ export class GceLoadBalancerSetTransformer { constructor(private gceHttpLoadBalancerUtils: GceHttpLoadBalancerUtils) {} public normalizeLoadBalancerSet = (loadBalancers: IGceLoadBalancer[]): IGceLoadBalancer[] => { - let [httpLoadBalancers, otherLoadBalancers] = partition(loadBalancers, lb => this.gceHttpLoadBalancerUtils.isHttpLoadBalancer(lb)); + const [httpLoadBalancers, otherLoadBalancers] = partition(loadBalancers, lb => this.gceHttpLoadBalancerUtils.isHttpLoadBalancer(lb)); - let groupedByUrlMap = groupBy(httpLoadBalancers, 'urlMapName'); - let normalizedElSevenLoadBalancers = map(groupedByUrlMap, GceLoadBalancerSetTransformer.normalizeHttpLoadBalancerGroup); + const groupedByUrlMap = groupBy(httpLoadBalancers, 'urlMapName'); + const normalizedElSevenLoadBalancers = map(groupedByUrlMap, GceLoadBalancerSetTransformer.normalizeHttpLoadBalancerGroup); return (normalizedElSevenLoadBalancers as IGceLoadBalancer[]).concat(otherLoadBalancers); } diff --git a/app/scripts/modules/google/securityGroup/securityGroupHelpText.service.spec.ts b/app/scripts/modules/google/securityGroup/securityGroupHelpText.service.spec.ts index a61a619ae66..5b0c252bf06 100644 --- a/app/scripts/modules/google/securityGroup/securityGroupHelpText.service.spec.ts +++ b/app/scripts/modules/google/securityGroup/securityGroupHelpText.service.spec.ts @@ -15,7 +15,7 @@ describe('Service: gceSecurityGroupHelpTextService', () => { _$timeout_: ng.ITimeoutService) => { gceSecurityGroupHelpTextService = _gceSecurityGroupHelpTextService_; $q = _$q_; - let $timeout = _$timeout_; + const $timeout = _$timeout_; application = { ready: () => $q.resolve(), @@ -78,7 +78,7 @@ describe('Service: gceSecurityGroupHelpTextService', () => { }); it('should be ok if no server groups match the given tag', () => { - let helpText = gceSecurityGroupHelpTextService.getHelpTextForTag('no-matches-tag', 'source'); + const helpText = gceSecurityGroupHelpTextService.getHelpTextForTag('no-matches-tag', 'source'); expect(() => gceSecurityGroupHelpTextService.getHelpTextForTag('no-matches-tag', 'source')).not.toThrow(); expect(helpText).not.toContain('match-v000'); expect(helpText).not.toContain('match-v001'); @@ -88,7 +88,7 @@ describe('Service: gceSecurityGroupHelpTextService', () => { it('should have no matches after a reset', () => { gceSecurityGroupHelpTextService.reset(); - let helpText = gceSecurityGroupHelpTextService.getHelpTextForTag('tag-a', 'source'); + const helpText = gceSecurityGroupHelpTextService.getHelpTextForTag('tag-a', 'source'); expect(helpText).not.toContain('match-v000'); expect(helpText).not.toContain('match-v001'); expect(helpText).not.toContain('other-account-v000'); diff --git a/app/scripts/modules/google/securityGroup/securityGroupHelpText.service.ts b/app/scripts/modules/google/securityGroup/securityGroupHelpText.service.ts index a2dc2ba039c..30001d4d61b 100644 --- a/app/scripts/modules/google/securityGroup/securityGroupHelpText.service.ts +++ b/app/scripts/modules/google/securityGroup/securityGroupHelpText.service.ts @@ -18,7 +18,7 @@ export class GceSecurityGroupHelpTextService { } public getHelpTextForTag(tag: string, tagType: 'source' | 'target'): string { - let serverGroups = this.getServerGroupsWithTag(tag); + const serverGroups = this.getServerGroupsWithTag(tag); let text: string; switch (serverGroups.length) { case 0: diff --git a/app/scripts/modules/google/serverGroup/configure/wizard/autoHealingPolicy/autoHealingPolicySelector.component.ts b/app/scripts/modules/google/serverGroup/configure/wizard/autoHealingPolicy/autoHealingPolicySelector.component.ts index 4a688688dda..a0cd76d29dc 100644 --- a/app/scripts/modules/google/serverGroup/configure/wizard/autoHealingPolicy/autoHealingPolicySelector.component.ts +++ b/app/scripts/modules/google/serverGroup/configure/wizard/autoHealingPolicy/autoHealingPolicySelector.component.ts @@ -32,7 +32,7 @@ class GceAutoHealingPolicySelector implements ng.IComponentController { // Clouddriver deletes maxUnavailable if maxUnavailable is an empty object. this.autoHealingPolicy.maxUnavailable = {}; } else { - let toDeleteKey = selectedMetric === 'percent' ? 'fixed' : 'percent'; + const toDeleteKey = selectedMetric === 'percent' ? 'fixed' : 'percent'; set(this.autoHealingPolicy, ['maxUnavailable', toDeleteKey], undefined); } } diff --git a/app/scripts/modules/google/serverGroup/configure/wizard/loadBalancingPolicy/loadBalancingPolicySelector.component.ts b/app/scripts/modules/google/serverGroup/configure/wizard/loadBalancingPolicy/loadBalancingPolicySelector.component.ts index ba4d78d96ef..b2beb2197e8 100644 --- a/app/scripts/modules/google/serverGroup/configure/wizard/loadBalancingPolicy/loadBalancingPolicySelector.component.ts +++ b/app/scripts/modules/google/serverGroup/configure/wizard/loadBalancingPolicy/loadBalancingPolicySelector.component.ts @@ -17,7 +17,7 @@ class GceLoadBalancingPolicySelectorController implements ng.IComponentControlle }; public onBalancingModeChange (mode: string): void { - let keys: string[] = ['maxUtilization', 'maxRatePerInstance', 'maxConnectionsPerInstance']; + const keys: string[] = ['maxUtilization', 'maxRatePerInstance', 'maxConnectionsPerInstance']; let toDelete: string[] = []; switch (mode) { case 'RATE': @@ -45,11 +45,11 @@ class GceLoadBalancingPolicySelectorController implements ng.IComponentControlle * - If we have both, only UTILIZATION. * */ if (has(this, 'command.backingData.filtered.loadBalancerIndex')) { - let index = this.command.backingData.filtered.loadBalancerIndex; - let selected = this.command.loadBalancers; + const index = this.command.backingData.filtered.loadBalancerIndex; + const selected = this.command.loadBalancers; - let hasSsl = selected.find((loadBalancer: any) => get(index[loadBalancer], 'loadBalancerType') === 'SSL'); - let hasHttp = selected.find((loadBalancer: any) => get(index[loadBalancer], 'loadBalancerType') === 'HTTP'); + const hasSsl = selected.find((loadBalancer: any) => get(index[loadBalancer], 'loadBalancerType') === 'SSL'); + const hasHttp = selected.find((loadBalancer: any) => get(index[loadBalancer], 'loadBalancerType') === 'HTTP'); if ((hasSsl && hasHttp)) { balancingModes = ['UTILIZATION']; diff --git a/app/scripts/modules/google/serverGroup/details/autoHealingPolicy/autoHealingPolicy.component.ts b/app/scripts/modules/google/serverGroup/details/autoHealingPolicy/autoHealingPolicy.component.ts index 79fd0d7e204..2e7910cbe75 100644 --- a/app/scripts/modules/google/serverGroup/details/autoHealingPolicy/autoHealingPolicy.component.ts +++ b/app/scripts/modules/google/serverGroup/details/autoHealingPolicy/autoHealingPolicy.component.ts @@ -27,7 +27,7 @@ class GceAutoHealingPolicyDetailsCtrl implements ng.IComponentController { }; public deletePolicy(): void { - let taskMonitor = { + const taskMonitor = { application: this.application, title: `Deleting autohealing policy for ${this.serverGroup.name}`, }; diff --git a/app/scripts/modules/google/serverGroup/details/autoHealingPolicy/modal/upsertAutoHealingPolicy.modal.controller.ts b/app/scripts/modules/google/serverGroup/details/autoHealingPolicy/modal/upsertAutoHealingPolicy.modal.controller.ts index c9700920566..1ac65ec5996 100644 --- a/app/scripts/modules/google/serverGroup/details/autoHealingPolicy/modal/upsertAutoHealingPolicy.modal.controller.ts +++ b/app/scripts/modules/google/serverGroup/details/autoHealingPolicy/modal/upsertAutoHealingPolicy.modal.controller.ts @@ -31,7 +31,7 @@ class GceUpsertAutoHealingPolicyModalCtrl { } public submit(): void { - let submitMethod = () => { + const submitMethod = () => { return this.gceAutoscalingPolicyWriter .upsertAutoHealingPolicy(this.application, this.serverGroup, this.autoHealingPolicy); }; diff --git a/app/scripts/modules/kubernetes/container/securityContext/capabilitiesSelector.component.ts b/app/scripts/modules/kubernetes/container/securityContext/capabilitiesSelector.component.ts index 485dcf2e364..f57ed97fc51 100644 --- a/app/scripts/modules/kubernetes/container/securityContext/capabilitiesSelector.component.ts +++ b/app/scripts/modules/kubernetes/container/securityContext/capabilitiesSelector.component.ts @@ -23,7 +23,7 @@ class CapabilitiesSelector implements ng.IComponentController { ]; public add (fieldModel: string): void { - let path = ['securityContext', 'capabilities', fieldModel]; + const path = ['securityContext', 'capabilities', fieldModel]; if (!has(this.component, path)) { set(this.component, path, []); } diff --git a/app/scripts/modules/netflix/exception/exceptionHandler.ts b/app/scripts/modules/netflix/exception/exceptionHandler.ts index d707458db04..f6247852c96 100644 --- a/app/scripts/modules/netflix/exception/exceptionHandler.ts +++ b/app/scripts/modules/netflix/exception/exceptionHandler.ts @@ -28,7 +28,7 @@ module(EXCEPTION_HANDLER, [AUTHENTICATION_SERVICE]) } } - let payload = { + const payload = { alertName: 'Spinnaker', details: { url: location.href, diff --git a/app/scripts/modules/netflix/fastProperties/dataNav/fastPropertyFilter.directive.ts b/app/scripts/modules/netflix/fastProperties/dataNav/fastPropertyFilter.directive.ts index 02d0223c313..c0645afc22b 100644 --- a/app/scripts/modules/netflix/fastProperties/dataNav/fastPropertyFilter.directive.ts +++ b/app/scripts/modules/netflix/fastProperties/dataNav/fastPropertyFilter.directive.ts @@ -15,13 +15,13 @@ class FastPropertyFilterDirective implements ng.IDirective { public fields: string[] = ['app', 'env', 'region', 'stack', 'cluster']; public link(scope: any, el: any) { - let input = el.children('input'); + const input = el.children('input'); - let getScopeAttributeList = (scopeName: string) => { + const getScopeAttributeList = (scopeName: string) => { return ['none'].concat( uniq(scope.properties.map((prop: any) => prop.scope[scopeName]))); }; - let textcompleteComponents = this.fields.map((field) => { + const textcompleteComponents = this.fields.map((field) => { return { id: field, match: new RegExp(`${field}:(\\w*|\\s*)$`), @@ -32,8 +32,8 @@ class FastPropertyFilterDirective implements ng.IDirective { })); }, replace: (attr: string): string => { - let copy = scope.filters.list.splice(0); - let tagBody = {label: field, value: attr}; + const copy = scope.filters.list.splice(0); + const tagBody = {label: field, value: attr}; copy.push(scope.createFilterTag(tagBody)); scope.filters.list = uniqWith(copy, (a: any, b: any) => a.label === b.label && a.value === b.value); return ''; diff --git a/app/scripts/modules/netflix/fastProperties/domain/property.domain.ts b/app/scripts/modules/netflix/fastProperties/domain/property.domain.ts index 09fd9f8e304..b91ed089f43 100644 --- a/app/scripts/modules/netflix/fastProperties/domain/property.domain.ts +++ b/app/scripts/modules/netflix/fastProperties/domain/property.domain.ts @@ -18,7 +18,7 @@ export class Property { public scope: Scope; public static build(platformProperty: IPlatformProperty): Property { - let property = new Property(); + const property = new Property(); property.propertyId = platformProperty.propertyId; property.env = platformProperty.env; property.updatedBy = platformProperty.updatedBy; diff --git a/app/scripts/modules/netflix/fastProperties/domain/propertyCommand.model.spec.ts b/app/scripts/modules/netflix/fastProperties/domain/propertyCommand.model.spec.ts index 2c937e59883..118fa1aea0c 100644 --- a/app/scripts/modules/netflix/fastProperties/domain/propertyCommand.model.spec.ts +++ b/app/scripts/modules/netflix/fastProperties/domain/propertyCommand.model.spec.ts @@ -6,31 +6,31 @@ describe('propertyCommand model', function () { describe('get button label', function () { it('for CREATE', function () { - let propCommand: PropertyCommand = new PropertyCommand(); + const propCommand: PropertyCommand = new PropertyCommand(); propCommand.type = PropertyCommandType.CREATE; expect(propCommand.submitButtonLabel()).toBe('Create'); }); it('for UPDATE', function () { - let propCommand: PropertyCommand = new PropertyCommand(); + const propCommand: PropertyCommand = new PropertyCommand(); propCommand.type = PropertyCommandType.UPDATE; expect(propCommand.submitButtonLabel()).toBe('Update'); }); it('for DELETE', function () { - let propCommand: PropertyCommand = new PropertyCommand(); + const propCommand: PropertyCommand = new PropertyCommand(); propCommand.type = PropertyCommandType.DELETE; expect(propCommand.submitButtonLabel()).toBe('Delete'); }); it('for undefined propertyCommandType', function() { - let propCommand: PropertyCommand = new PropertyCommand(); + const propCommand: PropertyCommand = new PropertyCommand(); propCommand.type = undefined; expect(propCommand.submitButtonLabel()).toBe('Submit'); }); it('for null propertyCommandType', function() { - let propCommand: PropertyCommand = new PropertyCommand(); + const propCommand: PropertyCommand = new PropertyCommand(); propCommand.type = null; expect(propCommand.submitButtonLabel()).toBe('Submit'); }); @@ -38,11 +38,11 @@ describe('propertyCommand model', function () { describe('check to move to new scope', function () { it('is move to new scope if originalScope and selectedScope are different', function () { - let command: PropertyCommand = new PropertyCommand(); - let origScope = new Scope(); + const command: PropertyCommand = new PropertyCommand(); + const origScope = new Scope(); origScope.env = 'prod'; origScope.appId = 'mahe'; - let selectedScope = new Scope(); + const selectedScope = new Scope(); selectedScope.env = 'prod'; selectedScope.appId = 'newApp'; @@ -53,12 +53,12 @@ describe('propertyCommand model', function () { }); it('is not a move to new scope if originalScope and selectedScope are same but have different instance counts', function () { - let command: PropertyCommand = new PropertyCommand(); - let origScope = new Scope(); + const command: PropertyCommand = new PropertyCommand(); + const origScope = new Scope(); origScope.env = 'prod'; origScope.appId = 'mahe'; origScope.instanceCounts = {up: 1}; - let selectedScope = new Scope(); + const selectedScope = new Scope(); selectedScope.env = 'prod'; selectedScope.appId = 'mahe'; selectedScope.instanceCounts = {up: 99}; @@ -71,8 +71,8 @@ describe('propertyCommand model', function () { it('is not a move to a new scope if the originalScope and the selected scope are the same ', function () { - let command: PropertyCommand = new PropertyCommand(); - let scope = new Scope(); + const command: PropertyCommand = new PropertyCommand(); + const scope = new Scope(); scope.env = 'prod'; scope.appId = 'mahe'; @@ -83,8 +83,8 @@ describe('propertyCommand model', function () { }); it('is not a move to a new scope if there is no new selected scope', function () { - let command: PropertyCommand = new PropertyCommand(); - let scope = new Scope(); + const command: PropertyCommand = new PropertyCommand(); + const scope = new Scope(); scope.env = 'prod'; scope.appId = 'mahe'; @@ -95,8 +95,8 @@ describe('propertyCommand model', function () { }); it('is not a move to a new scope if there is no new scope', function () { - let command: PropertyCommand = new PropertyCommand(); - let scope = new Scope(); + const command: PropertyCommand = new PropertyCommand(); + const scope = new Scope(); scope.env = 'prod'; scope.appId = 'mahe'; diff --git a/app/scripts/modules/netflix/fastProperties/domain/propertyCommand.model.ts b/app/scripts/modules/netflix/fastProperties/domain/propertyCommand.model.ts index 0e862020676..e3a1e599e57 100644 --- a/app/scripts/modules/netflix/fastProperties/domain/propertyCommand.model.ts +++ b/app/scripts/modules/netflix/fastProperties/domain/propertyCommand.model.ts @@ -48,12 +48,12 @@ export class PropertyCommand { public buildPropertyStages(user: IUser): PropertyPipelineStage[] { let stages: PropertyPipelineStage[] = []; if (this.isMoveToNewScope()) { - let createStage = PropertyPipelineStage.newPropertyStage(user, this.scopes[0], this); - let deleteStage = PropertyPipelineStage.deletePropertyStage(user, this, createStage); + const createStage = PropertyPipelineStage.newPropertyStage(user, this.scopes[0], this); + const deleteStage = PropertyPipelineStage.deletePropertyStage(user, this, createStage); stages = [createStage, deleteStage]; } else { this.scopes.reduce((previousStage: PropertyPipelineStage, scope: Scope) => { - let stage = PropertyPipelineStage.upsertPropertyStage(user, scope, this, previousStage); + const stage = PropertyPipelineStage.upsertPropertyStage(user, scope, this, previousStage); stages.push(stage); return stage; }, null); @@ -85,7 +85,7 @@ export class PropertyCommand { } public submitButtonLabel(): string { - let typeAsString = this.getTypeAsString(); + const typeAsString = this.getTypeAsString(); return typeAsString ? `${this.getTypeAsString().charAt(0).toUpperCase()}${this.getTypeAsString().slice(1).toLowerCase()}` : 'Submit'; diff --git a/app/scripts/modules/netflix/fastProperties/domain/propertyPipelineStage.ts b/app/scripts/modules/netflix/fastProperties/domain/propertyPipelineStage.ts index 0c62e49a6fa..48b4dbf25c4 100644 --- a/app/scripts/modules/netflix/fastProperties/domain/propertyPipelineStage.ts +++ b/app/scripts/modules/netflix/fastProperties/domain/propertyPipelineStage.ts @@ -22,7 +22,7 @@ export class PropertyPipelineStage implements IStage { public description: string; public static clonePropertyForStage(user: IUser, property: Property): Property { - let propertyCopy: Property = copy(property); + const propertyCopy: Property = copy(property); propertyCopy.updatedBy = user.name; propertyCopy.cmcTicket = user.name; @@ -39,12 +39,12 @@ export class PropertyPipelineStage implements IStage { } public static newPropertyStage(user: IUser, scope: Scope, command: PropertyCommand, previousStage?: IStage): PropertyPipelineStage { - let property: Property = PropertyPipelineStage.clonePropertyForStage(user, command.property); + const property: Property = PropertyPipelineStage.clonePropertyForStage(user, command.property); property.propertyId = null; - let scopeForSubmit: Scope = scope.forSubmit(command.property.env); + const scopeForSubmit: Scope = scope.forSubmit(command.property.env); - let stage = new PropertyPipelineStage(property, scopeForSubmit, previousStage); + const stage = new PropertyPipelineStage(property, scopeForSubmit, previousStage); stage.rawScope = scope; // This is so we can display the selected scope on the Review section of the wizard stage.delete = false; stage.description = `Create new property for ${property.key}`; @@ -55,9 +55,9 @@ export class PropertyPipelineStage implements IStage { } public static deletePropertyStage(user: IUser, command: PropertyCommand, previousStage?: IStage): PropertyPipelineStage { - let property: Property = PropertyPipelineStage.clonePropertyForStage(user, command.property); - let scope: Scope = command.originalScopeForSubmit(); - let stage = new PropertyPipelineStage(property, scope, previousStage); + const property: Property = PropertyPipelineStage.clonePropertyForStage(user, command.property); + const scope: Scope = command.originalScopeForSubmit(); + const stage = new PropertyPipelineStage(property, scope, previousStage); stage.rawScope = command.originalScope; // This is so we can display the selected scope on the Review section of the wizard stage.delete = true; stage.description = `Deleting property for ${property.key}`; @@ -67,9 +67,9 @@ export class PropertyPipelineStage implements IStage { } public static upsertPropertyStage(user: IUser, scope: Scope, command: PropertyCommand, previousStage?: IStage): PropertyPipelineStage { - let property: Property = PropertyPipelineStage.clonePropertyForStage(user, command.property); - let scopeForSubmit: Scope = scope.forSubmit(command.property.env); - let stage = new PropertyPipelineStage(property, scopeForSubmit, previousStage); + const property: Property = PropertyPipelineStage.clonePropertyForStage(user, command.property); + const scopeForSubmit: Scope = scope.forSubmit(command.property.env); + const stage = new PropertyPipelineStage(property, scopeForSubmit, previousStage); stage.rawScope = scope; // This is so we can display the selected scope on the Review section of the wizard stage.delete = command.type === PropertyCommandType.DELETE; stage.description = `Upserting property for ${property.key}`; diff --git a/app/scripts/modules/netflix/fastProperties/domain/scope.domain.spec.ts b/app/scripts/modules/netflix/fastProperties/domain/scope.domain.spec.ts index 2332d7f1f4f..01c85338ad9 100644 --- a/app/scripts/modules/netflix/fastProperties/domain/scope.domain.spec.ts +++ b/app/scripts/modules/netflix/fastProperties/domain/scope.domain.spec.ts @@ -6,7 +6,7 @@ describe('Scope Domain Spec', function () { describe('statically create a new scope from a scope fetched from the props API', () => { it('should build a new scope when a we have complete scope from props API ', function () { - let platformProperty = { + const platformProperty = { env: 'prod', region: 'us-east-1', appId: 'deck', @@ -19,7 +19,7 @@ describe('Scope Domain Spec', function () { propertyId: '1234' }; - let result: Scope = Scope.build(platformProperty); + const result: Scope = Scope.build(platformProperty); ['env', 'region', 'appId', 'stack', 'asg', 'severId', 'zone', 'cluster'].forEach((prop: string) => { expect(result[prop]).toBe(platformProperty[prop]); @@ -33,36 +33,36 @@ describe('Scope Domain Spec', function () { describe('prep a scope for submission', function () { it('has no appId', function () { - let scope = new Scope(); + const scope = new Scope(); - let readyScope = scope.forSubmit('prod'); + const readyScope = scope.forSubmit('prod'); expect(readyScope.appIdList).toEqual([]); }); it('has single appId', function () { - let scope = new Scope(); + const scope = new Scope(); scope.appId = 'deck'; - let readyScope = scope.forSubmit('prod'); + const readyScope = scope.forSubmit('prod'); expect(readyScope.appIdList).toEqual(['deck']); }); it('has multiple comma delimited appId', function () { - let scope = new Scope(); + const scope = new Scope(); scope.appId = 'deck,demo'; - let readyScope = scope.forSubmit('prod'); + const readyScope = scope.forSubmit('prod'); expect(readyScope.appIdList).toEqual(['deck', 'demo']); }); it('has multiple comma delimited appId with whitespace', function () { - let scope = new Scope(); + const scope = new Scope(); scope.appId = 'deck , demo'; - let readyScope = scope.forSubmit('prod'); + const readyScope = scope.forSubmit('prod'); expect(readyScope.appIdList).toEqual(['deck', 'demo']); }); }); diff --git a/app/scripts/modules/netflix/fastProperties/domain/scope.domain.ts b/app/scripts/modules/netflix/fastProperties/domain/scope.domain.ts index 4ca5791f2dc..6d4a4daafee 100644 --- a/app/scripts/modules/netflix/fastProperties/domain/scope.domain.ts +++ b/app/scripts/modules/netflix/fastProperties/domain/scope.domain.ts @@ -28,7 +28,7 @@ export class Scope { public static build(platformProperty: IPlatformProperty): Scope { // platform property has all the property details as well as the scope. We only want the scope. // Object.assign(new Scope(), platformProperty) brings the whole platform property into scope. - let scope = new Scope(); + const scope = new Scope(); scope.env = platformProperty.env; scope.region = platformProperty.region; scope.appId = platformProperty.appId; @@ -41,7 +41,7 @@ export class Scope { } public copy() { - let scope = new Scope(); + const scope = new Scope(); return Object.assign(scope, this); } @@ -67,7 +67,7 @@ export class Scope { } public forSubmit(env: string): Scope { - let copy: Scope = Object.assign({}, this); + const copy: Scope = Object.assign({}, this); copy.env = env; copy.appIdList = this.appId ? this.appId.split(',').map(appName => appName.trim()) : []; delete copy.instanceCounts; diff --git a/app/scripts/modules/netflix/fastProperties/scope/fastPropertyScopeSearch.component.ts b/app/scripts/modules/netflix/fastProperties/scope/fastPropertyScopeSearch.component.ts index add418b0d88..f8096c69774 100644 --- a/app/scripts/modules/netflix/fastProperties/scope/fastPropertyScopeSearch.component.ts +++ b/app/scripts/modules/netflix/fastProperties/scope/fastPropertyScopeSearch.component.ts @@ -50,7 +50,7 @@ export class FastPropertyScopeSearchComponentController implements IComponentCon public $onInit() { this.accountService.getAllAccountDetailsForProvider('aws') .then((accounts: any) => { - let regions = accounts.reduce((acc: any, account: any) => { + const regions = accounts.reduce((acc: any, account: any) => { account.regions.forEach((region: any) => acc.add(region.name)); return acc; }, new Set()); @@ -146,7 +146,7 @@ export class FastPropertyScopeSearchComponentController implements IComponentCon } public fetchApplicationInfo(categories: any[]): any { - let listOfPromises: ng.IPromise[] = []; + const listOfPromises: ng.IPromise[] = []; categories.forEach((category) => { category.results.forEach((item: any) => { @@ -178,11 +178,11 @@ export class FastPropertyScopeSearchComponentController implements IComponentCon } private addStackCategory(categories: any[]) { - let applicationCategory = categories + const applicationCategory = categories .find((cat: any) => cat.category === 'Applications'); - let applicationNames = applicationCategory ? applicationCategory.results.map((item: any) => item.application) : []; + const applicationNames = applicationCategory ? applicationCategory.results.map((item: any) => item.application) : []; - let appsClusters = values(this.applicationDictionary).reduce((acc: any[], app: Application): any[] => { + const appsClusters = values(this.applicationDictionary).reduce((acc: any[], app: Application): any[] => { if (applicationNames.includes(app.name)) { app.clusters.forEach((cluster: ICluster) => { cluster.serverGroups.forEach((serverGroup: ServerGroup) => { diff --git a/app/scripts/modules/netflix/fastProperties/scope/fastPropertyScopeSearchCategory.service.spec.ts b/app/scripts/modules/netflix/fastProperties/scope/fastPropertyScopeSearchCategory.service.spec.ts index f98b11d99b6..9a704c45869 100644 --- a/app/scripts/modules/netflix/fastProperties/scope/fastPropertyScopeSearchCategory.service.spec.ts +++ b/app/scripts/modules/netflix/fastProperties/scope/fastPropertyScopeSearchCategory.service.spec.ts @@ -15,7 +15,7 @@ describe('FastPropertyScopeSearchCategory Service', function () { })); - let testMatch = (env: string, account: string, result: boolean) => { + const testMatch = (env: string, account: string, result: boolean) => { expect(service.scopeEnvMatchesAccount(env, account)).toBe(result); }; diff --git a/app/scripts/modules/netflix/fastProperties/scope/fastPropertyScopeSearchCategory.service.ts b/app/scripts/modules/netflix/fastProperties/scope/fastPropertyScopeSearchCategory.service.ts index 3bc51f2f2b9..d071253d80a 100644 --- a/app/scripts/modules/netflix/fastProperties/scope/fastPropertyScopeSearchCategory.service.ts +++ b/app/scripts/modules/netflix/fastProperties/scope/fastPropertyScopeSearchCategory.service.ts @@ -60,7 +60,7 @@ export class FastPropertyScopeCategoryService { * Builds Global level fast property */ private buildScopeForGlobal(): Scope[] { - let scope: Scope = new Scope(); + const scope: Scope = new Scope(); this.impactCountForGlobal() .then((counts) => { @@ -71,13 +71,13 @@ export class FastPropertyScopeCategoryService { } public impactCountForGlobal() { - let countPromises = this.regions.map((region: any ) => { + const countPromises = this.regions.map((region: any ) => { return this.fastPropertyReader.fetchImpactCountForScope({region: region.region}); }); return this.$q.all(countPromises) .then((countResults: any[]) => { - let count = countResults.reduce((acc: number, result: any) => { + const count = countResults.reduce((acc: number, result: any) => { return acc + Number.parseInt(result.count) ; }, 0 ); return {up: count, total: count}; @@ -90,7 +90,7 @@ export class FastPropertyScopeCategoryService { * Builds Region level fast property */ private buildScopeForRegions(selected: any): Scope[] { - let scope = new Scope(); + const scope = new Scope(); scope.region = selected.region; this.impactCountForRegions(scope) .then((counts: IImpactCounts) => { @@ -112,25 +112,25 @@ export class FastPropertyScopeCategoryService { * Builds Application level fast property */ private buildScopeListForApplication(selected: any, applicationDictionary: any, env: string): Scope[] { - let application = applicationDictionary[selected.application]; - let scopes = flatMap(application.clusters, (cluster: any) => { + const application = applicationDictionary[selected.application]; + const scopes = flatMap(application.clusters, (cluster: any) => { return cluster.serverGroups.map((serverGroup: any) => { - let scope = new Scope(); + const scope = new Scope(); scope.appId = selected.application; scope.region = serverGroup.region; return scope; }); }); - let filteredScopes: Scope[] = uniqBy(scopes, 'region'); - let scopesWithImpactCount: Scope[] = filteredScopes.map((scope: Scope) => { - let app = applicationDictionary[selected.application]; + const filteredScopes: Scope[] = uniqBy(scopes, 'region'); + const scopesWithImpactCount: Scope[] = filteredScopes.map((scope: Scope) => { + const app = applicationDictionary[selected.application]; scope.instanceCounts = this.impactCountForApplication(scope, app, env); return scope; }); - let appOnlyScope = new Scope(); + const appOnlyScope = new Scope(); appOnlyScope.appId = selected.application; appOnlyScope.instanceCounts = this.impactCountForApplication(appOnlyScope, application, env); @@ -138,7 +138,7 @@ export class FastPropertyScopeCategoryService { }; public impactCountForApplication(scope: Scope, application: any, env: string): IImpactCounts { - let serverGroupInstanceCounts = application.clusters + const serverGroupInstanceCounts = application.clusters .map((cluster: any) => cluster.serverGroups) .reduce((acc: any[], serverGroupList: any[]) => { serverGroupList.forEach((serverGroup) => { @@ -165,8 +165,8 @@ export class FastPropertyScopeCategoryService { * Builds Cluster level fast property scope */ private buildScopeForCluster(selected: any, applicationDictionary: any, env: string): Scope[] { - let application = applicationDictionary[selected.application]; - let scope = new Scope(); + const application = applicationDictionary[selected.application]; + const scope = new Scope(); scope.appId = selected.application; scope.cluster = selected.cluster; scope.stack = selected.stack; @@ -175,7 +175,7 @@ export class FastPropertyScopeCategoryService { } public impactCountForCluster(scope: Scope, application: Application, env: string): IImpactCounts { - let foundCluster: any = application.clusters + const foundCluster: any = application.clusters .filter((cluster: any) => cluster.name === scope.cluster && this.scopeEnvMatchesAccount(env, cluster.account)) .shift(); @@ -187,8 +187,8 @@ export class FastPropertyScopeCategoryService { * Builds Server Group level fast property scope */ private buildScopeForServerGroup(selected: any, applicationDictionary: any, env: string): Scope[] { - let application = applicationDictionary[selected.application]; - let scope = new Scope(); + const application = applicationDictionary[selected.application]; + const scope = new Scope(); scope.appId = selected.application; scope.cluster = selected.cluster; scope.stack = selected.stack; @@ -199,7 +199,7 @@ export class FastPropertyScopeCategoryService { } public impactCountForServerGroup(scope: Scope, application: Application, env: string): IImpactCounts { - let foundCluster = application.clusters + const foundCluster = application.clusters .filter((cluster: any) => cluster.name === scope.cluster && this.scopeEnvMatchesAccount(env, cluster.account)) .shift(); @@ -218,8 +218,8 @@ export class FastPropertyScopeCategoryService { * Build Stack Group level fast property scope */ private buildScopeForStack(selected: any, applicationDictionary: any, env: string): Scope[] { - let application = applicationDictionary[selected.application]; - let scope = new Scope(); + const application = applicationDictionary[selected.application]; + const scope = new Scope(); scope.region = selected.region; scope.appId = selected.application; scope.stack = selected.stack || this.getStackFromClusterName(selected.cluster); @@ -228,7 +228,7 @@ export class FastPropertyScopeCategoryService { } public impactCountForStack(scope: Scope, application: Application, env: string): IImpactCounts { - let foundClustersWithStack = application.clusters + const foundClustersWithStack = application.clusters .filter((cluster: ICluster) => this.scopeEnvMatchesAccount(env, cluster.account) && this.getStackFromClusterName(cluster.name) === scope.stack); return foundClustersWithStack.reduce((acc: any, cluster: any) => { @@ -237,7 +237,7 @@ export class FastPropertyScopeCategoryService { } public getStackFromClusterName(clusterName: string ): string { - let nameStackDetails = clusterName.split('-'); + const nameStackDetails = clusterName.split('-'); return nameStackDetails.length > 1 ? nameStackDetails[1] : ''; } @@ -245,7 +245,7 @@ export class FastPropertyScopeCategoryService { * Builds Instance level fast property scope */ private buildScopeForInstance(selected: any): Scope[] { - let scope = new Scope(); + const scope = new Scope(); scope.appId = selected.application; scope.cluster = selected.cluster; scope.region = selected.region; @@ -287,7 +287,7 @@ export class FastPropertyScopeCategoryService { return application; }) .then((application: any) => { - let category = scope.getCategory(); + const category = scope.getCategory(); return this.impactCountFnByCategory[category](scope, application, scope.env); }); } diff --git a/app/scripts/modules/netflix/fastProperties/view/fastPropertyDetails.controller.ts b/app/scripts/modules/netflix/fastProperties/view/fastPropertyDetails.controller.ts index 910da719227..4b06ec56ac7 100644 --- a/app/scripts/modules/netflix/fastProperties/view/fastPropertyDetails.controller.ts +++ b/app/scripts/modules/netflix/fastProperties/view/fastPropertyDetails.controller.ts @@ -30,18 +30,18 @@ export class FastPropertyDetailsController { public extractEnvFromId(propertyId: string) { - let list = propertyId.split('|'); + const list = propertyId.split('|'); return list[2] || 'prod'; } public getProperty(environment?: string) { - let env = environment || this.extractEnvFromId(this.fastProperty.propertyId); + const env = environment || this.extractEnvFromId(this.fastProperty.propertyId); this.fastPropertyReader.getPropByIdAndEnv(this.fastProperty.propertyId, env) .then((results: any) => { this.property = results.property; }) .catch(() => { - let otherEnv = env === 'prod' ? 'test' : 'prod'; + const otherEnv = env === 'prod' ? 'test' : 'prod'; this.getProperty(otherEnv); }); } diff --git a/app/scripts/modules/netflix/fastProperties/view/fastPropertyFilterSearch.component.ts b/app/scripts/modules/netflix/fastProperties/view/fastPropertyFilterSearch.component.ts index 43a05a2e2cf..56fc46a87c1 100644 --- a/app/scripts/modules/netflix/fastProperties/view/fastPropertyFilterSearch.component.ts +++ b/app/scripts/modules/netflix/fastProperties/view/fastPropertyFilterSearch.component.ts @@ -74,8 +74,8 @@ class FastPropertyFilterSearchController implements IComponentController { public tagAndClearFilter(category: string, result: string): void { - let copy = this.filters.list.splice(0); - let tagBody = {label: category, value: result}; + const copy = this.filters.list.splice(0); + const tagBody = {label: category, value: result}; copy.push(this.createFilterTag(tagBody)); this.filters.list = uniqWith(copy, (a: any, b: any) => a.label === b.label && a.value === b.value); this.$element.find('input').val(''); @@ -98,7 +98,7 @@ class FastPropertyFilterSearchController implements IComponentController { public dispatchQueryInput(event: any) { if (this.showSearchResults) { - let code = event.which; + const code = event.which; if (code === 40) { // down return this.focusFirstSearchResult(event); @@ -176,7 +176,7 @@ class FastPropertyFilterSearchController implements IComponentController { private createFilterCategories(properties: IFastProperty[]) { this.categories = properties.reduce((acc: any, property: IFastProperty) => { - let scope: IFastPropertyScope = property.scope; + const scope: IFastPropertyScope = property.scope; acc = this.addToList(acc, 'key', property.key ); acc = this.addToList(acc, 'value', property.value); acc = this.addToList(acc, 'app', scope.app ); @@ -190,9 +190,9 @@ class FastPropertyFilterSearchController implements IComponentController { private addToList(acc: any[], scopeKey: string, scopeValue: string): any { if (scopeValue && scopeKey) { - let categoryIndex = findIndex(acc, ['category', scopeKey]); + const categoryIndex = findIndex(acc, ['category', scopeKey]); if (categoryIndex > -1) { - let categoryResults = acc[categoryIndex].results; + const categoryResults = acc[categoryIndex].results; if (categoryResults.indexOf(scopeValue) === -1) { categoryResults.push(scopeValue); } diff --git a/app/scripts/modules/netflix/fastProperties/wizard/cloneFastPropertyToNewScopeWizard.controller.ts b/app/scripts/modules/netflix/fastProperties/wizard/cloneFastPropertyToNewScopeWizard.controller.ts index 82337f1e01d..581415da93d 100644 --- a/app/scripts/modules/netflix/fastProperties/wizard/cloneFastPropertyToNewScopeWizard.controller.ts +++ b/app/scripts/modules/netflix/fastProperties/wizard/cloneFastPropertyToNewScopeWizard.controller.ts @@ -54,7 +54,7 @@ class CloneFastPropertyToNewScopeWizardController { } public startPipeline(pipeline: PropertyPipeline): void { - let submit = () => this.pipelineConfigService.startAdHocPipeline(pipeline); + const submit = () => this.pipelineConfigService.startAdHocPipeline(pipeline); this.propertyMonitor.submit(submit); } diff --git a/app/scripts/modules/netflix/fastProperties/wizard/createFastPropertyWizard.controller.ts b/app/scripts/modules/netflix/fastProperties/wizard/createFastPropertyWizard.controller.ts index cf163012073..ce1dab68813 100644 --- a/app/scripts/modules/netflix/fastProperties/wizard/createFastPropertyWizard.controller.ts +++ b/app/scripts/modules/netflix/fastProperties/wizard/createFastPropertyWizard.controller.ts @@ -48,7 +48,7 @@ class CreateFastPropertyWizardController { } public startPipeline(pipeline: PropertyPipeline): void { - let submit = () => this.pipelineConfigService.startAdHocPipeline(pipeline); + const submit = () => this.pipelineConfigService.startAdHocPipeline(pipeline); this.propertyMonitor.submit(submit); } diff --git a/app/scripts/modules/netflix/fastProperties/wizard/deleteFastPropertyWizard.controller.ts b/app/scripts/modules/netflix/fastProperties/wizard/deleteFastPropertyWizard.controller.ts index 6ec5341bddf..115eb6f06e3 100644 --- a/app/scripts/modules/netflix/fastProperties/wizard/deleteFastPropertyWizard.controller.ts +++ b/app/scripts/modules/netflix/fastProperties/wizard/deleteFastPropertyWizard.controller.ts @@ -59,7 +59,7 @@ class DeleteFastPropertyWizardController { } public startPipeline(pipeline: PropertyPipeline) { - let submit = () => this.pipelineConfigService.startAdHocPipeline(pipeline); + const submit = () => this.pipelineConfigService.startAdHocPipeline(pipeline); this.propertyMonitor.submit(submit); } diff --git a/app/scripts/modules/netflix/fastProperties/wizard/monitor/propertyMonitorService.ts b/app/scripts/modules/netflix/fastProperties/wizard/monitor/propertyMonitorService.ts index ac42708252d..80ff6e43191 100644 --- a/app/scripts/modules/netflix/fastProperties/wizard/monitor/propertyMonitorService.ts +++ b/app/scripts/modules/netflix/fastProperties/wizard/monitor/propertyMonitorService.ts @@ -6,7 +6,7 @@ export class PropertyMonitorService { public buildMonitor(params: any): any { - let monitor: any = { + const monitor: any = { submitting: false, pipeline: null, error: false, @@ -50,7 +50,7 @@ export class PropertyMonitorService { monitor.submit = function (method: any): void { monitor.startSubmit(); - let submit = monitor.submitMethod || method; + const submit = monitor.submitMethod || method; submit().then(monitor.handleTaskSuccess, monitor.setError); }; diff --git a/app/scripts/modules/netflix/fastProperties/wizard/propertyDetails/propertyDetails.component.spec.ts b/app/scripts/modules/netflix/fastProperties/wizard/propertyDetails/propertyDetails.component.spec.ts index 46fea2438b7..584d4d91d04 100644 --- a/app/scripts/modules/netflix/fastProperties/wizard/propertyDetails/propertyDetails.component.spec.ts +++ b/app/scripts/modules/netflix/fastProperties/wizard/propertyDetails/propertyDetails.component.spec.ts @@ -9,7 +9,7 @@ describe('propertyDetailsComponent test', function () { let $componentController: ng.IComponentControllerService, $ctrl: FastPropertyDetailsComponentController; - let initializeController = (data: any) => { + const initializeController = (data: any) => { $ctrl = $componentController( 'fastPropertyDetails', { $scope: null}, @@ -28,7 +28,7 @@ describe('propertyDetailsComponent test', function () { describe('FastPropertyDetailsComponentController', function () { it('constructor should handle missing property command', function () { - let data: {command: PropertyCommand, isEditing: boolean, isDeleting: boolean} = { + const data: {command: PropertyCommand, isEditing: boolean, isDeleting: boolean} = { command: null, isEditing: false, isDeleting: false, @@ -39,7 +39,7 @@ describe('propertyDetailsComponent test', function () { }); it('constructor should handle missing property on the PropertyCommand', function () { - let data: {command: PropertyCommand, isEditing: boolean, isDeleting: boolean} = { + const data: {command: PropertyCommand, isEditing: boolean, isDeleting: boolean} = { command: new PropertyCommand(), isEditing: false, isDeleting: false, @@ -50,7 +50,7 @@ describe('propertyDetailsComponent test', function () { }); it('command with property that has a propertyId should copy it to originalProperty field on the command', function () { - let data: {command: PropertyCommand, isEditing: boolean, isDeleting: boolean} = { + const data: {command: PropertyCommand, isEditing: boolean, isDeleting: boolean} = { command: new PropertyCommand(), isEditing: false, isDeleting: false, diff --git a/app/scripts/modules/netflix/fastProperties/wizard/propertyDetails/propertyDetails.component.ts b/app/scripts/modules/netflix/fastProperties/wizard/propertyDetails/propertyDetails.component.ts index 12a1c628633..df8ada0d9f5 100644 --- a/app/scripts/modules/netflix/fastProperties/wizard/propertyDetails/propertyDetails.component.ts +++ b/app/scripts/modules/netflix/fastProperties/wizard/propertyDetails/propertyDetails.component.ts @@ -20,7 +20,7 @@ export class FastPropertyDetailsComponentController implements IComponentControl this.command.originalProperty = Property.copy(this.command.property); } - let user: IUser = authenticationService.getAuthenticatedUser(); + const user: IUser = authenticationService.getAuthenticatedUser(); this.command.property.email = user.name; } diff --git a/app/scripts/modules/netflix/fastProperties/wizard/propertyPipelineBuilder.service.ts b/app/scripts/modules/netflix/fastProperties/wizard/propertyPipelineBuilder.service.ts index bc4d37ec66a..7c26a8812ee 100644 --- a/app/scripts/modules/netflix/fastProperties/wizard/propertyPipelineBuilder.service.ts +++ b/app/scripts/modules/netflix/fastProperties/wizard/propertyPipelineBuilder.service.ts @@ -26,14 +26,14 @@ export class PropertyPipelineBuilderService { private pipelineConfigService: PipelineConfigService) {} public build(command: PropertyCommand): IPromise { - let user: IUser = this.authenticationService.getAuthenticatedUser(); + const user: IUser = this.authenticationService.getAuthenticatedUser(); command.user = user; - let propertyStage: PropertyPipelineStage[] = this.buildPropertyStages(user, command); + const propertyStage: PropertyPipelineStage[] = this.buildPropertyStages(user, command); - let strategyStage: IStage = command.strategy.buildStage(user, command, last(propertyStage)); + const strategyStage: IStage = command.strategy.buildStage(user, command, last(propertyStage)); - let stages: IStage[] = flatten([propertyStage, strategyStage]).filter((stage) => !!stage); + const stages: IStage[] = flatten([propertyStage, strategyStage]).filter((stage) => !!stage); return this.getPipelineConfigId(command) .then((pipelineConfigId: string) => { @@ -46,7 +46,7 @@ export class PropertyPipelineBuilderService { } private createPropertyPipeline(stages: IStage[], pipelineConfigId: string, applicationName: string): PropertyPipeline { - let pipeline = new PropertyPipeline(pipelineConfigId); + const pipeline = new PropertyPipeline(pipelineConfigId); pipeline.keepWaitingPipelines = false; pipeline.lastModifiedBy = 'spinnaker'; pipeline.limitConcurrent = false; @@ -66,7 +66,7 @@ export class PropertyPipelineBuilderService { return this.findPipelineByNameForApplication(this.fastPropertyPipelineName, appId) .then((foundPipeline: IPipeline) => foundPipeline.id) .catch(() => { - let config: IPipeline = { + const config: IPipeline = { id: null, name: this.fastPropertyPipelineName, application: appId, @@ -92,7 +92,7 @@ export class PropertyPipelineBuilderService { private findPipelineByNameForApplication(pipelineName: string, appName: string) { return this.pipelineConfigService.getPipelinesForApplication(appName) .then((pipelines: IPipeline[]) => { - let foundPipeline = pipelines.find((pipeline: IPipeline) => pipeline.name === pipelineName); + const foundPipeline = pipelines.find((pipeline: IPipeline) => pipeline.name === pipelineName); return foundPipeline ? foundPipeline : this.$q.reject(`pipeline not found`); }); } diff --git a/app/scripts/modules/netflix/fastProperties/wizard/propertyScope/propertyScope.component.ts b/app/scripts/modules/netflix/fastProperties/wizard/propertyScope/propertyScope.component.ts index d96492d5ffd..47902e50be9 100644 --- a/app/scripts/modules/netflix/fastProperties/wizard/propertyScope/propertyScope.component.ts +++ b/app/scripts/modules/netflix/fastProperties/wizard/propertyScope/propertyScope.component.ts @@ -17,8 +17,8 @@ export class FastPropertyScopeComponentController implements IComponentControlle } public toggleEditScope(scopeIndex: number): void { - let scope: Scope = this.command.scopes[scopeIndex]; - let isEditing = scope.isEditing; + const scope: Scope = this.command.scopes[scopeIndex]; + const isEditing = scope.isEditing; scope.isEditing = !isEditing; } diff --git a/app/scripts/modules/netflix/fastProperties/wizard/updateFastPropertyWizard.controller.ts b/app/scripts/modules/netflix/fastProperties/wizard/updateFastPropertyWizard.controller.ts index 68604def5cb..0f6ce3fb5d2 100644 --- a/app/scripts/modules/netflix/fastProperties/wizard/updateFastPropertyWizard.controller.ts +++ b/app/scripts/modules/netflix/fastProperties/wizard/updateFastPropertyWizard.controller.ts @@ -64,7 +64,7 @@ class UpdateFastPropertyWizardController { } public startPipeline(pipeline: PropertyPipeline) { - let submit = () => this.pipelineConfigService.startAdHocPipeline(pipeline); + const submit = () => this.pipelineConfigService.startAdHocPipeline(pipeline); this.propertyMonitor.submit(submit); } diff --git a/app/scripts/modules/netflix/pipeline/stage/isolatedTestingTarget/isolatedTestingTargetStage.ts b/app/scripts/modules/netflix/pipeline/stage/isolatedTestingTarget/isolatedTestingTargetStage.ts index e1af53bcb6b..8b3678c9065 100644 --- a/app/scripts/modules/netflix/pipeline/stage/isolatedTestingTarget/isolatedTestingTargetStage.ts +++ b/app/scripts/modules/netflix/pipeline/stage/isolatedTestingTarget/isolatedTestingTargetStage.ts @@ -136,7 +136,7 @@ class IsolatedTestingTargetStageCtrl { this.stage.clusters = this.stage.clusters || []; this.stage.vipOverrides = this.stage.vipOverrides || {}; this.providerSelectionService.selectProvider(this.$scope.application).then((selectedProvider: string) => { - let config = this.cloudProviderRegistry.getValue(selectedProvider, 'serverGroup'); + const config = this.cloudProviderRegistry.getValue(selectedProvider, 'serverGroup'); this.$uibModal.open({ templateUrl: config.cloneServerGroupTemplateUrl, controller: `${config.cloneServerGroupController} as ctrl`, @@ -152,7 +152,7 @@ class IsolatedTestingTargetStageCtrl { public editCluster(cluster: any, index: number): void { cluster.provider = cluster.provider || 'aws'; - let config = this.cloudProviderRegistry.getValue(cluster.provider, 'serverGroup'); + const config = this.cloudProviderRegistry.getValue(cluster.provider, 'serverGroup'); this.$uibModal.open({ templateUrl: config.cloneServerGroupTemplateUrl, controller: `${config.cloneServerGroupController} as ctrl`, diff --git a/app/scripts/modules/titus/migration/titusMigrationConfigurer.component.ts b/app/scripts/modules/titus/migration/titusMigrationConfigurer.component.ts index 45b0c29c58d..8eaf0897b98 100644 --- a/app/scripts/modules/titus/migration/titusMigrationConfigurer.component.ts +++ b/app/scripts/modules/titus/migration/titusMigrationConfigurer.component.ts @@ -63,7 +63,7 @@ class TitusMigrationConfigurerController implements ng.IComponentController { this.config.config = new RollingPushStrategy(); } if (this.config.type === PipelineStrategy.type) { - let newConfig = new PipelineStrategy(); + const newConfig = new PipelineStrategy(); newConfig.application = this.application.name; this.config.config = newConfig; this.applicationSelected(newConfig); diff --git a/app/scripts/modules/titus/securityGroup/securityGroupPicker.component.ts b/app/scripts/modules/titus/securityGroup/securityGroupPicker.component.ts index f764a7e2e31..362904a572d 100644 --- a/app/scripts/modules/titus/securityGroup/securityGroupPicker.component.ts +++ b/app/scripts/modules/titus/securityGroup/securityGroupPicker.component.ts @@ -35,13 +35,13 @@ class SecurityGroupPickerController implements ng.IComponentController { private vpcReader: any) {} public $onInit(): void { - let credentialLoader: ng.IPromise = this.accountService.getCredentialsKeyedByAccount('titus').then((credentials: IAggregatedAccounts) => { + const credentialLoader: ng.IPromise = this.accountService.getCredentialsKeyedByAccount('titus').then((credentials: IAggregatedAccounts) => { this.credentials = credentials; }); - let groupLoader: ng.IPromise = this.securityGroupReader.getAllSecurityGroups().then((groups: any[]) => { + const groupLoader: ng.IPromise = this.securityGroupReader.getAllSecurityGroups().then((groups: any[]) => { this.securityGroups = groups; }); - let vpcLoader: ng.IPromise = this.vpcReader.listVpcs().then((vpcs: IVpc[]) => this.vpcs = vpcs); + const vpcLoader: ng.IPromise = this.vpcReader.listVpcs().then((vpcs: IVpc[]) => this.vpcs = vpcs); this.$q.all([credentialLoader, groupLoader, vpcLoader]).then(() => this.configureSecurityGroupOptions()); this.subscriptions = [ this.accountChanged.subscribe(() => this.configureSecurityGroupOptions()), @@ -66,8 +66,8 @@ class SecurityGroupPickerController implements ng.IComponentController { } private getVpcId(): string { - let credentials = this.getCredentials(); - let match = this.vpcs.find(vpc => + const credentials = this.getCredentials(); + const match = this.vpcs.find(vpc => vpc.name === credentials.awsVpc && vpc.account === credentials.awsAccount && vpc.region === this.getRegion() @@ -77,7 +77,7 @@ class SecurityGroupPickerController implements ng.IComponentController { } private getRegionalSecurityGroups(): ISecurityGroup[] { - let newSecurityGroups: any = this.securityGroups[this.getAwsAccount()] || { aws: {}}; + const newSecurityGroups: any = this.securityGroups[this.getAwsAccount()] || { aws: {}}; return _.chain(newSecurityGroups.aws[this.getRegion()]) .filter({vpcId: this.getVpcId()}) .sortBy('name') @@ -96,22 +96,22 @@ class SecurityGroupPickerController implements ng.IComponentController { } private configureSecurityGroupOptions(): void { - let currentOptions = this.availableGroups; - let newRegionalSecurityGroups = this.getRegionalSecurityGroups(); + const currentOptions = this.availableGroups; + const newRegionalSecurityGroups = this.getRegionalSecurityGroups(); if (currentOptions && this.groupsToEdit) { // not initializing - we are actually changing groups - let currentGroupNames: string[] = this.groupsToEdit.map((groupId: string) => { - let match = currentOptions.find(o => o.id === groupId); + const currentGroupNames: string[] = this.groupsToEdit.map((groupId: string) => { + const match = currentOptions.find(o => o.id === groupId); return match ? match.name : groupId; }); - let matchedGroups: ISecurityGroup[] = this.groupsToEdit.map((groupId: string) => { - let securityGroup: any = currentOptions.find(o => o.id === groupId || o.name === groupId); + const matchedGroups: ISecurityGroup[] = this.groupsToEdit.map((groupId: string) => { + const securityGroup: any = currentOptions.find(o => o.id === groupId || o.name === groupId); return securityGroup ? securityGroup.name : null; }).map((groupName: string) => newRegionalSecurityGroups.find(g => g.name === groupName)).filter((group: any) => group); - let matchedGroupNames: string[] = matchedGroups.map(g => g.name); - let removed: string[] = _.xor(currentGroupNames, matchedGroupNames); + const matchedGroupNames: string[] = matchedGroups.map(g => g.name); + const removed: string[] = _.xor(currentGroupNames, matchedGroupNames); this.groupsToEdit = matchedGroups.map(g => g.id); if (removed.length) { this.removedGroups.length = 0; diff --git a/app/scripts/modules/titus/validation/applicationName.validator.ts b/app/scripts/modules/titus/validation/applicationName.validator.ts index f6d59ae7527..e231ff58b11 100644 --- a/app/scripts/modules/titus/validation/applicationName.validator.ts +++ b/app/scripts/modules/titus/validation/applicationName.validator.ts @@ -6,7 +6,7 @@ import { class TitusApplicationNameValidator implements IApplicationNameValidator { private validateSpecialCharacters(name: string, errors: string[]): void { - let pattern = /^[a-zA-Z_0-9.]*$/g; + const pattern = /^[a-zA-Z_0-9.]*$/g; if (!pattern.test(name)) { errors.push('Only dot(.) and underscore(_) special characters are allowed.'); } @@ -21,7 +21,7 @@ class TitusApplicationNameValidator implements IApplicationNameValidator { if (name.length >= 248) { warnings.push('You will not be able to include a stack or detail field for clusters or security groups.'); } else { - let remaining = 248 - name.length; + const remaining = 248 - name.length; warnings.push(`If you plan to include a stack or detail field for clusters, you will only have ~${remaining} characters to do so.`); } diff --git a/tslint.json b/tslint.json index a0fc2683573..70f1f67f168 100644 --- a/tslint.json +++ b/tslint.json @@ -56,6 +56,12 @@ "check-open-brace", "check-whitespace" ], + "prefer-const": [ + true, + { + "destructuring": "all" + } + ], "quotemark": [ true, "single",