Add Cluster dialog - get hypervisor type from ListHypervisor API instead of hardcoding.

This commit is contained in:
Jessica Wang 2011-01-31 10:55:17 -08:00
parent b98961bcb1
commit 332f917d09
6 changed files with 51 additions and 3 deletions

View File

@ -375,9 +375,11 @@ dictionary = {
<li>
<label for="cluster_hypervisor"><fmt:message key="label.hypervisor"/>:</label>
<select class="select" id="cluster_hypervisor">
<!--
<option value="Xen Server" SELECTED>Xen Server</option>
<option value="KVM">KVM</option>
<option value="VmWare">VMware</option>
-->
</select>
</li>
<li input_group="vmware">

View File

@ -736,9 +736,11 @@
<li>
<label for="cluster_hypervisor"><fmt:message key="label.hypervisor"/>:</label>
<select class="select" id="cluster_hypervisor">
<!--
<option value="Xen Server" SELECTED>Xen Server</option>
<option value="KVM">KVM</option>
<option value="VmWare">VMware</option>
-->
</select>
</li>
<li input_group="vmware">

View File

@ -432,9 +432,11 @@ dictionary = {
<li>
<label for="cluster_hypervisor"><fmt:message key="label.hypervisor"/>:</label>
<select class="select" id="cluster_hypervisor">
<!--
<option value="Xen Server" SELECTED>Xen Server</option>
<option value="KVM">KVM</option>
<option value="VmWare">VMware</option>
-->
</select>
</li>
<li input_group="vmware">

View File

@ -30,6 +30,20 @@
initDialog("dialog_add_pool");
bindEventHandlerToDialogAddPool($("#dialog_add_pool"));
$.ajax({
data: createURL("command=listHypervisors"),
dataType: "json",
success: function(json) {
var items = json.listhypervisorsresponse.hypervisor;
var $hypervisorDropdown = $("#dialog_add_external_cluster").find("#cluster_hypervisor");
if(items != null && items.length > 0) {
for(var i=0; i<items.length; i++) {
$hypervisorDropdown.append("<option value='"+fromdb(items[i].name)+"'>"+fromdb(items[i].name)+"</option>");
}
}
}
});
//switch between different tabs
var tabArray = [$("#tab_details"), $("#tab_ipallocation")];
var tabContentArray = [$("#tab_content_details"), $("#tab_content_ipallocation")];

View File

@ -619,6 +619,20 @@ function initAddPodShortcut() {
function initAddClusterShortcut() {
var $dialogAddCluster = $("#dialog_add_external_cluster_in_resource_page");
$.ajax({
data: createURL("command=listHypervisors"),
dataType: "json",
success: function(json) {
var items = json.listhypervisorsresponse.hypervisor;
var $hypervisorDropdown = $dialogAddCluster.find("#cluster_hypervisor");
if(items != null && items.length > 0) {
for(var i=0; i<items.length; i++) {
$hypervisorDropdown.append("<option value='"+fromdb(items[i].name)+"'>"+fromdb(items[i].name)+"</option>");
}
}
}
});
var $zoneDropdown = $dialogAddCluster.find("#zone_dropdown");
var $podDropdown = $dialogAddCluster.find("#pod_dropdown");

View File

@ -27,6 +27,20 @@
initDialog("dialog_add_host_in_zone_page");
initDialog("dialog_add_pool_in_zone_page");
$.ajax({
data: createURL("command=listHypervisors"),
dataType: "json",
success: function(json) {
var items = json.listhypervisorsresponse.hypervisor;
var $hypervisorDropdown = $("#dialog_add_external_cluster_in_zone_page").find("#cluster_hypervisor");
if(items != null && items.length > 0) {
for(var i=0; i<items.length; i++) {
$hypervisorDropdown.append("<option value='"+fromdb(items[i].name)+"'>"+fromdb(items[i].name)+"</option>");
}
}
}
});
//switch between different tabs in zone page
var tabArray = [$("#tab_details")];
var tabContentArray = [$("#tab_content_details")];