(1) When hypervisor.type is kvm, allow option to add host in UI.

(2) When when hypervisor.type is kvm, hide cluster section in add host dialog.
This commit is contained in:
Jessica Wang 2010-08-13 18:12:50 -07:00
parent 7cf14dcffa
commit 66ccd6f7ad
2 changed files with 165 additions and 161 deletions

View File

@ -277,10 +277,10 @@
<input class="text" type="password" name="host_password" id="host_password" AUTOCOMPLETE="off" /> <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> <div id="host_password_errormsg" class="dialog_formcontent_errormsg" style="display:none;" ></div>
</li> </li>
<li> <li id="cluster_options_container">
<label>&nbsp;</label><span><u>Cluster Options</u></span> <label>&nbsp;</label><span><u>Cluster Options</u></span>
</li> </li>
<li> <li id="new_cluster_radio_container">
<label><input type="radio" name="cluster" value="new_cluster_radio" checked />&nbsp;New cluster:</label> <label><input type="radio" name="cluster" value="new_cluster_radio" checked />&nbsp;New cluster:</label>
<input class="text" type="text" id="new_cluster_name"/> <input class="text" type="text" id="new_cluster_name"/>
<div id="new_cluster_name_errormsg" class="dialog_formcontent_errormsg" style="display:none;" ></div> <div id="new_cluster_name_errormsg" class="dialog_formcontent_errormsg" style="display:none;" ></div>

View File

@ -24,7 +24,6 @@ function showHostsTab() {
var pIndex = 0; var pIndex = 0;
// Dialog Setup // Dialog Setup
if (getHypervisorType() != "kvm") { //"xenserver"
$("#host_action_new_routing").show(); $("#host_action_new_routing").show();
activateDialog($("#dialog_add_routing").dialog({ activateDialog($("#dialog_add_routing").dialog({
autoOpen: false, autoOpen: false,
@ -34,6 +33,10 @@ function showHostsTab() {
var dialogAddRouting = $("#dialog_add_routing"); var dialogAddRouting = $("#dialog_add_routing");
//xenserver supports cluster. kvm doesn't support cluster.
if (getHypervisorType() == "kvm")
dialogAddRouting.find("#cluster_options_container, #new_cluster_radio_container, #existing_cluster_radio_container, #no_cluster_radio_container").hide();
$.ajax({ $.ajax({
data: createURL("command=listZones&available=true&response=json"+maxPageSize), data: createURL("command=listZones&available=true&response=json"+maxPageSize),
dataType: "json", dataType: "json",
@ -89,7 +92,7 @@ function showHostsTab() {
} }
}); });
}); });
}
activateDialog($("#dialog_update_os").dialog({ activateDialog($("#dialog_update_os").dialog({
autoOpen: false, autoOpen: false,
modal: true, modal: true,
@ -576,7 +579,6 @@ function showHostsTab() {
var submenuContent = $("#submenu_content_routing"); var submenuContent = $("#submenu_content_routing");
// Add New Routing Host // Add New Routing Host
if (getHypervisorType() != "kvm") {
$("#host_action_new_routing").bind("click", function(event) { $("#host_action_new_routing").bind("click", function(event) {
dialogAddRouting.find("#new_cluster_name").val(""); dialogAddRouting.find("#new_cluster_name").val("");
dialogAddRouting.find("#host_zone").change(); //refresh cluster dropdown dialogAddRouting.find("#host_zone").change(); //refresh cluster dropdown
@ -610,6 +612,8 @@ function showHostsTab() {
var password = trim(dialogBox.find("#host_password").val()); var password = trim(dialogBox.find("#host_password").val());
array1.push("&password="+encodeURIComponent(password)); array1.push("&password="+encodeURIComponent(password));
//xenserver supports cluster. kvm doesn't support cluster.
if (getHypervisorType() != "kvm") {
if(clusterRadio == "new_cluster_radio") { if(clusterRadio == "new_cluster_radio") {
var newClusterName = trim(dialogBox.find("#new_cluster_name").val()); var newClusterName = trim(dialogBox.find("#new_cluster_name").val());
array1.push("&clustername="+encodeURIComponent(newClusterName)); array1.push("&clustername="+encodeURIComponent(newClusterName));
@ -621,6 +625,7 @@ function showHostsTab() {
array1.push("&clusterid="+clusterId); array1.push("&clusterid="+clusterId);
} }
} }
}
var hostname = trim(dialogBox.find("#host_hostname").val()); var hostname = trim(dialogBox.find("#host_hostname").val());
var url; var url;
@ -673,7 +678,6 @@ function showHostsTab() {
}).dialog("open"); }).dialog("open");
return false; return false;
}); });
}
function listHosts() { function listHosts() {
var submenuContent = $("#submenu_content_routing"); var submenuContent = $("#submenu_content_routing");