zone page, resource page - expand newly created cluster node automatically after a cluster is created successfully.

This commit is contained in:
Jessica Wang 2010-12-30 19:30:35 -08:00
parent 3a6a7e30ce
commit a9aa592df2
3 changed files with 48 additions and 4 deletions

View File

@ -365,9 +365,9 @@ function bindAddClusterButton($leftmenuItem1) {
dataType: "json",
success: function(json) {
$thisDialog.find("#spinning_wheel").hide();
$thisDialog.dialog("close");
var item = json.addclusterresponse.cluster[0];
$thisDialog.dialog("close");
var item = json.addclusterresponse.cluster[0];
var $podNode = $("#pod_" + podId);
if($podNode.length > 0 && $podNode.css("display") != "none") {
if($podNode.find("#pod_arrow").hasClass("white_nonexpanded_close")) {

View File

@ -782,6 +782,28 @@ function initAddClusterShortcut() {
$thisDialog.find("#spinning_wheel").hide();
$thisDialog.dialog("close");
var item = json.addclusterresponse.cluster[0];
var $podNode = $("#pod_" + podId);
if($podNode.length > 0 && $podNode.css("display") != "none") {
if($podNode.find("#pod_arrow").hasClass("white_nonexpanded_close")) {
$podNode.find("#pod_arrow").removeClass("white_nonexpanded_close").addClass("expanded_close");
}
if($podNode.find("#pod_arrow").hasClass("expanded_close")) { //if pod node is closed
$podNode.find("#pod_arrow").click(); //expand pod node
var $clusterNode = $podNode.find("#cluster_"+item.id);
$clusterNode.find("#cluster_arrow").click(); //expand cluster node to see host node and storage node
$clusterNode.find("#cluster_name").click(); //click cluster node to show cluster info
}
else { //if pod node is expanded
var $clusterNode = $("#leftmenu_cluster_node_template").clone(true);
clusterJSONToTreeNode(item, $clusterNode);
$podNode.find("#clusters_container").append($clusterNode.show());
$clusterNode.find("#cluster_arrow").click(); //expand cluster node to see host node and storage node
$clusterNode.find("#cluster_name").click(); //click cluster node to show cluster info
}
}
var clusterTotal = parseInt($("#cluster_total").text());
clusterTotal++;
$("#cluster_total").text(clusterTotal.toString());

View File

@ -1137,7 +1137,29 @@ function bindAddClusterButtonOnZonePage($button, zoneId, zoneName) {
dataType: "json",
success: function(json) {
$thisDialog.find("#spinning_wheel").hide();
$thisDialog.dialog("close");
$thisDialog.dialog("close");
var item = json.addclusterresponse.cluster[0];
var $podNode = $("#pod_" + podId);
if($podNode.length > 0 && $podNode.css("display") != "none") {
if($podNode.find("#pod_arrow").hasClass("white_nonexpanded_close")) {
$podNode.find("#pod_arrow").removeClass("white_nonexpanded_close").addClass("expanded_close");
}
if($podNode.find("#pod_arrow").hasClass("expanded_close")) { //if pod node is closed
$podNode.find("#pod_arrow").click(); //expand pod node
var $clusterNode = $podNode.find("#cluster_"+item.id);
$clusterNode.find("#cluster_arrow").click(); //expand cluster node to see host node and storage node
$clusterNode.find("#cluster_name").click(); //click cluster node to show cluster info
}
else { //if pod node is expanded
var $clusterNode = $("#leftmenu_cluster_node_template").clone(true);
clusterJSONToTreeNode(item, $clusterNode);
$podNode.find("#clusters_container").append($clusterNode.show());
$clusterNode.find("#cluster_arrow").click(); //expand cluster node to see host node and storage node
$clusterNode.find("#cluster_name").click(); //click cluster node to show cluster info
}
}
},
error: function(XMLHttpResponse) {
handleError(XMLHttpResponse, function() {