Skip to content

Commit

Permalink
feat(provider/ecs): Added DisableCluster stage (#4398)
Browse files Browse the repository at this point in the history
* feat(provider/ecs): Added DisableCluster stage

* removed executionConfigSections from ecs stage
  • Loading branch information
BrunoCarrier authored and Justin Reynolds committed Nov 15, 2017
1 parent b65ebd4 commit 1bdd4ea
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 0 deletions.
@@ -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>
@@ -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();
});

0 comments on commit 1bdd4ea

Please sign in to comment.