From 228eba363b6993911f8da349546a4253bd8b2c38 Mon Sep 17 00:00:00 2001 From: Kelven Yang Date: Mon, 20 Dec 2010 14:08:44 -0800 Subject: [PATCH] Add clustertype field to response of ListHostCmd. Improve UI display related with cluster/host --- .../com/cloud/api/response/HostResponse.java | 11 +++++ .../src/com/cloud/api/ApiResponseHelper.java | 1 + ui/jsp/cluster.jsp | 44 ++++++++++++++++--- ui/jsp/host.jsp | 42 ++++++++++++++++-- ui/jsp/pod.jsp | 2 +- ui/jsp/zone.jsp | 3 +- ui/scripts/cloud.core.cluster.js | 5 +-- ui/scripts/cloud.core.host.js | 8 +++- ui/scripts/cloud.core.pod.js | 3 ++ ui/scripts/cloud.core.zone.js | 3 ++ 10 files changed, 104 insertions(+), 18 deletions(-) diff --git a/api/src/com/cloud/api/response/HostResponse.java b/api/src/com/cloud/api/response/HostResponse.java index 059220fe410..7fb9e270a73 100755 --- a/api/src/com/cloud/api/response/HostResponse.java +++ b/api/src/com/cloud/api/response/HostResponse.java @@ -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; diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java index 7dec7f07366..4a9f7b54310 100644 --- a/server/src/com/cloud/api/ApiResponseHelper.java +++ b/server/src/com/cloud/api/ApiResponseHelper.java @@ -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)); diff --git a/ui/jsp/cluster.jsp b/ui/jsp/cluster.jsp index dd7cbc18604..46acf93b443 100644 --- a/ui/jsp/cluster.jsp +++ b/ui/jsp/cluster.jsp @@ -94,31 +94,66 @@ - -
  • +
  • -
  • +
  • -
  • +
  • +
  • + + + +
  • +
  • + + + +
  • +
  • + + + +
  • +
  • + + + +
  • +
  • + + + +
  • +  Standalone Cluster Options
  • @@ -137,7 +172,6 @@
  • diff --git a/ui/jsp/host.jsp b/ui/jsp/host.jsp index d4dd8cd7d10..6affb4291cd 100644 --- a/ui/jsp/host.jsp +++ b/ui/jsp/host.jsp @@ -835,30 +835,64 @@ - -
  • +
  • -
  • +
  • -
  • +
  • +
  • + + + +
  • +
  • + + + +
  • +
  • + + + +
  • +
  • + + + +
  • +
  • + + + +
  • Cluster Options
  • diff --git a/ui/jsp/pod.jsp b/ui/jsp/pod.jsp index 480432e3c55..0c8d39839a3 100644 --- a/ui/jsp/pod.jsp +++ b/ui/jsp/pod.jsp @@ -436,7 +436,7 @@
  • -
  • -
  • -