mirror of https://github.com/apache/cloudstack.git
add clustertype and hypervisortype to ListClusterCmd API, improve addHost UI to deal with multi-hypervisor
This commit is contained in:
parent
c5b33a69c2
commit
f92482fabf
|
|
@ -53,6 +53,12 @@ public class ListClustersCmd extends BaseListCmd {
|
|||
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="lists clusters by Zone ID")
|
||||
private Long zoneId;
|
||||
|
||||
@Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, description="lists clusters by hypervisor type")
|
||||
private String hypervisorType;
|
||||
|
||||
@Parameter(name=ApiConstants.CLUSTER_TYPE, type=CommandType.STRING, description="lists clusters by cluster type")
|
||||
private String clusterType;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
|
|
@ -73,6 +79,14 @@ public class ListClustersCmd extends BaseListCmd {
|
|||
public Long getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public String getHypervisorType() {
|
||||
return hypervisorType;
|
||||
}
|
||||
|
||||
public String getClusterType() {
|
||||
return clusterType;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
|
|
|
|||
|
|
@ -1254,6 +1254,8 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
Object name = cmd.getClusterName();
|
||||
Object podId = cmd.getPodId();
|
||||
Object zoneId = cmd.getZoneId();
|
||||
Object hypervisorType = cmd.getHypervisorType();
|
||||
Object clusterType = cmd.getClusterType();
|
||||
|
||||
if (id != null) {
|
||||
sc.addAnd("id", SearchCriteria.Op.EQ, id);
|
||||
|
|
@ -1270,6 +1272,14 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
if (zoneId != null) {
|
||||
sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, zoneId);
|
||||
}
|
||||
|
||||
if(hypervisorType != null) {
|
||||
sc.addAnd("hypervisorType", SearchCriteria.Op.EQ, hypervisorType);
|
||||
}
|
||||
|
||||
if(clusterType != null) {
|
||||
sc.addAnd("clusterType", SearchCriteria.Op.EQ, clusterType);
|
||||
}
|
||||
|
||||
return _clusterDao.search(sc, searchFilter);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -241,27 +241,62 @@
|
|||
<option value="VmWare">VMware</option>
|
||||
</select>
|
||||
</li>
|
||||
<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>
|
||||
</label><span><u>Cluster Options</u></span> </li>
|
||||
|
|
@ -305,7 +340,7 @@
|
|||
<!-- Add Host Dialog (end) -->
|
||||
|
||||
<!-- Add Hypervisor managed cluster Dialog (begin) -->
|
||||
<div id="dialog_add_external_cluster" title="Add External Cluster" style="display: none">
|
||||
<div id="dialog_add_external_cluster" title="Add Cluster" style="display: none">
|
||||
<p>
|
||||
Add a hypervisor managed cluster for zone <b><span id="zone_name"></span></b>, pod <b><span id="pod_name">
|
||||
</span></b>
|
||||
|
|
@ -325,8 +360,8 @@
|
|||
<label>
|
||||
Cluster Type:</label>
|
||||
<select class="select" id="type_dropdown">
|
||||
<option value="CloudManaged">CloudManaged</option>
|
||||
<option value="ExternalManaged" SELECTED>ExternalManaged</option>
|
||||
<option value="CloudManaged">Cloud.com Managed</option>
|
||||
<option value="ExternalManaged" SELECTED>vSphere Managed</option>
|
||||
</select>
|
||||
<div id="pod_dropdown_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -495,7 +495,6 @@
|
|||
<option value="XenServer" SELECTED>Xen Server</option>
|
||||
<option value="KVM">KVM</option>
|
||||
<option value="VmWare">VMware</option>
|
||||
<option value="">Auto</option>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
|
|
@ -506,27 +505,63 @@
|
|||
<div id="pod_dropdown_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
<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>
|
||||
<label for="user_name">
|
||||
<li input_group="general">
|
||||
<label for="host_password">
|
||||
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>
|
||||
</label><span><u>Cluster Options</u></span> </li>
|
||||
|
|
@ -570,7 +605,7 @@
|
|||
<!-- Add Host Dialog in zone page (end) -->
|
||||
|
||||
<!-- Add Hypervisor managed cluster Dialog (begin) -->
|
||||
<div id="dialog_add_external_cluster_in_zone_page" title="Add External Cluster" style="display: none">
|
||||
<div id="dialog_add_external_cluster_in_zone_page" title="Add Cluster" style="display: none">
|
||||
<p>
|
||||
Add a hypervisor managed cluster for zone <b><span id="zone_name"></span></b>
|
||||
</p>
|
||||
|
|
@ -589,8 +624,8 @@
|
|||
<label>
|
||||
Cluster Type:</label>
|
||||
<select class="select" id="type_dropdown">
|
||||
<option value="CloudManaged">CloudManaged</option>
|
||||
<option value="ExternalManaged" SELECTED>ExternalManaged</option>
|
||||
<option value="CloudManaged">Cloud.com Managed</option>
|
||||
<option value="ExternalManaged" SELECTED>vSphere Managed</option>
|
||||
</select>
|
||||
<div id="pod_dropdown_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ function clusterJsonToRightPanel($leftmenuItem1) {
|
|||
clearAddButtonsOnTop();
|
||||
if(objCluster.clustertype == "CloudManaged")
|
||||
initAddHostButton($("#midmenu_add_host_button"), "cluster_page", $leftmenuItem1);
|
||||
else
|
||||
$("#midmenu_add_host_button").hide();
|
||||
|
||||
initAddPrimaryStorageButton($("#midmenu_add_primarystorage_button"), "cluster_page", $leftmenuItem1);
|
||||
|
||||
|
|
|
|||
|
|
@ -240,9 +240,15 @@ function getIpRange(startip, endip) {
|
|||
return ipRange;
|
||||
}
|
||||
|
||||
function refreshClsuterFieldInAddHostDialog(dialogAddHost, podId, clusterId) {
|
||||
function refreshClsuterFieldInAddHostDialog(dialogAddHost, podId, clusterId, hypervisorType) {
|
||||
var arrayParams = [];
|
||||
arrayParams.push("&podid=" + podId);
|
||||
arrayParams.push("&hypervisor=" + hypervisorType);
|
||||
if(hypervisorType == "VmWare")
|
||||
arrayParams.push("&clustertype=CloudManaged");
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=listClusters&podid="+podId),
|
||||
data: createURL("command=listClusters"+arrayParams.join("")),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var items = json.listclustersresponse.cluster;
|
||||
|
|
@ -281,18 +287,18 @@ function initAddClusterButton($button, currentPageInRightPanel, $leftmenuItem1)
|
|||
|
||||
dialogAddCluster.find("#cluster_hypervisor").change(function() {
|
||||
if($(this).val() == "VmWare") {
|
||||
$('li[input_group]="vmware"', dialogAddCluster).show();
|
||||
$('li[input_group="vmware"]', dialogAddCluster).show();
|
||||
dialogAddCluster.find("#type_dropdown").change();
|
||||
} else {
|
||||
$('li[input_group]="vmware"', dialogAddCluster).hide();
|
||||
$('li[input_group="vmware"]', dialogAddCluster).hide();
|
||||
}
|
||||
}).change();
|
||||
|
||||
dialogAddCluster.find("#type_dropdown").change(function() {
|
||||
if($(this).val() == "ExternalManaged") {
|
||||
$('li[input_sub_group]="external"', dialogAddCluster).show();
|
||||
$('li[input_sub_group="external"]', dialogAddCluster).show();
|
||||
} else {
|
||||
$('li[input_sub_group]="external"', dialogAddCluster).hide();
|
||||
$('li[input_sub_group="external"]', dialogAddCluster).hide();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -417,20 +423,41 @@ function initAddHostButton($button, currentPageInRightPanel, $leftmenuItem1) {
|
|||
dialogAddHost.find("#pod_name").text(fromdb(primarystorageObj.podname));
|
||||
}
|
||||
|
||||
refreshClsuterFieldInAddHostDialog(dialogAddHost, podId, clusterId);
|
||||
|
||||
refreshClsuterFieldInAddHostDialog(dialogAddHost, podId, clusterId, dialogAddHost.find("#host_hypervisor").val());
|
||||
|
||||
dialogAddHost.find("#host_hypervisor").change(function() {
|
||||
if($(this).val() == "VmWare") {
|
||||
$('li[input_group="vmware"]', dialogAddHost).show();
|
||||
$('li[input_group="general"]', dialogAddHost).hide();
|
||||
} else {
|
||||
$('li[input_group="vmware"]', dialogAddHost).hide();
|
||||
$('li[input_group="general"]', dialogAddHost).show();
|
||||
}
|
||||
|
||||
refreshClsuterFieldInAddHostDialog(dialogAddHost, podId, null, $(this).val());
|
||||
}).change();
|
||||
|
||||
dialogAddHost
|
||||
.dialog('option', 'buttons', {
|
||||
"Add": function() {
|
||||
var $thisDialog = $(this);
|
||||
|
||||
var hypervisor = $thisDialog.find("#host_hypervisor").val();
|
||||
var clusterRadio = $thisDialog.find("input[name=cluster]:checked").val();
|
||||
|
||||
// validate values
|
||||
var isValid = true;
|
||||
isValid &= validateString("Host name", $thisDialog.find("#host_hostname"), $thisDialog.find("#host_hostname_errormsg"));
|
||||
isValid &= validateString("User name", $thisDialog.find("#host_username"), $thisDialog.find("#host_username_errormsg"));
|
||||
isValid &= validateString("Password", $thisDialog.find("#host_password"), $thisDialog.find("#host_password_errormsg"));
|
||||
if(hypervisor == "VmWare") {
|
||||
isValid &= validateString("vCenter Address", $thisDialog.find("#host_vcenter_address"), $thisDialog.find("#host_vcenter_address_errormsg"));
|
||||
isValid &= validateString("vCenter User", $thisDialog.find("#host_vcenter_username"), $thisDialog.find("#host_vcenter_username_errormsg"));
|
||||
isValid &= validateString("vCenter Password", $thisDialog.find("#host_vcenter_password"), $thisDialog.find("#host_vcenter_password_errormsg"));
|
||||
isValid &= validateString("vCenter Datacenter", $thisDialog.find("#host_vcenter_dc"), $thisDialog.find("#host_vcenter_dc_errormsg"));
|
||||
isValid &= validateString("vCenter Host", $thisDialog.find("#host_vcenter_host"), $thisDialog.find("#host_vcenter_host_errormsg"));
|
||||
} else {
|
||||
isValid &= validateString("Host name", $thisDialog.find("#host_hostname"), $thisDialog.find("#host_hostname_errormsg"));
|
||||
isValid &= validateString("User name", $thisDialog.find("#host_username"), $thisDialog.find("#host_username_errormsg"));
|
||||
isValid &= validateString("Password", $thisDialog.find("#host_password"), $thisDialog.find("#host_password_errormsg"));
|
||||
}
|
||||
if(clusterRadio == "new_cluster_radio") {
|
||||
isValid &= validateString("Cluster Name", $thisDialog.find("#new_cluster_name"), $thisDialog.find("#new_cluster_name_errormsg"));
|
||||
}
|
||||
|
|
@ -441,18 +468,11 @@ function initAddHostButton($button, currentPageInRightPanel, $leftmenuItem1) {
|
|||
|
||||
var array1 = [];
|
||||
var hypervisor = $thisDialog.find("#host_hypervisor").val();
|
||||
if(hypervisor.length > 0)
|
||||
array1.push("&hypervisor="+hypervisor);
|
||||
|
||||
array1.push("&hypervisor="+hypervisor);
|
||||
array1.push("&clustertype=CloudManaged");
|
||||
array1.push("&zoneId="+zoneId);
|
||||
array1.push("&podId="+podId);
|
||||
|
||||
var username = trim($thisDialog.find("#host_username").val());
|
||||
array1.push("&username="+todb(username));
|
||||
|
||||
var password = trim($thisDialog.find("#host_password").val());
|
||||
array1.push("&password="+todb(password));
|
||||
|
||||
var newClusterName, existingClusterId;
|
||||
if(clusterRadio == "new_cluster_radio") {
|
||||
newClusterName = trim($thisDialog.find("#new_cluster_name").val());
|
||||
|
|
@ -464,16 +484,39 @@ function initAddHostButton($button, currentPageInRightPanel, $leftmenuItem1) {
|
|||
if (existingClusterId != '-1') {
|
||||
array1.push("&clusterid="+existingClusterId);
|
||||
}
|
||||
}
|
||||
|
||||
var hostname = trim($thisDialog.find("#host_hostname").val());
|
||||
var url;
|
||||
if(hostname.indexOf("http://")==-1)
|
||||
url = "http://" + todb(hostname);
|
||||
else
|
||||
url = hostname;
|
||||
array1.push("&url="+todb(url));
|
||||
|
||||
}
|
||||
if(hypervisor == "VmWare") {
|
||||
var username = trim($thisDialog.find("#host_vcenter_username").val());
|
||||
array1.push("&username="+todb(username));
|
||||
|
||||
var password = trim($thisDialog.find("#host_vcenter_password").val());
|
||||
array1.push("&password="+todb(password));
|
||||
|
||||
var hostname = trim($thisDialog.find("#host_vcenter_address").val());
|
||||
hostname += "/" + trim($thisDialog.find("#host_vcente_dc").val());
|
||||
hostname += "/" + trim($thisDialog.find("#host_vcenter_host").val());
|
||||
|
||||
var url;
|
||||
if(hostname.indexOf("http://")==-1)
|
||||
url = "http://" + todb(hostname);
|
||||
else
|
||||
url = hostname;
|
||||
array1.push("&url="+todb(url));
|
||||
} else {
|
||||
var username = trim($thisDialog.find("#host_username").val());
|
||||
array1.push("&username="+todb(username));
|
||||
|
||||
var password = trim($thisDialog.find("#host_password").val());
|
||||
array1.push("&password="+todb(password));
|
||||
|
||||
var hostname = trim($thisDialog.find("#host_hostname").val());
|
||||
var url;
|
||||
if(hostname.indexOf("http://")==-1)
|
||||
url = "http://" + todb(hostname);
|
||||
else
|
||||
url = hostname;
|
||||
array1.push("&url="+todb(url));
|
||||
}
|
||||
//var $midmenuItem1 = beforeAddingMidMenuItem() ;
|
||||
|
||||
$.ajax({
|
||||
|
|
@ -506,7 +549,7 @@ function initAddHostButton($button, currentPageInRightPanel, $leftmenuItem1) {
|
|||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
handleError(XMLHttpResponse, function() {
|
||||
refreshClsuterFieldInAddHostDialog($thisDialog, podId, null);
|
||||
refreshClsuterFieldInAddHostDialog($thisDialog, podId, null, dialogAddHost.find("#host_hypervisor").val());
|
||||
handleErrorInDialog(XMLHttpResponse, $thisDialog);
|
||||
if(clusterRadio == "new_cluster_radio") { //*** new cluster ***
|
||||
refreshClusterUnderPod($("#pod_" + podId), newClusterName, null, true); //refresh clusters under pod, but no clicking at any cluster
|
||||
|
|
|
|||
|
|
@ -1004,18 +1004,18 @@ function initAddClusterButtonOnZonePage($button, zoneId, zoneName) {
|
|||
|
||||
$dialogAddCluster.find("#cluster_hypervisor").change(function() {
|
||||
if($(this).val() == "VmWare") {
|
||||
$('li[input_group]="vmware"', $dialogAddCluster).show();
|
||||
$('li[input_group="vmware"]', $dialogAddCluster).show();
|
||||
$dialogAddCluster.find("#type_dropdown").change();
|
||||
} else {
|
||||
$('li[input_group]="vmware"', $dialogAddCluster).hide();
|
||||
$('li[input_group="vmware"]', $dialogAddCluster).hide();
|
||||
}
|
||||
}).change();
|
||||
|
||||
$dialogAddCluster.find("#type_dropdown").change(function() {
|
||||
if($(this).val() == "ExternalManaged") {
|
||||
$('li[input_sub_group]="external"', $dialogAddCluster).show();
|
||||
$('li[input_sub_group="external"]', $dialogAddCluster).show();
|
||||
} else {
|
||||
$('li[input_sub_group]="external"', $dialogAddCluster).hide();
|
||||
$('li[input_sub_group="external"]', $dialogAddCluster).hide();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -1114,8 +1114,10 @@ function initAddHostButtonOnZonePage($button, zoneId, zoneName) {
|
|||
$podSelect.bind("change", function(event) {
|
||||
var podId = $(this).val();
|
||||
if(podId == null || podId.length == 0)
|
||||
return;
|
||||
refreshClsuterFieldInAddHostDialog($dialogAddHost, podId, null);
|
||||
return;
|
||||
|
||||
var hypervisorType = $dialogAddHost.find("#host_hypervisor");
|
||||
refreshClsuterFieldInAddHostDialog($dialogAddHost, podId, null, hypervisorType);
|
||||
});
|
||||
|
||||
$button.unbind("click").bind("click", function(event) {
|
||||
|
|
@ -1137,21 +1139,44 @@ function initAddHostButtonOnZonePage($button, zoneId, zoneName) {
|
|||
$podSelect.change();
|
||||
}
|
||||
});
|
||||
|
||||
$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());
|
||||
}).change();
|
||||
|
||||
$dialogAddHost
|
||||
.dialog('option', 'buttons', {
|
||||
"Add": function() {
|
||||
var $thisDialog = $(this);
|
||||
|
||||
var hypervisor = $thisDialog.find("#host_hypervisor").val();
|
||||
var clusterRadio = $thisDialog.find("input[name=cluster]:checked").val();
|
||||
|
||||
// validate values
|
||||
var isValid = true;
|
||||
isValid &= validateDropDownBox("Pod", $thisDialog.find("#pod_dropdown"), $thisDialog.find("#pod_dropdown_errormsg"));
|
||||
isValid &= validateString("Host name", $thisDialog.find("#host_hostname"), $thisDialog.find("#host_hostname_errormsg"));
|
||||
isValid &= validateString("User name", $thisDialog.find("#host_username"), $thisDialog.find("#host_username_errormsg"));
|
||||
isValid &= validateString("Password", $thisDialog.find("#host_password"), $thisDialog.find("#host_password_errormsg"));
|
||||
if(clusterRadio == "new_cluster_radio") {
|
||||
isValid &= validateDropDownBox("Pod", $thisDialog.find("#pod_dropdown"), $thisDialog.find("#pod_dropdown_errormsg"));
|
||||
|
||||
if(hypervisor == "VmWare") {
|
||||
isValid &= validateString("vCenter Address", $thisDialog.find("#host_vcenter_address"), $thisDialog.find("#host_vcenter_address_errormsg"));
|
||||
isValid &= validateString("vCenter User", $thisDialog.find("#host_vcenter_username"), $thisDialog.find("#host_vcenter_username_errormsg"));
|
||||
isValid &= validateString("vCenter Password", $thisDialog.find("#host_vcenter_password"), $thisDialog.find("#host_vcenter_password_errormsg"));
|
||||
isValid &= validateString("vCenter Datacenter", $thisDialog.find("#host_vcenter_dc"), $thisDialog.find("#host_vcenter_dc_errormsg"));
|
||||
isValid &= validateString("vCenter Host", $thisDialog.find("#host_vcenter_host"), $thisDialog.find("#host_vcenter_host_errormsg"));
|
||||
} else {
|
||||
isValid &= validateString("Host name", $thisDialog.find("#host_hostname"), $thisDialog.find("#host_hostname_errormsg"));
|
||||
isValid &= validateString("User name", $thisDialog.find("#host_username"), $thisDialog.find("#host_username_errormsg"));
|
||||
isValid &= validateString("Password", $thisDialog.find("#host_password"), $thisDialog.find("#host_password_errormsg"));
|
||||
}
|
||||
|
||||
if(clusterRadio == "new_cluster_radio") {
|
||||
isValid &= validateString("Cluster Name", $thisDialog.find("#new_cluster_name"), $thisDialog.find("#new_cluster_name_errormsg"));
|
||||
}
|
||||
if (!isValid)
|
||||
|
|
@ -1161,10 +1186,8 @@ function initAddHostButtonOnZonePage($button, zoneId, zoneName) {
|
|||
|
||||
var array1 = [];
|
||||
|
||||
var hypervisor = $thisDialog.find("#host_hypervisor").val();
|
||||
if(hypervisor.length > 0)
|
||||
array1.push("&hypervisor="+hypervisor);
|
||||
|
||||
array1.push("&hypervisor="+hypervisor);
|
||||
array1.push("&clustertype=CloudManaged");
|
||||
array1.push("&zoneid="+zoneId);
|
||||
|
||||
//expand zone in left menu tree (to show pod, cluster under the zone)
|
||||
|
|
@ -1174,13 +1197,7 @@ function initAddHostButtonOnZonePage($button, zoneId, zoneName) {
|
|||
|
||||
var podId = $thisDialog.find("#pod_dropdown").val();
|
||||
array1.push("&podid="+podId);
|
||||
|
||||
var username = trim($thisDialog.find("#host_username").val());
|
||||
array1.push("&username="+todb(username));
|
||||
|
||||
var password = trim($thisDialog.find("#host_password").val());
|
||||
array1.push("&password="+todb(password));
|
||||
|
||||
|
||||
var newClusterName, existingClusterId;
|
||||
if(clusterRadio == "new_cluster_radio") {
|
||||
newClusterName = trim($thisDialog.find("#new_cluster_name").val());
|
||||
|
|
@ -1193,14 +1210,40 @@ function initAddHostButtonOnZonePage($button, zoneId, zoneName) {
|
|||
array1.push("&clusterid="+existingClusterId);
|
||||
}
|
||||
}
|
||||
|
||||
var hostname = trim($thisDialog.find("#host_hostname").val());
|
||||
var url;
|
||||
if(hostname.indexOf("http://")==-1)
|
||||
url = "http://" + todb(hostname);
|
||||
else
|
||||
url = hostname;
|
||||
array1.push("&url="+todb(url));
|
||||
|
||||
if(hypervisor == "VmWare") {
|
||||
var username = trim($thisDialog.find("#host_vcenter_username").val());
|
||||
array1.push("&username="+todb(username));
|
||||
|
||||
var password = trim($thisDialog.find("#host_vcenter_password").val());
|
||||
array1.push("&password="+todb(password));
|
||||
|
||||
var hostname = trim($thisDialog.find("#host_vcenter_address").val());
|
||||
hostname += "/" + trim($thisDialog.find("#host_vcente_dc").val());
|
||||
hostname += "/" + trim($thisDialog.find("#host_vcenter_host").val());
|
||||
|
||||
var url;
|
||||
if(hostname.indexOf("http://")==-1)
|
||||
url = "http://" + todb(hostname);
|
||||
else
|
||||
url = hostname;
|
||||
array1.push("&url="+todb(url));
|
||||
|
||||
} else {
|
||||
var username = trim($thisDialog.find("#host_username").val());
|
||||
array1.push("&username="+todb(username));
|
||||
|
||||
var password = trim($thisDialog.find("#host_password").val());
|
||||
array1.push("&password="+todb(password));
|
||||
|
||||
var hostname = trim($thisDialog.find("#host_hostname").val());
|
||||
var url;
|
||||
if(hostname.indexOf("http://")==-1)
|
||||
url = "http://" + todb(hostname);
|
||||
else
|
||||
url = hostname;
|
||||
array1.push("&url="+todb(url));
|
||||
}
|
||||
|
||||
//var $midmenuItem1 = beforeAddingMidMenuItem() ;
|
||||
|
||||
|
|
@ -1234,7 +1277,7 @@ function initAddHostButtonOnZonePage($button, zoneId, zoneName) {
|
|||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
handleError(XMLHttpResponse, function() {
|
||||
refreshClsuterFieldInAddHostDialog($thisDialog, podId, null);
|
||||
refreshClsuterFieldInAddHostDialog($thisDialog, podId, null, $dialogAddHost.find("#host_hypervisor").val());
|
||||
handleErrorInDialog(XMLHttpResponse, $thisDialog);
|
||||
if(clusterRadio == "new_cluster_radio") { //*** new cluster ***
|
||||
refreshClusterUnderPod($("#pod_" + podId), newClusterName, null, true); //refresh clusters under pod, but no clicking at any cluster
|
||||
|
|
|
|||
Loading…
Reference in New Issue