diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties
index 6462bcab514..592c6c93297 100644
--- a/client/WEB-INF/classes/resources/messages.properties
+++ b/client/WEB-INF/classes/resources/messages.properties
@@ -12,18 +12,24 @@ label.PING.CIFS.password=PING CIFS password
label.CPU.cap=CPU Cap
label.action.enable.zone=Enable Zone
+label.action.enable.zone.processing=Enabling Zone....
message.action.enable.zone=Please confirm that you want to enable this zone.
label.action.disable.zone=Disable Zone
+label.action.disable.zone.processing=Disabling Zone....
message.action.disable.zone=Please confirm that you want to disable this zone.
label.action.enable.pod=Enable Pod
+label.action.enable.pod.processing=Enabling Pod....
message.action.enable.pod=Please confirm that you want to enable this pod.
label.action.disable.pod=Disable Pod
-message.action.disable.pod=Please confirm that you want to diable this pod.
+label.action.disable.pod.processing=Disabling Pod....
+message.action.disable.pod=Please confirm that you want to disable this pod.
label.action.enable.cluster=Enable Cluster
+label.action.enable.cluster.processing=Enabling Cluster....
message.action.enable.cluster=Please confirm that you want to enable this cluster.
label.action.disable.cluster=Disable Cluster
+label.action.disable.cluster.processing=Disabling Cluster....
message.action.disable.cluster=Please confirm that you want to disable this cluster.
diff --git a/ui/jsp/pod.jsp b/ui/jsp/pod.jsp
index d35f527b79c..0049e38c322 100644
--- a/ui/jsp/pod.jsp
+++ b/ui/jsp/pod.jsp
@@ -10,7 +10,13 @@ dictionary = {
'label.action.edit.pod' : '',
'label.action.delete.pod' : '',
'label.action.delete.pod.processing' : '',
- 'message.action.delete.pod' : ''
+ 'message.action.delete.pod' : '',
+ 'label.action.enable.pod' : '',
+ 'label.action.enable.pod.processing' : '',
+ 'message.action.enable.pod' : '',
+ 'label.action.disable.pod' : '',
+ 'label.action.disable.pod.processing' : '',
+ 'message.action.disable.pod' : ''
};
diff --git a/ui/scripts/cloud.core.pod.js b/ui/scripts/cloud.core.pod.js
index 6b1001ad3e0..3a302319870 100644
--- a/ui/scripts/cloud.core.pod.js
+++ b/ui/scripts/cloud.core.pod.js
@@ -79,41 +79,6 @@ function podJsonToDetailsTab() {
podClearDetailsTab();
return;
}
-
- $.ajax({
- data: createURL("command=listPods&id="+jsonObj.id),
- dataType: "json",
- async: false,
- success: function(json) {
- var items = json.listpodsresponse.pod;
- if(items != null && items.length > 0) {
- jsonObj = items[0];
- $leftmenuItem1.data("jsonObj", jsonObj);
- }
- }
- });
-
- var $thisTab = $("#right_panel_content #tab_content_details");
- $thisTab.find("#tab_container").hide();
- $thisTab.find("#tab_spinning_wheel").show();
-
- $thisTab.find("#id").text(fromdb(jsonObj.id));
- $thisTab.find("#grid_header_title").text(fromdb(jsonObj.name));
-
- $thisTab.find("#name").text(fromdb(jsonObj.name));
- $thisTab.find("#name_edit").val(fromdb(jsonObj.name));
-
- $thisTab.find("#netmask").text(fromdb(jsonObj.netmask));
- $thisTab.find("#netmask_edit").val(fromdb(jsonObj.netmask));
-
- $thisTab.find("#ipRange").text(getIpRange(jsonObj.startip, jsonObj.endip));
- $thisTab.find("#startIpRange_edit").val(fromdb(jsonObj.startip));
- $thisTab.find("#endIpRange_edit").val(fromdb(jsonObj.endip));
-
- $thisTab.find("#gateway").text(fromdb(jsonObj.gateway));
- $thisTab.find("#gateway_edit").val(fromdb(jsonObj.gateway));
-
- $thisTab.find("#allocationstate").text(fromdb(jsonObj.allocationstate));
// hide network tab upon zone vlan
var networkType;
@@ -137,20 +102,66 @@ function podJsonToDetailsTab() {
$("#tab_ipallocation, #add_iprange_button, #add_network_device_button").hide();
$("#midmenu_add_directIpRange_button").unbind("click").hide();
}
+
+ $.ajax({
+ data: createURL("command=listPods&id="+jsonObj.id),
+ dataType: "json",
+ async: false,
+ success: function(json) {
+ var items = json.listpodsresponse.pod;
+ if(items != null && items.length > 0) {
+ jsonObj = items[0];
+ $leftmenuItem1.data("jsonObj", jsonObj);
+ }
+ }
+ });
+ podJsonToDetailsTab2(jsonObj);
+}
+
+function podJsonToDetailsTab2(jsonObj) {
+ var $leftmenuItem1 = $("#right_panel_content").data("$leftmenuItem1");
+
+ var $thisTab = $("#right_panel_content #tab_content_details");
+ $thisTab.find("#tab_container").hide();
+ $thisTab.find("#tab_spinning_wheel").show();
+
+ $thisTab.find("#id").text(fromdb(jsonObj.id));
+ $thisTab.find("#grid_header_title").text(fromdb(jsonObj.name));
- //actions ***
+ $thisTab.find("#name").text(fromdb(jsonObj.name));
+ $thisTab.find("#name_edit").val(fromdb(jsonObj.name));
+
+ $thisTab.find("#netmask").text(fromdb(jsonObj.netmask));
+ $thisTab.find("#netmask_edit").val(fromdb(jsonObj.netmask));
+
+ $thisTab.find("#ipRange").text(getIpRange(jsonObj.startip, jsonObj.endip));
+ $thisTab.find("#startIpRange_edit").val(fromdb(jsonObj.startip));
+ $thisTab.find("#endIpRange_edit").val(fromdb(jsonObj.endip));
+
+ $thisTab.find("#gateway").text(fromdb(jsonObj.gateway));
+ $thisTab.find("#gateway_edit").val(fromdb(jsonObj.gateway));
+
+ $thisTab.find("#allocationstate").text(fromdb(jsonObj.allocationstate));
+
+ //actions ***
var $actionLink = $thisTab.find("#action_link");
bindActionLink($actionLink);
-
- var $actionMenu = $actionLink.find("#action_menu");
- $actionMenu.find("#action_list").empty();
- buildActionLinkForTab("label.action.edit.pod", podActionMap, $actionMenu, $leftmenuItem1, $thisTab);
+
+ var $actionMenu = $actionLink.find("#action_menu");
+ $actionMenu.find("#action_list").empty();
+ buildActionLinkForTab("label.action.edit.pod", podActionMap, $actionMenu, $leftmenuItem1, $thisTab);
+
+ if(jsonObj.allocationstate == "Disabled")
+ buildActionLinkForTab("label.action.enable.pod", podActionMap, $actionMenu, $leftmenuItem1, $thisTab);
+ else if(jsonObj.allocationstate == "Enabled")
+ buildActionLinkForTab("label.action.disable.pod", podActionMap, $actionMenu, $leftmenuItem1, $thisTab);
+
buildActionLinkForTab("label.action.delete.pod", podActionMap, $actionMenu, $leftmenuItem1, $thisTab);
- $thisTab.find("#tab_spinning_wheel").hide();
- $thisTab.find("#tab_container").show();
-}
+ $thisTab.find("#tab_spinning_wheel").hide();
+ $thisTab.find("#tab_container").show();
+}
function podJsonToNetworkTab() {
var $leftmenuItem1 = $("#right_panel_content").data("$leftmenuItem1");
@@ -1089,7 +1100,27 @@ function iscsiURL(server, iqn, lun) {
var podActionMap = {
"label.action.edit.pod": {
dialogBeforeActionFn: doEditPod
- },
+ },
+ "label.action.enable.pod": {
+ isAsyncJob: false,
+ dialogBeforeActionFn : doEnablePod,
+ inProcessText: "label.action.enable.pod.processing",
+ afterActionSeccessFn: function(json, $midmenuItem1, id) {
+ var jsonObj = json.updatepodresponse.pod;
+ podJsonToDetailsTab2(jsonObj);
+ }
+ }
+ ,
+ "label.action.disable.pod": {
+ isAsyncJob: false,
+ dialogBeforeActionFn : doDisablePod,
+ inProcessText: "label.action.disable.pod.processing",
+ afterActionSeccessFn: function(json, $midmenuItem1, id) {
+ var jsonObj = json.updatepodresponse.pod;
+ podJsonToDetailsTab2(jsonObj);
+ }
+ }
+ ,
"label.action.delete.pod": {
isAsyncJob: false,
dialogBeforeActionFn : doDeletePod,
@@ -1187,6 +1218,42 @@ function doEditPod2($actionLink, $detailsTab, $midmenuItem1, $readonlyFields, $e
}
}
+function doEnablePod($actionLink, $detailsTab, $midmenuItem1) {
+ var jsonObj = $midmenuItem1.data("jsonObj");
+ var id = jsonObj.id;
+
+ $("#dialog_confirmation")
+ .text(dictionary["message.action.enable.pod"])
+ .dialog('option', 'buttons', {
+ "Confirm": function() {
+ $(this).dialog("close");
+ var apiCommand = "command=updatePod&id="+id+"&allocationstate=Enabled";
+ doActionToTab(id, $actionLink, apiCommand, $midmenuItem1, $detailsTab);
+ },
+ "Cancel": function() {
+ $(this).dialog("close");
+ }
+ }).dialog("open");
+}
+
+function doDisablePod($actionLink, $detailsTab, $midmenuItem1) {
+ var jsonObj = $midmenuItem1.data("jsonObj");
+ var id = jsonObj.id;
+
+ $("#dialog_confirmation")
+ .text(dictionary["message.action.disable.pod"])
+ .dialog('option', 'buttons', {
+ "Confirm": function() {
+ $(this).dialog("close");
+ var apiCommand = "command=updatePod&id="+id+"&allocationstate=Disabled";
+ doActionToTab(id, $actionLink, apiCommand, $midmenuItem1, $detailsTab);
+ },
+ "Cancel": function() {
+ $(this).dialog("close");
+ }
+ }).dialog("open");
+}
+
function doDeletePod($actionLink, $detailsTab, $midmenuItem1) {
var jsonObj = $midmenuItem1.data("jsonObj");
var id = jsonObj.id;