Skip to content

Commit

Permalink
Confirmation prompt for stop/restart app
Browse files Browse the repository at this point in the history
Signed-off-by: Carlo Alberto Ferraris <[email protected]>
  • Loading branch information
Carlo Alberto Ferraris committed Jan 18, 2018
1 parent a569643 commit dc3fda0
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 4 deletions.
20 changes: 20 additions & 0 deletions components/cloud-foundry/frontend/i18n/en_US/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,26 @@
"start": "Start",
"cli": "CLI Info"
},
"restart-app": {
"title": "Restart Application",
"description": "Are you sure you want to restart application {{app}}?",
"error-message": "There was a problem restarting this application. Please try again. If this error persists, please contact the Administrator.",
"button": {
"yes": "Restart",
"no": "@:buttons.cancel"
},
"success": "Application {{app}} successfully restarted"
},
"stop-app": {
"title": "Stop Application",
"description": "Are you sure you want to stop application {{app}}?",
"error-message": "There was a problem stopping this application. Please try again. If this error persists, please contact the Administrator.",
"button": {
"yes": "Stop",
"no": "@:buttons.cancel"
},
"success": "Application {{app}} successfully stopped"
},
"edit-app": {
"edit-app": "Edit App",
"ssh-access": "Enable SSH Access",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -798,8 +798,8 @@
*/
function restartApp(cnsiGuid, guid) {

stopApp(cnsiGuid, guid).then(function () {
startApp(cnsiGuid, guid);
return stopApp(cnsiGuid, guid).then(function () {
return startApp(cnsiGuid, guid);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,24 @@
name: 'app.app-info.app-actions.stop',
id: 'stop',
execute: function () {
vm.model.stopApp(cnsiGuid, vm.id);
var appName = vm.model.application.summary.name;
frameworkDialogConfirm({
title: 'app.app-info.stop-app.title',
description: $translate.instant('app.app-info.stop-app.description', { app: appName }),
errorMessage: 'app.app-info.stop-app.error-message',
submitCommit: true,
buttonText: {
yes: 'app.app-info.stop-app.button.yes',
no: 'app.app-info.stop-app.button.no'
},
callback: function () {
return vm.model.stopApp(cnsiGuid, vm.id)
.then(function () {
var message = $translate.instant('app.app-info.stop-app.success', { app: appName });
appEventService.$emit('events.NOTIFY_SUCCESS', {message: message});
});
}
});
},
disabled: true,
icon: 'stop'
Expand All @@ -110,7 +127,24 @@
name: 'app.app-info.app-actions.restart',
id: 'restart',
execute: function () {
vm.model.restartApp(cnsiGuid, vm.id);
var appName = vm.model.application.summary.name;
frameworkDialogConfirm({
title: 'app.app-info.restart-app.title',
description: $translate.instant('app.app-info.restart-app.description', { app: appName }),
errorMessage: 'app.app-info.restart-app.error-message',
submitCommit: true,
buttonText: {
yes: 'app.app-info.restart-app.button.yes',
no: 'app.app-info.restart-app.button.no'
},
callback: function () {
return vm.model.restartApp(cnsiGuid, vm.id)
.then(function () {
var message = $translate.instant('app.app-info.restart-app.success', { app: appName });
appEventService.$emit('events.NOTIFY_SUCCESS', {message: message});
});
}
});
},
disabled: true,
icon: 'settings_backup_restore'
Expand Down

0 comments on commit dc3fda0

Please sign in to comment.