Skip to content

Commit

Permalink
feat(aws): offer rollback when user enables an older server group (#5109
Browse files Browse the repository at this point in the history
)
  • Loading branch information
anotherchrisberry committed Apr 4, 2018
1 parent b600f57 commit 555e746
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,30 @@ export class AmazonServerGroupActions extends React.Component<IAmazonServerGroup
}

private enableServerGroup(): void {
if (!this.isRollbackEnabled()) {
this.showEnableServerGroupModal();
return;
}

const confirmationModalParams = {
header: 'Rolling back?',
body: `Spinnaker provides an orchestrated rollback feature to carefully restore a different version of this
server group. Do you want to use the orchestrated rollback?`,
buttonText: `Yes, let's start the orchestrated rollback`,
cancelButtonText: 'No, I just want to enable the server group',
};

ReactInjector.confirmationModalService.confirm(confirmationModalParams)
.then(() => this.rollbackServerGroup())
.catch(({ source }) => {
// don't show the enable modal if the user cancels with the header button
if (source === 'footer') {
this.showEnableServerGroupModal();
}
});
};

private showEnableServerGroupModal(): void {
const { app, serverGroup } = this.props;

const taskMonitor = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<form role="form" class="container-fluid no-padding" ng-submit="ctrl.confirm()">
<task-monitor monitor="taskMonitor"></task-monitor>
<multi-task-monitor ng-if="taskMonitors.length" monitors="taskMonitors" title="params.multiTaskTitle" close-modal="ctrl.cancel()"></multi-task-monitor>
<modal-close dismiss="$dismiss()"></modal-close>
<modal-close dismiss="$dismiss({source: 'header'})"></modal-close>
<div class="modal-header">
<h3>{{params.header}}</h3>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ module.exports = angular
}
};

this.cancel = $uibModalInstance.dismiss;
this.cancel = () => $uibModalInstance.dismiss({ source: 'footer'});
});
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,31 @@ module.exports = angular.module('spinnaker.serverGroup.details.titus.controller'
confirmationModalService.confirm(confirmationModalParams);
};

this.enableServerGroup = function enableServerGroup() {
this.enableServerGroup = () => {
if (!this.isRollbackEnabled()) {
this.showEnableServerGroupModal();
return;
}

const confirmationModalParams = {
header: 'Rolling back?',
body: `Spinnaker provides an orchestrated rollback feature to carefully restore a different version of this
server group. Do you want to use the orchestrated rollback?`,
buttonText: `Yes, let's start the orchestrated rollback`,
cancelButtonText: 'No, I just want to enable the server group',
};

confirmationModalService.confirm(confirmationModalParams)
.then(() => this.rollbackServerGroup())
.catch(({ source }) => {
// don't show the enable modal if the user cancels with the header button
if (source === 'footer') {
this.showEnableServerGroupModal();
}
});
};

this.showEnableServerGroupModal = () => {
var serverGroup = $scope.serverGroup;

var taskMonitor = {
Expand Down

0 comments on commit 555e746

Please sign in to comment.