From 2fce7a1c35d45544966675db96ae6df4d97f7eff Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Fri, 3 Sep 2010 10:33:15 -0700 Subject: [PATCH] new UI - instances tab - implement change group action. --- ui/jsp/tab_storage.jsp | 4 +-- ui/new/jsp/tab_instance.jsp | 20 +++++++++++++ ui/new/scripts/cloud.core.instance.js | 42 +++++++++++++++++++++++++-- 3 files changed, 61 insertions(+), 5 deletions(-) diff --git a/ui/jsp/tab_storage.jsp b/ui/jsp/tab_storage.jsp index 92f6b5ae5fb..aaab49adb19 100755 --- a/ui/jsp/tab_storage.jsp +++ b/ui/jsp/tab_storage.jsp @@ -615,7 +615,7 @@ long milliseconds = new Date().getTime();
Name
-
+
Type
@@ -707,7 +707,7 @@ long milliseconds = new Date().getTime();
Name
-
+
Type
diff --git a/ui/new/jsp/tab_instance.jsp b/ui/new/jsp/tab_instance.jsp index 7d12d1a7542..5eb22150ba5 100644 --- a/ui/new/jsp/tab_instance.jsp +++ b/ui/new/jsp/tab_instance.jsp @@ -676,4 +676,24 @@
+ + + + \ No newline at end of file diff --git a/ui/new/scripts/cloud.core.instance.js b/ui/new/scripts/cloud.core.instance.js index c4d59a654b0..1de7e8eb0d1 100755 --- a/ui/new/scripts/cloud.core.instance.js +++ b/ui/new/scripts/cloud.core.instance.js @@ -79,7 +79,12 @@ function clickInstanceGroupHeader($arrowIcon) { asyncJobResponse: "changeserviceforvirtualmachineresponse", dialogBeforeActionFn : doChangeService, afterActionSeccessFn: setMidmenuItemVm - } + }, + "Change Group": { + isAsyncJob: false, + dialogBeforeActionFn : doChangeGroup, + afterActionSeccessFn: setMidmenuItemVm + } } function doAttachISO($t, selectedItemIds, listAPIMap) { @@ -231,8 +236,33 @@ function clickInstanceGroupHeader($arrowIcon) { $(this).dialog("close"); } }).dialog("open"); - } - + } + + function doChangeGroup($t, selectedItemIds, listAPIMap) { + $("#dialog_change_group") + .dialog('option', 'buttons', { + "Confirm": function() { + var thisDialog = $(this); + thisDialog.dialog("close"); + + // validate values + var isValid = true; + isValid &= validateString("Group", thisDialog.find("#change_group_name"), thisDialog.find("#change_group_name_errormsg"), true); //group name is optional + if (!isValid) return; + + for(var id in selectedItemIds) { + var $midMenuItem = selectedItemIds[id]; + var jsonObj = $midMenuItem.data("jsonObj"); + var group = trim(thisDialog.find("#change_group_name").val()); + var apiCommand = "command=updateVirtualMachine&id="+id+"&group="+encodeURIComponent(group); + doAction(id, $t, apiCommand, listAPIMap); + } + }, + "Cancel": function() { + $(this).dialog("close"); + } + }).dialog("open"); + } function updateVirtualMachineStateInRightPanel(state) { if(state == "Running") @@ -447,6 +477,12 @@ function clickInstanceGroupHeader($arrowIcon) { zIndex: 2000 })); + activateDialog($("#dialog_change_group").dialog({ + autoOpen: false, + modal: true, + zIndex: 2000 + })); + //***** VM Wizard (begin) ****************************************************************************** $vmPopup = $("#vm_popup"); var $serviceOfferingTemplate = $("#vm_popup_service_offering_template");