bug 7701: pod page - after adding host, cluster node will be added and expanded and host node will be added under cluster node.

This commit is contained in:
Jessica Wang 2010-12-29 14:36:54 -08:00
parent 077c177684
commit abdd6e7426
2 changed files with 22 additions and 6 deletions

View File

@ -531,9 +531,7 @@ function bindAddHostButton($leftmenuItem1) {
dataType: "json",
success: function(json) {
$thisDialog.find("#spinning_wheel").hide();
$thisDialog.dialog("close");
showMiddleMenu();
$thisDialog.dialog("close");
/*
var $midmenuItem1 = $("#midmenu_item").clone();
@ -552,7 +550,8 @@ function bindAddHostButton($leftmenuItem1) {
}
*/
clickClusterNodeAfterAddHost(clusterRadio, podId, newClusterName, existingClusterId, $thisDialog);
//clickClusterNodeAfterAddHost(clusterRadio, podId, newClusterName, existingClusterId, $thisDialog);
clickClusterArrowAfterAddHost(clusterRadio, podId, newClusterName, existingClusterId, $thisDialog);
},
error: function(XMLHttpResponse) {
handleError(XMLHttpResponse, function() {
@ -586,6 +585,19 @@ function clickClusterNodeAfterAddHost(clusterRadio, podId, newClusterName, exist
}
}
function clickClusterArrowAfterAddHost(clusterRadio, podId, newClusterName, existingClusterId, $thisDialog) {
if(clusterRadio == "new_cluster_radio") { //*** new cluster ***
$thisDialog.find("#new_cluster_name").val("");
var $clusterNode = refreshClusterUnderPod($("#pod_" + podId), newClusterName, null, true);
$clusterNode.find("#cluster_arrow").click();
}
else if(clusterRadio == "existing_cluster_radio") { //*** existing cluster ***
if (existingClusterId != null && existingClusterId != '-1') {
$("#cluster_"+existingClusterId).find("#cluster_arrow").click();
}
}
}
function bindAddPrimaryStorageButton($leftmenuItem1) {
var $button = $("#add_primarystorage_button");
$button.unbind("click").bind("click", function(event) {

View File

@ -362,6 +362,7 @@ function refreshClusterUnderPod($podNode, newClusterName, existingClusterId, noC
if(podId == null) //e.g. $podNode is not on the screen (when zone tree is hidden) ($podNode.length==0)
return;
var $clusterNode;
$.ajax({
data: createURL("command=listClusters&podid="+podId),
dataType: "json",
@ -371,7 +372,7 @@ function refreshClusterUnderPod($podNode, newClusterName, existingClusterId, noC
var container = $podNode.find("#clusters_container").empty();
if (items != null && items.length > 0) {
for (var i = 0; i < items.length; i++) {
var $clusterNode = $("#leftmenu_cluster_node_template").clone(true);
$clusterNode = $("#leftmenu_cluster_node_template").clone(true);
var item = items[i];
clusterJSONToTreeNode(item, $clusterNode);
container.append($clusterNode.show());
@ -383,11 +384,14 @@ function refreshClusterUnderPod($podNode, newClusterName, existingClusterId, noC
$podNode.find("#pod_content").show();
if(existingClusterId != null && noClicking!=true) {
$("#cluster_"+existingClusterId).find("#cluster_name").click();
$clusterNode = $("#cluster_"+existingClusterId);
$clusterNode.find("#cluster_name").click();
}
}
}
});
return $clusterNode;
}
function selectRowInZoneTree($rowToSelect) {