diff --git a/ui/scripts/cloud.core.resource.js b/ui/scripts/cloud.core.resource.js index 91541e5541a..faa9998ec5e 100644 --- a/ui/scripts/cloud.core.resource.js +++ b/ui/scripts/cloud.core.resource.js @@ -405,24 +405,8 @@ function initAddPodShortcut() { $dialogAddHost.find("#pod_dropdown").bind("change", function(event) { var podId = $(this).val(); if(podId == null || podId.length == 0) - return; - var $clusterSelect = $dialogAddHost.find("#cluster_select").empty(); - $.ajax({ - data: createURL("command=listClusters&podid=" + podId), - dataType: "json", - success: function(json) { - var items = json.listclustersresponse.cluster; - if(items != null && items.length > 0) { - for(var i=0; i" + fromdb(items[i].name) + ""); - $dialogAddHost.find("input[value=existing_cluster_radio]").attr("checked", true); - } - else { - $clusterSelect.append(""); - $dialogAddHost.find("input[value=new_cluster_radio]").attr("checked", true); - } - } - }); + return; + refreshClsuterFieldInAddHostDialog($dialogAddHost, podId, null); }); $("#add_host_shortcut").unbind("click").bind("click", function(event) { @@ -528,7 +512,8 @@ function initAddPodShortcut() { }, error: function(XMLHttpResponse) { handleError(XMLHttpResponse, function() { - clickClusterNodeAfterAddHost(clusterRadio, podId, newClusterName, existingClusterId, $thisDialog); + clickClusterNodeAfterAddHost(clusterRadio, podId, newClusterName, existingClusterId, $thisDialog); + refreshClsuterFieldInAddHostDialog($thisDialog, podId, null); handleErrorInDialog(XMLHttpResponse, $thisDialog); }); }