bug 7253: show error message when addnig host fails. (merge from 2.2.beta1 branch to master branch)

This commit is contained in:
Jessica Wang 2010-11-23 16:33:40 -08:00
parent 7518488672
commit 85cc68a742
4 changed files with 22 additions and 14 deletions

View File

@ -530,7 +530,7 @@
<form action="#" method="post" id="form_acquire">
<ol>
<li>
<label style="width: 115px;">
<label>
Zone:</label>
<select class="select" id="zone_dropdown">
</select>
@ -538,7 +538,7 @@
</div>
</li>
<li>
<label style="width: 115px;">
<label>
Pod:</label>
<select class="select" id="pod_dropdown">
</select>

View File

@ -372,10 +372,13 @@ function initAddHostButton($button, currentPageInRightPanel) {
clickClusterNodeAfterAddHost(clusterRadio, podId, newClusterName, existingClusterId, $thisDialog);
},
error: function(XMLHttpResponse) {
handleError(XMLHttpResponse, function() {
clickClusterNodeAfterAddHost(clusterRadio, podId, newClusterName, existingClusterId, $thisDialog);
handleError(XMLHttpResponse, function() {
refreshClsuterFieldInAddHostDialog($thisDialog, podId, null);
handleErrorInDialog(XMLHttpResponse, $thisDialog);
handleErrorInDialog(XMLHttpResponse, $thisDialog);
if(clusterRadio == "new_cluster_radio") { //*** new cluster ***
refreshClusterUnderPod($("#pod_" + podId), newClusterName, null, true); //refresh clusters under pod, but no clicking at any cluster
$thisDialog.find("#new_cluster_name").val("");
}
});
}
});

View File

@ -128,7 +128,7 @@ function buildZoneTree() {
});
}
function refreshClusterUnderPod($podNode, newClusterName, existingClusterId) {
function refreshClusterUnderPod($podNode, newClusterName, existingClusterId, noClicking) {
var podId = $podNode.data("podId");
$.ajax({
data: createURL("command=listClusters&podid="+podId+maxPageSize),
@ -142,16 +142,15 @@ function refreshClusterUnderPod($podNode, newClusterName, existingClusterId) {
var $clusterNode = $("#leftmenu_cluster_node_template").clone(true);
var item = items[i];
clusterJSONToTreeNode(item, $clusterNode);
container.append($clusterNode.show());
if(newClusterName != null && fromdb(item.name) == newClusterName) {
container.append($clusterNode.show());
if(newClusterName != null && fromdb(item.name) == newClusterName && noClicking!=true) {
$clusterNode.find("#cluster_name").click();
}
}
$podNode.find("#pod_arrow").removeClass("white_nonexpanded_close").addClass("expanded_open");
$podNode.find("#pod_content").show();
if(existingClusterId != null) {
if(existingClusterId != null && noClicking!=true) {
$("#cluster_"+existingClusterId).find("#cluster_name").click();
}
}
@ -509,10 +508,13 @@ function initAddHostShortcut() {
clickClusterNodeAfterAddHost(clusterRadio, podId, newClusterName, existingClusterId, $thisDialog);
},
error: function(XMLHttpResponse) {
handleError(XMLHttpResponse, function() {
clickClusterNodeAfterAddHost(clusterRadio, podId, newClusterName, existingClusterId, $thisDialog);
handleError(XMLHttpResponse, function() {
refreshClsuterFieldInAddHostDialog($thisDialog, podId, null);
handleErrorInDialog(XMLHttpResponse, $thisDialog);
if(clusterRadio == "new_cluster_radio") { //*** new cluster ***
refreshClusterUnderPod($("#pod_" + podId), newClusterName, null, true); //refresh clusters under pod, but no clicking at any cluster
$thisDialog.find("#new_cluster_name").val("");
}
});
}
});

View File

@ -995,10 +995,13 @@ function initAddHostButtonOnZonePage($button, zoneId, zoneName) {
clickClusterNodeAfterAddHost(clusterRadio, podId, newClusterName, existingClusterId, $thisDialog);
},
error: function(XMLHttpResponse) {
handleError(XMLHttpResponse, function() {
clickClusterNodeAfterAddHost(clusterRadio, podId, newClusterName, existingClusterId, $thisDialog);
handleError(XMLHttpResponse, function() {
refreshClsuterFieldInAddHostDialog($thisDialog, podId, null);
handleErrorInDialog(XMLHttpResponse, $thisDialog);
if(clusterRadio == "new_cluster_radio") { //*** new cluster ***
refreshClusterUnderPod($("#pod_" + podId), newClusterName, null, true); //refresh clusters under pod, but no clicking at any cluster
$thisDialog.find("#new_cluster_name").val("");
}
});
}
});