Add clustertype field to response of ListHostCmd. Improve UI display related with cluster/host

This commit is contained in:
Kelven Yang 2010-12-20 14:08:44 -08:00
parent 291a9669e7
commit 228eba363b
10 changed files with 104 additions and 18 deletions

View File

@ -119,6 +119,9 @@ public class HostResponse extends BaseResponse {
@SerializedName("clustername") @Param(description="the cluster name of the host")
private String clusterName;
@SerializedName("clustertype") @Param(description="the cluster type of the cluster that host belongs to")
private String clusterType;
@SerializedName("islocalstorageactive") @Param(description="true if local storage is active, false otherwise")
private Boolean localStorageActive;
@ -389,6 +392,14 @@ public class HostResponse extends BaseResponse {
public void setClusterName(String clusterName) {
this.clusterName = clusterName;
}
public String getClusterType() {
return clusterType;
}
public void setClusterType(String clusterType) {
this.clusterType = clusterType;
}
public Boolean isLocalStorageActive() {
return localStorageActive;

View File

@ -519,6 +519,7 @@ public class ApiResponseHelper implements ResponseGenerator {
if (host.getClusterId() != null) {
ClusterVO cluster = ApiDBUtils.findClusterById(host.getClusterId());
hostResponse.setClusterName(cluster.getName());
hostResponse.setClusterType(cluster.getClusterType().toString());
}
hostResponse.setLocalStorageActive(ApiDBUtils.isLocalStorageActiveOnHost(host));

View File

@ -94,31 +94,66 @@
<option value="XenServer" SELECTED>Xen Server</option>
<option value="KVM">KVM</option>
<option value="VmWare">VMware</option>
<option value="">Auto</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">
<input type="radio" name="cluster" value="no_cluster_radio" />&nbsp;Standalone</label>
<label>
&nbsp;</label><span><u>Cluster Options</u></span> </li>
<li id="new_cluster_radio_container">
@ -137,7 +172,6 @@
</li>
<li id="no_cluster_radio_container">
<label>
<input type="radio" name="cluster" value="no_cluster_radio" />&nbsp;Standalone</label>
<span style="padding-left: 20px"></span></li>
</ol>
</form>

View File

@ -835,30 +835,64 @@
<option value="XenServer" SELECTED>Xen Server</option>
<option value="KVM">KVM</option>
<option value="VmWare">VMware</option>
<option value="">Auto</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>
&nbsp;</label><span><u>Cluster Options</u></span> </li>

View File

@ -436,7 +436,7 @@
</li>
<li>
<label for="cluster_name">
<label for="cluster_name" id="cluster_name_label">
vCenter Cluster:</label>
<input class="text" type="text" name="cluster_name" id="cluster_name" />
<div id="cluster_name_errormsg" class="dialog_formcontent_errormsg" style="display: none;">

View File

@ -728,9 +728,8 @@
<div id="cluster_datacenter_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li>
<label for="cluster_name">
<label for="cluster_name" id="cluster_name_label">
vCenter Cluster:</label>
<input class="text" type="text" name="cluster_name" id="cluster_name" />
<div id="cluster_name_errormsg" class="dialog_formcontent_errormsg" style="display: none;">

View File

@ -36,10 +36,7 @@ function clusterJsonToRightPanel($leftmenuItem1) {
var objCluster = $leftmenuItem1.data("jsonObj");
clearButtonsOnTop();
if(objCluster.clustertype == "CloudManaged")
initAddHostButton($("#midmenu_add_host_button"), "cluster_page", $leftmenuItem1);
else
$("#midmenu_add_host_button").hide();
initAddHostButton($("#midmenu_add_host_button"), "cluster_page", $leftmenuItem1);
initAddPrimaryStorageButton($("#midmenu_add_primarystorage_button"), "cluster_page", $leftmenuItem1);

View File

@ -61,8 +61,12 @@ function hostToMidmenu(jsonObj, $midmenuItem1) {
var $iconContainer = $midmenuItem1.find("#icon_container").show();
$iconContainer.find("#icon").attr("src", "images/midmenuicon_host.png");
$midmenuItem1.find("#first_row").text(fromdb(jsonObj.name).substring(0,25));
$midmenuItem1.find("#second_row").text(jsonObj.ipaddress.substring(0,25));
$midmenuItem1.find("#first_row").text(fromdb(jsonObj.name).substring(0,25));
if(!!jsonObj.clustertype && jsonObj.clustertype == "ExternalManaged")
$midmenuItem1.find("#second_row").text("Externally managed cluster");
else
$midmenuItem1.find("#second_row").text(jsonObj.ipaddress.substring(0,25));
updateHostStateInMidMenu(jsonObj, $midmenuItem1);
}

View File

@ -294,14 +294,17 @@ function bindAddClusterButton($button, currentPageInRightPanel, $leftmenuItem1)
dialogAddCluster.find("#type_dropdown").change();
} else {
$('li[input_group="vmware"]', dialogAddCluster).hide();
$("#cluster_name_label", dialogAddCluster).text("Cluster:");
}
}).change();
dialogAddCluster.find("#type_dropdown").change(function() {
if($(this).val() == "ExternalManaged") {
$('li[input_sub_group="external"]', dialogAddCluster).show();
$("#cluster_name_label", dialogAddCluster).text("vCenter Cluster:");
} else {
$('li[input_sub_group="external"]', dialogAddCluster).hide();
$("#cluster_name_label", dialogAddCluster).text("Cluster:");
}
});

View File

@ -1012,14 +1012,17 @@ function bindAddClusterButtonOnZonePage($button, zoneId, zoneName) {
$dialogAddCluster.find("#type_dropdown").change();
} else {
$('li[input_group="vmware"]', $dialogAddCluster).hide();
$("#cluster_name_label", $dialogAddCluster).text("Cluster:");
}
}).change();
$dialogAddCluster.find("#type_dropdown").change(function() {
if($(this).val() == "ExternalManaged") {
$('li[input_sub_group="external"]', $dialogAddCluster).show();
$("#cluster_name_label", $dialogAddCluster).text("vCenter Cluster:");
} else {
$('li[input_sub_group="external"]', $dialogAddCluster).hide();
$("#cluster_name_label", $dialogAddCluster).text("Cluster:");
}
});