bug 6873: CloudStack UI - Enable/Disable Cluster/Pod/Zone action: only refresh allocationstate grid row and action menu after action succeeds.

This commit is contained in:
Jessica Wang 2011-05-05 18:45:46 -07:00
parent 43c3c775f2
commit db6264cd43
3 changed files with 64 additions and 74 deletions

View File

@ -64,12 +64,6 @@ function clusterJsonToDetailsTab() {
}
});
clusterJsonToDetailsTab2(jsonObj);
}
function clusterJsonToDetailsTab2(jsonObj) {
var $midmenuItem1 = $("#right_panel_content").data("$midmenuItem1");
var $thisTab = $("#right_panel_content").find("#tab_content_details");
$thisTab.find("#grid_header_title").text(fromdb(jsonObj.name));
$thisTab.find("#id").text(fromdb(jsonObj.id));
@ -81,6 +75,13 @@ function clusterJsonToDetailsTab2(jsonObj) {
$thisTab.find("#allocationstate").text(fromdb(jsonObj.allocationstate));
//actions ***
clusterBuildActionMenu(jsonObj);
}
function clusterBuildActionMenu(jsonObj) {
var $midmenuItem1 = $("#right_panel_content").data("$midmenuItem1");
var $thisTab = $("#right_panel_content").find("#tab_content_details");
var $actionLink = $thisTab.find("#action_link");
bindActionLink($actionLink);
@ -118,7 +119,8 @@ var clusterActionMap = {
inProcessText: "label.action.enable.cluster.processing",
afterActionSeccessFn: function(json, $midmenuItem1, id) {
var jsonObj = json.updateclusterresponse.cluster;
clusterJsonToDetailsTab2(jsonObj);
$("#right_panel_content").find("#tab_content_details").find("#allocationstate").text(fromdb(jsonObj.allocationstate));
clusterBuildActionMenu(jsonObj);
}
}
,
@ -128,7 +130,8 @@ var clusterActionMap = {
inProcessText: "label.action.disable.cluster.processing",
afterActionSeccessFn: function(json, $midmenuItem1, id) {
var jsonObj = json.updateclusterresponse.cluster;
clusterJsonToDetailsTab2(jsonObj);
$("#right_panel_content").find("#tab_content_details").find("#allocationstate").text(fromdb(jsonObj.allocationstate));
clusterBuildActionMenu(jsonObj);
}
}
,

View File

@ -116,35 +116,33 @@ function podJsonToDetailsTab() {
}
});
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("#tab_spinning_wheel").show();
$thisTab.find("#id").text(fromdb(jsonObj.id));
$thisTab.find("#grid_header_title").text(fromdb(jsonObj.name));
$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("#name_edit").val(fromdb(jsonObj.name));
$thisTab.find("#netmask").text(fromdb(jsonObj.netmask));
$thisTab.find("#netmask_edit").val(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("#endIpRange_edit").val(fromdb(jsonObj.endip));
$thisTab.find("#gateway").text(fromdb(jsonObj.gateway));
$thisTab.find("#gateway_edit").val(fromdb(jsonObj.gateway));
$thisTab.find("#gateway_edit").val(fromdb(jsonObj.gateway));
$thisTab.find("#allocationstate").text(fromdb(jsonObj.allocationstate));
//actions ***
//actions ***
podBuildActionMenu(jsonObj);
$thisTab.find("#tab_spinning_wheel").hide();
$thisTab.find("#tab_container").show();
}
function podBuildActionMenu(jsonObj) {
var $leftmenuItem1 = $("#right_panel_content").data("$leftmenuItem1");
var $thisTab = $("#right_panel_content #tab_content_details");
var $actionLink = $thisTab.find("#action_link");
bindActionLink($actionLink);
@ -157,10 +155,7 @@ function podJsonToDetailsTab2(jsonObj) {
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();
buildActionLinkForTab("label.action.delete.pod", podActionMap, $actionMenu, $leftmenuItem1, $thisTab);
}
function podJsonToNetworkTab() {
@ -1107,7 +1102,8 @@ var podActionMap = {
inProcessText: "label.action.enable.pod.processing",
afterActionSeccessFn: function(json, $midmenuItem1, id) {
var jsonObj = json.updatepodresponse.pod;
podJsonToDetailsTab2(jsonObj);
$("#right_panel_content").find("#tab_content_details").find("#allocationstate").text(fromdb(jsonObj.allocationstate));
podBuildActionMenu(jsonObj);
}
}
,
@ -1117,7 +1113,8 @@ var podActionMap = {
inProcessText: "label.action.disable.pod.processing",
afterActionSeccessFn: function(json, $midmenuItem1, id) {
var jsonObj = json.updatepodresponse.pod;
podJsonToDetailsTab2(jsonObj);
$("#right_panel_content").find("#tab_content_details").find("#allocationstate").text(fromdb(jsonObj.allocationstate));
podBuildActionMenu(jsonObj);
}
}
,

View File

@ -127,40 +127,30 @@ function zoneJsonToDetailsTab() {
}
if(jsonObj.networktype == "Basic")
$("#tab_network, #tab_content_details #vlan_container, #guestcidraddress_container").hide();
$("#tab_network, #tab_content_details #vlan_container, #guestcidraddress_container").hide();
else if(jsonObj.networktype == "Advanced")
$("#tab_network, #tab_content_details #vlan_container, #guestcidraddress_container").show();
zoneJsonToDetailsTab2(jsonObj);
}
function zoneJsonToDetailsTab2(jsonObj) {
var $leftmenuItem1 = $("#right_panel_content").data("$leftmenuItem1");
var $thisTab = $("#right_panel_content").find("#tab_content_details");
$thisTab.find("#tab_container").hide();
$thisTab.find("#tab_spinning_wheel").show();
$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("#grid_header_title").text(fromdb(jsonObj.name));
$thisTab.find("#name").text(fromdb(jsonObj.name));
$thisTab.find("#name_edit").val(fromdb(jsonObj.name));
$thisTab.find("#name_edit").val(fromdb(jsonObj.name));
$thisTab.find("#dns1").text(fromdb(jsonObj.dns1));
$thisTab.find("#dns1_edit").val(fromdb(jsonObj.dns1));
$thisTab.find("#dns1_edit").val(fromdb(jsonObj.dns1));
$thisTab.find("#dns2").text(fromdb(jsonObj.dns2));
$thisTab.find("#dns2_edit").val(fromdb(jsonObj.dns2));
$thisTab.find("#dns2_edit").val(fromdb(jsonObj.dns2));
$thisTab.find("#internaldns1").text(fromdb(jsonObj.internaldns1));
$thisTab.find("#internaldns1_edit").val(fromdb(jsonObj.internaldns1));
$thisTab.find("#internaldns1_edit").val(fromdb(jsonObj.internaldns1));
$thisTab.find("#internaldns2").text(fromdb(jsonObj.internaldns2));
$thisTab.find("#internaldns2_edit").val(fromdb(jsonObj.internaldns2));
$thisTab.find("#networktype").text(fromdb(jsonObj.networktype));
$thisTab.find("#internaldns2_edit").val(fromdb(jsonObj.internaldns2));
$thisTab.find("#networktype").text(fromdb(jsonObj.networktype));
setBooleanReadField(jsonObj.securitygroupsenabled, $thisTab.find("#securitygroupsenabled"));
$thisTab.find("#guestcidraddress").text(fromdb(jsonObj.guestcidraddress));
$thisTab.find("#guestcidraddress_edit").val(fromdb(jsonObj.guestcidraddress));
$thisTab.find("#domain").text(fromdb(jsonObj.domain));
$thisTab.find("#allocationstate").text(fromdb(jsonObj.allocationstate));
if(jsonObj.networktype == "Advanced") {
var vlan = jsonObj.vlan;
$thisTab.find("#vlan").text(fromdb(vlan));
@ -176,17 +166,18 @@ function zoneJsonToDetailsTab2(jsonObj) {
}
}
}
setBooleanReadField(jsonObj.securitygroupsenabled, $thisTab.find("#securitygroupsenabled"));
$thisTab.find("#guestcidraddress").text(fromdb(jsonObj.guestcidraddress));
$thisTab.find("#guestcidraddress_edit").val(fromdb(jsonObj.guestcidraddress));
$thisTab.find("#domain").text(fromdb(jsonObj.domain));
//actions ***
zoneBuildActionMenu(jsonObj);
$thisTab.find("#allocationstate").text(fromdb(jsonObj.allocationstate));
//actions ***
$thisTab.find("#tab_spinning_wheel").hide();
$thisTab.find("#tab_container").show();
}
function zoneBuildActionMenu(jsonObj) {
var $leftmenuItem1 = $("#right_panel_content").data("$leftmenuItem1");
var $thisTab = $("#right_panel_content").find("#tab_content_details");
var $actionLink = $thisTab.find("#action_link");
bindActionLink($actionLink);
@ -199,10 +190,7 @@ function zoneJsonToDetailsTab2(jsonObj) {
else if(jsonObj.allocationstate == "Enabled")
buildActionLinkForTab("label.action.disable.zone", zoneActionMap, $actionMenu, $leftmenuItem1, $thisTab);
buildActionLinkForTab("label.action.delete.zone", zoneActionMap, $actionMenu, $leftmenuItem1, $thisTab);
$thisTab.find("#tab_spinning_wheel").hide();
$thisTab.find("#tab_container").show();
buildActionLinkForTab("label.action.delete.zone", zoneActionMap, $actionMenu, $leftmenuItem1, $thisTab);
}
function zoneClearDetailsTab() {
@ -389,7 +377,8 @@ var zoneActionMap = {
inProcessText: "label.action.enable.zone.processing",
afterActionSeccessFn: function(json, $leftmenuItem1, id) {
var jsonObj = json.updatezoneresponse.zone;
zoneJsonToDetailsTab2(jsonObj);
$("#right_panel_content").find("#tab_content_details").find("#allocationstate").text(fromdb(jsonObj.allocationstate));
zoneBuildActionMenu(jsonObj);
}
},
"label.action.disable.zone": {
@ -398,7 +387,8 @@ var zoneActionMap = {
inProcessText: "label.action.disable.zone.processing",
afterActionSeccessFn: function(json, $leftmenuItem1, id) {
var jsonObj = json.updatezoneresponse.zone;
zoneJsonToDetailsTab2(jsonObj);
$("#right_panel_content").find("#tab_content_details").find("#allocationstate").text(fromdb(jsonObj.allocationstate));
zoneBuildActionMenu(jsonObj);
}
},
"label.action.delete.zone": {