Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(provider/ecs): Added DisableCluster stage (#4398)
* feat(provider/ecs): Added DisableCluster stage * removed executionConfigSections from ecs stage
- Loading branch information
1 parent
b65ebd4
commit 1bdd4ea
Showing
2 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
app/scripts/modules/ecs/pipeline/stages/disableCluster/disableClusterStage.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<div ng-controller="ecsDisableClusterStageCtrl as disableClusterStageCtrl" class="form-horizontal"> | ||
<div ng-if="!pipeline.strategy"> | ||
<account-region-cluster-selector | ||
application="application" | ||
component="stage" | ||
accounts="accounts" > | ||
</account-region-cluster-selector> | ||
</div> | ||
<stage-config-field label="Disable Options"> | ||
<div class="form-inline"> | ||
Keep the | ||
<input type="number" min="0" required ng-model="stage.remainingEnabledServerGroups" | ||
class="form-control input-sm" style="width: 50px" /> | ||
<select class="form-control input-sm" | ||
ng-model="stage.preferLargerOverNewer" style="width: 100px"> | ||
<option value="true">largest</option> | ||
<option value="false">newest</option> | ||
</select> | ||
{{disableClusterStageCtrl.pluralize('server group', stage.remainingEnabledServerGroups)}} enabled. | ||
</div> | ||
</stage-config-field> | ||
<stage-platform-health-override application="application" | ||
stage="stage" | ||
platform-health-type="'Ecs'"> | ||
</stage-platform-health-override> | ||
</div> |
69 changes: 69 additions & 0 deletions
69
app/scripts/modules/ecs/pipeline/stages/disableCluster/ecsDisableClusterStage.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
'use strict'; | ||
|
||
const angular = require('angular'); | ||
|
||
module.exports = angular.module('spinnaker.ecs.pipeline.stage.disableClusterStage', [ | ||
]) | ||
.config(function(pipelineConfigProvider) { | ||
pipelineConfigProvider.registerStage({ | ||
provides: 'disableCluster', | ||
cloudProvider: 'ecs', | ||
templateUrl: require('./disableClusterStage.html'), | ||
validators: [ | ||
{ type: 'requiredField', fieldName: 'cluster' }, | ||
{ type: 'requiredField', fieldName: 'remainingEnabledServerGroups', fieldLabel: 'Keep [X] enabled Server Groups'}, | ||
{ type: 'requiredField', fieldName: 'regions', }, | ||
{ type: 'requiredField', fieldName: 'credentials', fieldLabel: 'account'}, | ||
], | ||
}); | ||
}).controller('ecsDisableClusterStageCtrl', function($scope, accountService) { | ||
var ctrl = this; | ||
|
||
let stage = $scope.stage; | ||
|
||
$scope.state = { | ||
accounts: false, | ||
regionsLoaded: false | ||
}; | ||
|
||
accountService.listAccounts('ecs').then(function (accounts) { | ||
$scope.accounts = accounts; | ||
$scope.state.accounts = true; | ||
}); | ||
|
||
ctrl.reset = () => { | ||
ctrl.accountUpdated(); | ||
ctrl.resetSelectedCluster(); | ||
}; | ||
|
||
stage.regions = stage.regions || []; | ||
stage.cloudProvider = 'ecs'; | ||
|
||
if (stage.isNew && $scope.application.attributes.platformHealthOnlyShowOverride && $scope.application.attributes.platformHealthOnly) { | ||
stage.interestingHealthProviderNames = ['Ecs']; | ||
} | ||
|
||
if (!stage.credentials && $scope.application.defaultCredentials.ecs) { | ||
stage.credentials = $scope.application.defaultCredentials.ecs; | ||
} | ||
if (!stage.regions.length && $scope.application.defaultRegions.ecs) { | ||
stage.regions.push($scope.application.defaultRegions.ecs); | ||
} | ||
|
||
if (stage.remainingEnabledServerGroups === undefined) { | ||
stage.remainingEnabledServerGroups = 1; | ||
} | ||
|
||
ctrl.pluralize = function(str, val) { | ||
if (val === 1) { | ||
return str; | ||
} | ||
return str + 's'; | ||
}; | ||
|
||
if (stage.preferLargerOverNewer === undefined) { | ||
stage.preferLargerOverNewer = 'false'; | ||
} | ||
stage.preferLargerOverNewer = stage.preferLargerOverNewer.toString(); | ||
}); | ||
|