mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
bug 7152: refresh cluster dropdown field after adding host fails.
This commit is contained in:
parent
2cb113b850
commit
d7a56c838d
@ -219,6 +219,30 @@ function getIpRange(startip, endip) {
|
|||||||
return ipRange;
|
return ipRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function refreshClsuterFieldInAddHostDialog(dialogAddHost, podId, clusterId) {
|
||||||
|
$.ajax({
|
||||||
|
data: createURL("command=listClusters&podid="+podId),
|
||||||
|
dataType: "json",
|
||||||
|
success: function(json) {
|
||||||
|
var items = json.listclustersresponse.cluster;
|
||||||
|
var clusterSelect = dialogAddHost.find("#cluster_select").empty();
|
||||||
|
if(items != null && items.length > 0) {
|
||||||
|
for(var i=0; i<items.length; i++) {
|
||||||
|
if(clusterId != null && items[i].id == clusterId)
|
||||||
|
clusterSelect.append("<option value='" + noNull(items[i].id) + "' selected>" + fromdb(items[i].name) + "</option>");
|
||||||
|
else
|
||||||
|
clusterSelect.append("<option value='" + noNull(items[i].id) + "'>" + fromdb(items[i].name) + "</option>");
|
||||||
|
}
|
||||||
|
dialogAddHost.find("input[value=existing_cluster_radio]").attr("checked", true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
clusterSelect.append("<option value='-1'>None Available</option>");
|
||||||
|
dialogAddHost.find("input[value=new_cluster_radio]").attr("checked", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function initAddHostButton($midmenuAddLink1, currentPageInRightPanel) {
|
function initAddHostButton($midmenuAddLink1, currentPageInRightPanel) {
|
||||||
$midmenuAddLink1.find("#label").text("Add Host");
|
$midmenuAddLink1.find("#label").text("Add Host");
|
||||||
$midmenuAddLink1.show();
|
$midmenuAddLink1.show();
|
||||||
@ -252,27 +276,7 @@ function initAddHostButton($midmenuAddLink1, currentPageInRightPanel) {
|
|||||||
dialogAddHost.find("#pod_name").text(fromdb(primarystorageObj.podname));
|
dialogAddHost.find("#pod_name").text(fromdb(primarystorageObj.podname));
|
||||||
}
|
}
|
||||||
|
|
||||||
$.ajax({
|
refreshClsuterFieldInAddHostDialog(dialogAddHost, podId, clusterId);
|
||||||
data: createURL("command=listClusters&podid="+podId+maxPageSize),
|
|
||||||
dataType: "json",
|
|
||||||
success: function(json) {
|
|
||||||
var items = json.listclustersresponse.cluster;
|
|
||||||
var clusterSelect = dialogAddHost.find("#cluster_select").empty();
|
|
||||||
if(items != null && items.length > 0) {
|
|
||||||
for(var i=0; i<items.length; i++) {
|
|
||||||
if(clusterId != null && items[i].id == clusterId)
|
|
||||||
clusterSelect.append("<option value='" + items[i].id + "' selected>" + fromdb(items[i].name) + "</option>");
|
|
||||||
else
|
|
||||||
clusterSelect.append("<option value='" + items[i].id + "'>" + fromdb(items[i].name) + "</option>");
|
|
||||||
}
|
|
||||||
dialogAddHost.find("input[value=existing_cluster_radio]").attr("checked", true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
clusterSelect.append("<option value='-1'>None Available</option>");
|
|
||||||
dialogAddHost.find("input[value=new_cluster_radio]").attr("checked", true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
dialogAddHost
|
dialogAddHost
|
||||||
.dialog('option', 'buttons', {
|
.dialog('option', 'buttons', {
|
||||||
@ -292,7 +296,6 @@ function initAddHostButton($midmenuAddLink1, currentPageInRightPanel) {
|
|||||||
if (!isValid)
|
if (!isValid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//$thisDialog.dialog("close"); //only close dialog when this action succeeds
|
|
||||||
$thisDialog.find("#spinning_wheel").show()
|
$thisDialog.find("#spinning_wheel").show()
|
||||||
|
|
||||||
var array1 = [];
|
var array1 = [];
|
||||||
@ -359,6 +362,7 @@ function initAddHostButton($midmenuAddLink1, currentPageInRightPanel) {
|
|||||||
error: function(XMLHttpResponse) {
|
error: function(XMLHttpResponse) {
|
||||||
handleError(XMLHttpResponse, function() {
|
handleError(XMLHttpResponse, function() {
|
||||||
clickClusterNodeAfterAddHost(clusterRadio, podId, newClusterName, existingClusterId, $thisDialog);
|
clickClusterNodeAfterAddHost(clusterRadio, podId, newClusterName, existingClusterId, $thisDialog);
|
||||||
|
refreshClsuterFieldInAddHostDialog($thisDialog, podId, null);
|
||||||
handleErrorInDialog(XMLHttpResponse, $thisDialog);
|
handleErrorInDialog(XMLHttpResponse, $thisDialog);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user