http://git-wip-us.apache.org/repos/asf/helix/blob/6cbafef0/helix-ui/src/main/java/org/apache/helix/ui/view/ResourceView.java ---------------------------------------------------------------------- diff --git a/helix-ui/src/main/java/org/apache/helix/ui/view/ResourceView.java b/helix-ui/src/main/java/org/apache/helix/ui/view/ResourceView.java new file mode 100644 index 0000000..f8367a0 --- /dev/null +++ b/helix-ui/src/main/java/org/apache/helix/ui/view/ResourceView.java @@ -0,0 +1,103 @@ +package org.apache.helix.ui.view; + +import io.dropwizard.views.View; +import org.apache.helix.ui.api.ConfigTableRow; +import org.apache.helix.ui.api.IdealStateSpec; +import org.apache.helix.ui.api.InstanceSpec; +import org.apache.helix.ui.api.ResourceStateTableRow; + +import java.io.IOException; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +public class ResourceView extends View { + private final boolean adminMode; + private final String zkAddress; + private final List<String> clusters; + private final boolean activeValid; + private final String activeCluster; + private final List<String> activeClusterResources; + private final String activeResource; + private final List<ResourceStateTableRow> resourceStateTable; + private final List<ConfigTableRow> configTable; + private final IdealStateSpec idealStateSpec; + private final List<InstanceSpec> instanceSpecs; + + public ResourceView(boolean adminMode, + String zkAddress, + List<String> clusters, + boolean activeValid, + String activeCluster, + List<String> activeClusterResources, + String activeResource, + List<ResourceStateTableRow> resourceStateTable, + Set<String> resourceInstances, + List<ConfigTableRow> configTable, + IdealStateSpec idealStateSpec, + List<InstanceSpec> instanceSpecs) { + super("resource-view.ftl"); + this.adminMode = adminMode; + this.zkAddress = zkAddress; + this.clusters = clusters; + this.activeValid = activeValid; + this.activeCluster = activeCluster; + this.activeClusterResources = activeClusterResources; + this.activeResource = activeResource; + this.resourceStateTable = resourceStateTable; + this.configTable = configTable; + this.idealStateSpec = idealStateSpec; + this.instanceSpecs = new ArrayList<InstanceSpec>(); + + for (InstanceSpec instanceSpec : instanceSpecs) { + if (resourceInstances.contains(instanceSpec.getInstanceName())) { + this.instanceSpecs.add(instanceSpec); + } + } + } + + public boolean isAdminMode() { + return adminMode; + } + + public String getZkAddress() throws IOException { + return URLEncoder.encode(zkAddress, "UTF-8"); + } + + public List<String> getClusters() { + return clusters; + } + + public boolean isActiveValid() { + return activeValid; + } + + public String getActiveCluster() { + return activeCluster; + } + + public List<String> getActiveClusterResources() { + return activeClusterResources; + } + + public List<InstanceSpec> getInstanceSpecs() { + return instanceSpecs; + } + + public String getActiveResource() { + return activeResource; + } + + public List<ResourceStateTableRow> getResourceStateTable() { + return resourceStateTable; + } + + public List<ConfigTableRow> getConfigTable() { + return configTable; + } + + public IdealStateSpec getIdealStateSpec() { + return idealStateSpec; + } +}
http://git-wip-us.apache.org/repos/asf/helix/blob/6cbafef0/helix-ui/src/main/resources/assets/css/app.css ---------------------------------------------------------------------- diff --git a/helix-ui/src/main/resources/assets/css/app.css b/helix-ui/src/main/resources/assets/css/app.css new file mode 100644 index 0000000..165941a --- /dev/null +++ b/helix-ui/src/main/resources/assets/css/app.css @@ -0,0 +1,92 @@ +/* all */ + +.table-button { + text-align: right; +} + +/* side-nav.ftl */ + +#panel-helix-logo { + text-align: center; +} + +#add-cluster-form { + margin-bottom: 1em; + margin-top: 1em; +} + +/* landing-view.ftl */ + +#landing-area { + text-align: center; + margin-top: 10%; +} + +#landing-area img { + margin: 5%; +} + +#landing-area form { + margin-left: auto; + margin-right: auto; + width: 50%; +} + +#landing-area input { + width: 80%; +} + +/* cluster-view.ftl */ + +#cluster-views-area { + margin-top: 2em; + margin-right: 2em; +} + +.non-live-instance { + background-color: #eee; +} + +#cluster-admin-form { + text-align: right; +} + +/* resource-state-table.ftl */ + +.filter-area { + margin-left: 5pt; + margin-top: 20pt; +} + +.state-ok { +} + +.state-warn { + background-color: #fffceb; +} + +.state-error { + background-color: #fff1f0; +} + +#filter-form input { + margin-left: 1em; +} + +#filter-form button { + margin-left: 1em; +} + +/* ideal-state-table.ftl */ + +.ideal-state-prop { + font-style: italic; +} + +.instance-disabled { + background-color: #fffceb; +} + +.instance-down { + background-color: #e5e5e5; +}
