bug 7701: primary storage page - fix a bug that Add Host dialog didn't populate cluster dropdown field.

This commit is contained in:
Jessica Wang 2010-12-29 12:16:51 -08:00
parent fe2fc93209
commit 2eb2024781
3 changed files with 80 additions and 21 deletions

View File

@ -219,26 +219,69 @@
<form action="#" method="post" id="form_acquire">
<ol>
<li>
<label for="host_hypervisor">Hypervisor:</label>
<select class="select" id="host_hypervisor">
<option value="XenServer" SELECTED>Xen Server</option>
<option value="KVM">KVM</option>
<option value="VmWare">VMware</option>
</select>
</li>
<li input_group="general">
<label for="host_hostname">
Host name:</label>
<input class="text" type="text" name="host_hostname" id="host_hostname" />
<div id="host_hostname_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li>
<li input_group="general">
<label for="user_name">
User name:</label>
<input class="text" type="text" name="host_username" id="host_username" />
<div id="host_username_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li>
<li input_group="general">
<label for="user_name">
Password:</label>
<input class="text" type="password" name="host_password" id="host_password" autocomplete="off" />
<div id="host_password_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li input_group="vmware">
<label for="host_vcenter_address">
vCenter Address:</label>
<input class="text" type="text" name="host_vcenter_address" id="host_vcenter_address" />
<div id="host_vcenter_address_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li input_group="vmware">
<label for="host_vcenter_username">
vCenter User:</label>
<input class="text" type="text" name="host_vcenter_username" id="host_vcenter_username" />
<div id="host_vcenter_username_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li input_group="vmware">
<label for="host_vcenter_password">
vCenter Password:</label>
<input class="text" type="password" name="host_vcenter_password" id="host_vcenter_password" autocomplete="off" />
<div id="host_vcenter_password_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li input_group="vmware">
<label for="host_vcenter_dc">
vCenter Datacenter:</label>
<input class="text" type="text" name="host_vcenter_dc" id="host_vcenter_dc" />
<div id="host_vcenter_dc_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li input_group="vmware">
<label for="host_vcenter_host">
vCenter Host:</label>
<input class="text" type="text" name="host_vcenter_host" id="host_vcenter_host" />
<div id="host_vcenter_host_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li id="cluster_options_container">
<label>
&nbsp;</label><span><u>Cluster Options</u></span> </li>
@ -279,6 +322,7 @@
(info)</div>
</div>
</div>
<!-- Add Primary Storage Dialog -->
<div id="dialog_add_pool" title="Add Primary Storage" style="display: none">
<p>
@ -309,36 +353,51 @@
<select class="select" id="add_pool_protocol">
<option value="nfs">NFS</option>
<option value="iscsi">ISCSI</option>
<option value="vmfs">VMFS</option>
</select>
</li>
<li>
<li id="add_pool_server_container">
<label for="add_pool_nfs_server">
Server:</label>
<input class="text" type="text" name="add_pool_nfs_server" id="add_pool_nfs_server" />
<div id="add_pool_nfs_server_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li id="add_pool_path_container">
<li id="add_pool_path_container" input_group="nfs">
<label for="add_pool_path">
Path:</label>
<input class="text" type="text" name="add_pool_path" id="add_pool_path" />
<div id="add_pool_path_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li id="add_pool_iqn_container" style="display: none">
<li id="add_pool_iqn_container" style="display: none" input_group="iscsi">
<label for="add_pool_iqn">
Target IQN:</label>
<input class="text" type="text" name="add_pool_iqn" id="add_pool_iqn" />
<div id="add_pool_iqn_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li id="add_pool_lun_container" style="display: none">
<li id="add_pool_lun_container" style="display: none" input_group="iscsi">
<label for="add_pool_lun">
LUN #:</label>
<input class="text" type="text" name="add_pool_lun" id="add_pool_lun" />
<div id="add_pool_lun_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li input_group="vmfs">
<label for="add_pool_vmfs_dc">
vCenter Datacenter:</label>
<input class="text" type="text" name="add_pool_vmfs_dc" id="add_pool_vmfs_dc" />
<div id="add_pool_vmfs_dc_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li input_group="vmfs">
<label for="add_pool_vmfs_ds">
vCenter Datastore:</label>
<input class="text" type="text" name="add_pool_vmfs_ds" id="add_pool_vmfs_ds" />
<div id="add_pool_vmfs_ds_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li id="add_pool_tags_container">
<label for="add_pool_tags">
Tags:</label>
@ -365,6 +424,7 @@
(info)</div>
</div>
</div>
<!-- dialogs -->
<div id="dialog_confirmation_delete_primarystorage" title="Confirmation" style="display: none">
<p>

View File

@ -244,7 +244,7 @@ function getIpRange(startip, endip) {
return ipRange;
}
function refreshClsuterFieldInAddHostDialog(dialogAddHost, podId, clusterId, hypervisorType) {
function refreshClsuterFieldInAddHostDialog(dialogAddHost, podId, clusterId, hypervisorType) {
var arrayParams = [];
arrayParams.push("&podid=" + podId);
arrayParams.push("&hypervisor=" + hypervisorType);
@ -390,22 +390,21 @@ function bindAddClusterButton($button, currentPageInRightPanel, $leftmenuItem1)
});
}
function bindAddHostButton($button, currentPageInRightPanel, $leftmenuItem1) {
$button.show();
function bindAddHostButton($button, currentPageInRightPanel, $leftmenuItem1) {
$button.unbind("click").bind("click", function(event) {
dialogAddHost = $("#dialog_add_host");
dialogAddHost.find("#info_container").hide();
dialogAddHost.find("#new_cluster_name").val("");
var zoneId, podId, clusterId;
if(currentPageInRightPanel == "pod_page") {
var zoneId, podId, clusterId;
if(currentRightPanelJSP == "jsp/pod.jsp") {
var podObj = $leftmenuItem1.data("jsonObj");
zoneId = podObj.zoneid;
podId = podObj.id;
dialogAddHost.find("#zone_name").text(fromdb(podObj.zonename));
dialogAddHost.find("#pod_name").text(fromdb(podObj.name));
}
else if(currentPageInRightPanel == "cluster_page") {
else if(currentRightPanelJSP == "jsp/cluster.jsp") {
var clusterObj = $leftmenuItem1.data("jsonObj");
zoneId = clusterObj.zoneid;
podId = clusterObj.podid;
@ -413,7 +412,7 @@ function bindAddHostButton($button, currentPageInRightPanel, $leftmenuItem1) {
dialogAddHost.find("#zone_name").text(fromdb(clusterObj.zonename));
dialogAddHost.find("#pod_name").text(fromdb(clusterObj.podname));
}
else if(currentPageInRightPanel == "host_page") {
else if(currentRightPanelJSP == "jsp/host.jsp") {
var hostObj = $leftmenuItem1.data("jsonObj");
zoneId = hostObj.zoneid;
podId = hostObj.podid;
@ -421,7 +420,7 @@ function bindAddHostButton($button, currentPageInRightPanel, $leftmenuItem1) {
dialogAddHost.find("#zone_name").text(fromdb(hostObj.zonename));
dialogAddHost.find("#pod_name").text(fromdb(hostObj.podname));
}
else if(currentPageInRightPanel == "primarystorage_page") {
else if(currentRightPanelJSP == "jsp/primarystorage.jsp") {
var primarystorageObj = $leftmenuItem1.data("jsonObj");
zoneId = primarystorageObj.zoneid;
podId = primarystorageObj.podid;
@ -596,14 +595,14 @@ function bindAddPrimaryStorageButton($button, currentPageInRightPanel, $leftmenu
dialogAddPool.find("#info_container").hide();
var zoneId, podId, sourceClusterId;
if(currentPageInRightPanel == "pod_page") {
if(currentRightPanelJSP == "jsp/pod.jsp") {
var podObj = $leftmenuItem1.data("jsonObj");
zoneId = podObj.zoneid;
podId = podObj.id;
dialogAddPool.find("#zone_name").text(fromdb(podObj.zonename));
dialogAddPool.find("#pod_name").text(fromdb(podObj.name));
}
else if(currentPageInRightPanel == "cluster_page") {
else if(currentRightPanelJSP == "jsp/cluster.jsp") {
var clusterObj = $leftmenuItem1.data("jsonObj");
zoneId = clusterObj.zoneid;
podId = clusterObj.podid;
@ -611,7 +610,7 @@ function bindAddPrimaryStorageButton($button, currentPageInRightPanel, $leftmenu
dialogAddPool.find("#zone_name").text(fromdb(clusterObj.zonename));
dialogAddPool.find("#pod_name").text(fromdb(clusterObj.podname));
}
else if(currentPageInRightPanel == "host_page") {
else if(currentRightPanelJSP == "jsp/host.jsp") {
var hostObj = $leftmenuItem1.data("jsonObj");
zoneId = hostObj.zoneid;
podId = hostObj.podid;
@ -619,7 +618,7 @@ function bindAddPrimaryStorageButton($button, currentPageInRightPanel, $leftmenu
dialogAddPool.find("#zone_name").text(fromdb(hostObj.zonename));
dialogAddPool.find("#pod_name").text(fromdb(hostObj.podname));
}
else if(currentPageInRightPanel == "primarystorage_page") {
else if(currentRightPanelJSP == "jsp/primarystorage.jsp") {
var primarystorageObj = $leftmenuItem1.data("jsonObj");
zoneId = primarystorageObj.zoneid;
podId = primarystorageObj.podid;

View File

@ -58,9 +58,9 @@ function primarystorageJsonToDetailsTab() {
var jsonObj = $midmenuItem1.data("jsonObj");
if(jsonObj == null)
return;
bindAddHostButton($("#add_host_button"), "host_page", $midmenuItem1);
bindAddPrimaryStorageButton($("#add_primarystorage_button"), "host_page", $midmenuItem1);
bindAddHostButton($("#add_host_button"), "primarystorage_page", $midmenuItem1);
bindAddPrimaryStorageButton($("#add_primarystorage_button"), "primarystorage_page", $midmenuItem1);
$.ajax({
data: createURL("command=listStoragePools&id="+jsonObj.id),