From 39f03cf7c661cfdf503aed7fa7b0fd0350b5401d Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Tue, 20 Dec 2011 17:08:16 -0800 Subject: [PATCH] cloudstack 3.0 new UI - instance page - change service - check if instance state is Stopped before proceeding to action. --- ui/scripts/instances.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js index 76d47106c21..69467178f8b 100644 --- a/ui/scripts/instances.js +++ b/ui/scripts/instances.js @@ -1105,6 +1105,7 @@ cloudStack.dialog.notice({ message: 'Your instance must be stopped before attempting to change its current password' }); return false; } + return true; }, action: function(args) { @@ -1174,6 +1175,16 @@ } } }, + + preAction: function(args) { + var jsonObj = args.context.instances[0]; + if (jsonObj.state != 'Stopped') { + cloudStack.dialog.notice({ message: 'Your instance must be stopped before attempting to change its current service offering.' }); + return false; + } + return true; + }, + action: function(args) { $.ajax({ url: createURL("changeServiceForVirtualMachine&id=" + args.context.instances[0].id + "&serviceOfferingId=" + args.data.serviceOffering),