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();
-
-
+
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 @@
+
+
+
+
+
+ Please specify the new group you want to assign to your Virtual Instance. If no such group exists, a new one will be created
+ for you.
+
\ 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");