From 65eb3202c281cf75b9825387058343b9535729eb Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Wed, 5 Oct 2016 18:21:51 +0530 Subject: [PATCH] CLOUDSTACK-9534: Allow VR to be destroy in UI when in running state This allows admins/users to destroy a VR that is in running state from the UI. This action is possible via cloudmonkey/APIs. Signed-off-by: Rohit Yadav --- ui/scripts/system.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/ui/scripts/system.js b/ui/scripts/system.js index faa388c17c4..7e4200a2e73 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -2585,6 +2585,11 @@ label: 'label.destroy.router', messages: { confirm: function (args) { + if (args && args.context && args.context.routers[0]) { + if (args.context.routers[0].state == 'Running') { + return dictionary['message.action.stop.router'] + ' ' + dictionary['message.confirm.destroy.router']; + } + } return 'message.confirm.destroy.router'; }, notification: function (args) { @@ -3752,6 +3757,11 @@ label: 'label.destroy.router', messages: { confirm: function (args) { + if (args && args.context && args.context.routers[0]) { + if (args.context.routers[0].state == 'Running') { + return dictionary['message.action.stop.router'] + ' ' + dictionary['message.confirm.destroy.router']; + } + } return 'message.confirm.destroy.router'; }, notification: function (args) { @@ -6674,6 +6684,11 @@ label: 'label.destroy.router', messages: { confirm: function (args) { + if (args && args.context && args.context.routers[0]) { + if (args.context.routers[0].state == 'Running') { + return dictionary['message.action.stop.router'] + ' ' + dictionary['message.confirm.destroy.router']; + } + } return 'message.confirm.destroy.router'; }, notification: function (args) { @@ -9830,6 +9845,11 @@ label: 'label.destroy.router', messages: { confirm: function (args) { + if (args && args.context && args.context.routers[0]) { + if (args.context.routers[0].state == 'Running') { + return dictionary['message.action.stop.router'] + ' ' + dictionary['message.confirm.destroy.router']; + } + } return 'message.confirm.destroy.router'; }, notification: function (args) { @@ -20986,8 +21006,9 @@ } allowedActions.push("restart"); - + allowedActions.push("remove"); allowedActions.push("viewConsole"); + if (isAdmin()) allowedActions.push("migrate"); } else if (jsonObj.state == 'Stopped') {