bug 8182: zone page - still show Add Cluster/Add Host/Add Primary storage dialog even there is no pod under the zone.

This commit is contained in:
Jessica Wang 2011-01-25 16:01:43 -08:00
parent 9b43e27706
commit 6728b33733
2 changed files with 10 additions and 28 deletions

View File

@ -259,15 +259,12 @@ function getIpRange(startip, endip) {
}
var clustersUnderOnePod = {};
//function refreshClsuterFieldInAddHostDialog(dialogAddHost, podId, clusterId, hypervisorType) {
function refreshClsuterFieldInAddHostDialog(dialogAddHost, podId, clusterId) {
if(podId == null)
return;
var arrayParams = [];
arrayParams.push("&podid=" + podId);
/*
arrayParams.push("&hypervisor=" + hypervisorType);
if(hypervisorType == "VmWare")
arrayParams.push("&clustertype=CloudManaged");
*/
$.ajax({
data: createURL("command=listClusters"+arrayParams.join("")),

View File

@ -63,11 +63,10 @@ function zoneJsonToRightPanel($leftmenuItem1) {
pods = json.listpodsresponse.pod;
}
});
if(pods != null && pods.length > 0) {
bindAddClusterButtonOnZonePage($("#add_cluster_button"), zoneId, zoneName);
bindAddHostButtonOnZonePage($("#add_host_button"), zoneId, zoneName);
bindAddPrimaryStorageButtonOnZonePage($("#add_primarystorage_button"), zoneId, zoneName);
}
bindAddClusterButtonOnZonePage($("#add_cluster_button"), zoneId, zoneName);
bindAddHostButtonOnZonePage($("#add_host_button"), zoneId, zoneName);
bindAddPrimaryStorageButtonOnZonePage($("#add_primarystorage_button"), zoneId, zoneName);
$("#right_panel_content").find("#tab_details").click();
}
@ -487,8 +486,7 @@ function doDeleteZone($actionLink, $detailsTab, $midmenuItem1) {
}).dialog("open");
}
function bindAddClusterButtonOnZonePage($button, zoneId, zoneName) {
$button.show();
function bindAddClusterButtonOnZonePage($button, zoneId, zoneName) {
$button.unbind("click").bind("click", function(event) {
$dialogAddCluster = $("#dialog_add_external_cluster_in_zone_page");
$dialogAddCluster.find("#info_container").hide();
@ -541,6 +539,7 @@ function bindAddClusterButtonOnZonePage($button, zoneId, zoneName) {
clusterType = $thisDialog.find("#type_dropdown").val();
var isValid = true;
isValid &= validateDropDownBox("Pod", $thisDialog.find("#pod_dropdown"), $thisDialog.find("#pod_dropdown_errormsg"));
if(hypervisor == "VmWare" && clusterType != "CloudManaged") {
isValid &= validateString("vCenter Server", $thisDialog.find("#cluster_hostname"), $thisDialog.find("#cluster_hostname_errormsg"));
isValid &= validateString("vCenter user", $thisDialog.find("#cluster_username"), $thisDialog.find("#cluster_username_errormsg"));
@ -652,21 +651,7 @@ function bindAddHostButtonOnZonePage($button, zoneId, zoneName) {
}
}
});
/*
$dialogAddHost.find("#host_hypervisor").change(function() {
if($(this).val() == "VmWare") {
$('li[input_group="general"]', $dialogAddHost).hide();
$('li[input_group="vmware"]', $dialogAddHost).show();
} else {
$('li[input_group="vmware"]', $dialogAddHost).hide();
$('li[input_group="general"]', $dialogAddHost).show();
}
refreshClsuterFieldInAddHostDialog($dialogAddHost, $podSelect.val(), null, $(this).val());
});
*/
$dialogAddHost.find("#pod_dropdown").unbind("change").bind("change", function(event) {
$dialogAddHost.find("#cluster_select").change();
});