You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chukwa.apache.org by ey...@apache.org on 2015/05/26 02:12:38 UTC
[03/19] chukwa git commit: CHUKWA-748. Refactor Chart and Series
package name. (Eric Yang)
CHUKWA-748. Refactor Chart and Series package name. (Eric Yang)
Project: http://git-wip-us.apache.org/repos/asf/chukwa/repo
Commit: http://git-wip-us.apache.org/repos/asf/chukwa/commit/0f9b5cf3
Tree: http://git-wip-us.apache.org/repos/asf/chukwa/tree/0f9b5cf3
Diff: http://git-wip-us.apache.org/repos/asf/chukwa/diff/0f9b5cf3
Branch: refs/heads/master
Commit: 0f9b5cf3f3956635123f5ab38e29d0e5dce4e6d9
Parents: 4134fc3
Author: Eric Yang <ey...@apache.org>
Authored: Sun May 10 16:32:17 2015 -0700
Committer: Eric Yang <ey...@apache.org>
Committed: Sun May 10 16:32:17 2015 -0700
----------------------------------------------------------------------
CHANGES.txt | 2 +
.../apache/hadoop/chukwa/hicc/BarOptions.java | 30 --
.../org/apache/hadoop/chukwa/hicc/Chart.java | 199 -----------
.../hadoop/chukwa/hicc/HiccWebServer.java | 15 -
.../apache/hadoop/chukwa/hicc/LineOptions.java | 25 --
.../apache/hadoop/chukwa/hicc/PointOptions.java | 27 --
.../org/apache/hadoop/chukwa/hicc/Series.java | 121 -------
.../hadoop/chukwa/hicc/SeriesOptions.java | 33 --
.../hadoop/chukwa/hicc/bean/BarOptions.java | 0
.../apache/hadoop/chukwa/hicc/bean/Chart.java | 199 +++++++++++
.../hadoop/chukwa/hicc/bean/LineOptions.java | 25 ++
.../hadoop/chukwa/hicc/bean/PointOptions.java | 27 ++
.../hadoop/chukwa/hicc/bean/SeriesMetaData.java | 120 +++++++
.../hadoop/chukwa/hicc/bean/SeriesOptions.java | 33 ++
.../chukwa/hicc/rest/ChartController.java | 27 +-
src/main/web/hicc/css/default.css | 5 +-
src/main/web/hicc/graph-explorer.html | 328 +++++++++++++++++++
src/main/web/hicc/js/flot.extend.js | 4 +-
src/main/web/hicc/jsp/graph_explorer.jsp | 318 ------------------
19 files changed, 749 insertions(+), 789 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/chukwa/blob/0f9b5cf3/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 5e3e93c..f8b4890 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -8,6 +8,8 @@ Trunk (unreleased changes)
CHUKWA-737. Heartbeat adaptor to push status to remote http server (Shreyas Subramanya)
+ CHUKWA-747. Update Widget API to store data in HBase. (Eric Yang)
+
IMPROVEMENTS
CHUKWA-745. Improved chart configuration management. (Eric Yang)
http://git-wip-us.apache.org/repos/asf/chukwa/blob/0f9b5cf3/src/main/java/org/apache/hadoop/chukwa/hicc/BarOptions.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/BarOptions.java b/src/main/java/org/apache/hadoop/chukwa/hicc/BarOptions.java
deleted file mode 100644
index 9ab686d..0000000
--- a/src/main/java/org/apache/hadoop/chukwa/hicc/BarOptions.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.chukwa.hicc;
-
-public class BarOptions extends SeriesOptions {
- public boolean zero;
- public boolean stepByStep = true;
- public int barWidth = 4;
- public String align;
- public boolean horizontal;
-
- public BarOptions() {
- fill = true;
- }
-}
http://git-wip-us.apache.org/repos/asf/chukwa/blob/0f9b5cf3/src/main/java/org/apache/hadoop/chukwa/hicc/Chart.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/Chart.java b/src/main/java/org/apache/hadoop/chukwa/hicc/Chart.java
deleted file mode 100644
index ab6dc4e..0000000
--- a/src/main/java/org/apache/hadoop/chukwa/hicc/Chart.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.chukwa.hicc;
-
-
-import java.util.HashMap;
-import java.util.List;
-
-public class Chart {
- private String id;
- private String title;
- private List<Series> series;
- private boolean xLabelOn;
- private boolean yLabelOn;
- private boolean yRightLabelOn;
- private int width;
- private int height;
- private List<String> xLabelRange;
- private HashMap<String, Long> xLabelRangeHash;
- private boolean legend = true;
- private String xLabel = "";
- private String yLabel = "";
- private String yRightLabel = "";
- private double max = 0;
- private double min = 0;
- private boolean userDefinedMax = true;
- private boolean userDefinedMin = true;
- private String yUnitType = "";
-
- public Chart(String id) {
- this.id = id;
- this.title = "Untitled Chart";
- this.xLabelOn = true;
- this.yLabelOn = true;
- this.width = 100;
- this.height = 100;
- this.legend = true;
- this.max = 0;
- this.userDefinedMax = false;
- this.userDefinedMin = false;
- }
-
- public void setYMax(double max) {
- this.max = max;
- this.userDefinedMax = true;
- }
-
- public double getYMax() {
- return this.max;
- }
-
- public boolean getUserDefinedMax() {
- return this.userDefinedMax;
- }
-
- public void setYMin(double min) {
- this.min = min;
- this.userDefinedMin = true;
- }
-
- public double getYMin() {
- return this.min;
- }
-
- public boolean getUserDefinedMin() {
- return this.userDefinedMin;
- }
-
- public void setSize(int width, int height) {
- this.width = width;
- this.height = height;
- }
-
- public int getWidth() {
- return this.width;
- }
-
- public int getHeight() {
- return this.height;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public String getTitle() {
- return this.title;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getId() {
- return this.id;
- }
-
- public void SetSeries(List<Series> series) {
- this.series = series;
- }
-
- public List<Series> getSeries() {
- return this.series;
- }
-
- public void setXAxisLabelsOn(boolean toggle) {
- xLabelOn = toggle;
- }
-
- public boolean isXAxisLabelsOn() {
- return xLabelOn;
- }
-
- public void setYAxisLabels(boolean toggle) {
- yLabelOn = toggle;
- }
-
- public boolean isYAxisLabelsOn() {
- return yLabelOn;
- }
-
- public void setYAxisRightLabels(boolean toggle) {
- yRightLabelOn = toggle;
- }
-
- public boolean isYAxisRightLabelsOn() {
- return yRightLabelOn;
- }
-
- public void setXAxisLabel(String label) {
- xLabel = label;
- }
-
- public String getXAxisLabel() {
- return xLabel;
- }
-
- public void setYAxisLabel(String label) {
- yLabel = label;
- }
-
- public String getYAxisLabel() {
- return yLabel;
- }
-
- public void setYAxisRightLabel(String label) {
- yRightLabel = label;
- }
-
- public String getYAxisRightLabel() {
- return yRightLabel;
- }
-
- public void setXLabelsRange(List<String> range) {
- xLabelRange = range;
- xLabelRangeHash = new HashMap<String, Long>();
- long value = 0;
- for (String label : range) {
- xLabelRangeHash.put(label, value);
- value++;
- }
- }
-
- public List<String> getXLabelsRange() {
- return xLabelRange;
- }
-
- public void setLegend(boolean toggle) {
- legend = toggle;
- }
-
- public boolean getLegend() {
- return legend;
- }
-
- public void setYUnitType(String yUnitType) {
- this.yUnitType = yUnitType;
- }
-
- public String getYUnitType() {
- return this.yUnitType;
- }
-}
http://git-wip-us.apache.org/repos/asf/chukwa/blob/0f9b5cf3/src/main/java/org/apache/hadoop/chukwa/hicc/HiccWebServer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/HiccWebServer.java b/src/main/java/org/apache/hadoop/chukwa/hicc/HiccWebServer.java
index ea53941..073fc35 100644
--- a/src/main/java/org/apache/hadoop/chukwa/hicc/HiccWebServer.java
+++ b/src/main/java/org/apache/hadoop/chukwa/hicc/HiccWebServer.java
@@ -191,21 +191,6 @@ public class HiccWebServer {
List<String> views = getResourceListing("views");
populateDir(views, viewsPath);
- // Populate example chart widgets
- Chart chart = new Chart("1");
- chart.setYUnitType("");
- chart.setTitle("Load Average");
- ArrayList<Series> series = new ArrayList<Series>();
-
- Series s = new Series();
- s.setLabel("SystemMetrics.LoadAverage.1/Erics-MacBook-Pro.local");
- s.setUrl(new URI("/hicc/v1/metrics/series/SystemMetrics.LoadAverage.1/Erics-MacBook-Pro.local"));
- LineOptions l = new LineOptions();
- s.setLineOptions(l);
- series.add(s);
-
- chart.SetSeries(series);
- ChukwaHBaseStore.createChart(chart);
log.info("HICC Datastore initialization completed.");
}
} catch (IOException ex) {
http://git-wip-us.apache.org/repos/asf/chukwa/blob/0f9b5cf3/src/main/java/org/apache/hadoop/chukwa/hicc/LineOptions.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/LineOptions.java b/src/main/java/org/apache/hadoop/chukwa/hicc/LineOptions.java
deleted file mode 100644
index f0e1279..0000000
--- a/src/main/java/org/apache/hadoop/chukwa/hicc/LineOptions.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.chukwa.hicc;
-
-public class LineOptions extends SeriesOptions {
- public boolean zero;
- public boolean steps;
-
-
-}
http://git-wip-us.apache.org/repos/asf/chukwa/blob/0f9b5cf3/src/main/java/org/apache/hadoop/chukwa/hicc/PointOptions.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/PointOptions.java b/src/main/java/org/apache/hadoop/chukwa/hicc/PointOptions.java
deleted file mode 100644
index dedea86..0000000
--- a/src/main/java/org/apache/hadoop/chukwa/hicc/PointOptions.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.chukwa.hicc;
-
-public class PointOptions extends SeriesOptions {
- public int radius;
- public String symbol = "circle";
-
- public PointOptions() {
- radius = 5;
- }
-}
http://git-wip-us.apache.org/repos/asf/chukwa/blob/0f9b5cf3/src/main/java/org/apache/hadoop/chukwa/hicc/Series.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/Series.java b/src/main/java/org/apache/hadoop/chukwa/hicc/Series.java
deleted file mode 100644
index 4906059..0000000
--- a/src/main/java/org/apache/hadoop/chukwa/hicc/Series.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.chukwa.hicc;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-public class Series implements Cloneable {
-
- @XmlElement
- public URI url;
- @XmlElement
- public String color;
- @XmlElement
- public String label;
- @XmlElement
- public LineOptions lines;
- @XmlElement
- public BarOptions bars;
- @XmlElement
- public PointOptions points;
- @XmlElement
- public int xaxis;
- @XmlElement
- public int yaxis;
- @XmlElement
- public boolean clickable;
- @XmlElement
- public boolean hoverable;
- @XmlElement
- public int shadowSize;
- @XmlElement
- public int highlightColor;
- public ArrayList<ArrayList<Number>> data = null;
-
- public Series() {
-
- }
-
- public void setUrl(URI url) {
- this.url = url;
- }
-
- public URI getUrl() {
- return url;
- }
-
- public void setLineOptions(LineOptions lines) {
- this.lines = lines;
-
- }
-
- public LineOptions getLineOptions() {
- return lines;
- }
-
- public void setBarOptions(BarOptions bars) {
- this.bars = bars;
- }
-
- public BarOptions getBarOptions() {
- return bars;
- }
-
- public void setPointOptions(PointOptions points) {
- this.points = points;
- }
-
- public PointOptions getPointOptions() {
- return points;
- }
-
- public void setColor(String color) {
- this.color = color;
- }
-
- public String getColor() {
- return color;
- }
-
- public void setData(ArrayList<ArrayList<Number>> data) {
- this.data = data;
- }
-
- public ArrayList<ArrayList<Number>> getData() {
- return data;
- }
-
- public void setLabel(String label) {
- this.label = label;
- }
-
- public String getLabel() {
- return label;
- }
-
- @Override
- public Object clone()throws CloneNotSupportedException{
- return super.clone();
- }
-}
http://git-wip-us.apache.org/repos/asf/chukwa/blob/0f9b5cf3/src/main/java/org/apache/hadoop/chukwa/hicc/SeriesOptions.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/SeriesOptions.java b/src/main/java/org/apache/hadoop/chukwa/hicc/SeriesOptions.java
deleted file mode 100644
index 74527d9..0000000
--- a/src/main/java/org/apache/hadoop/chukwa/hicc/SeriesOptions.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.chukwa.hicc;
-
-public class SeriesOptions {
- public boolean show = true;
- public boolean fill = false;
- public int lineWidth;
- public String fillColor;
-
- public boolean getFill() {
- return fill;
- }
-
- public void setFill(boolean fill) {
- this.fill = fill;
- }
-}
http://git-wip-us.apache.org/repos/asf/chukwa/blob/0f9b5cf3/src/main/java/org/apache/hadoop/chukwa/hicc/bean/BarOptions.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/bean/BarOptions.java b/src/main/java/org/apache/hadoop/chukwa/hicc/bean/BarOptions.java
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/chukwa/blob/0f9b5cf3/src/main/java/org/apache/hadoop/chukwa/hicc/bean/Chart.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/bean/Chart.java b/src/main/java/org/apache/hadoop/chukwa/hicc/bean/Chart.java
new file mode 100644
index 0000000..7c8c6a7
--- /dev/null
+++ b/src/main/java/org/apache/hadoop/chukwa/hicc/bean/Chart.java
@@ -0,0 +1,199 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.chukwa.hicc.bean;
+
+
+import java.util.HashMap;
+import java.util.List;
+
+public class Chart {
+ private String id;
+ private String title;
+ private List<SeriesMetaData> series;
+ private boolean xLabelOn;
+ private boolean yLabelOn;
+ private boolean yRightLabelOn;
+ private int width;
+ private int height;
+ private List<String> xLabelRange;
+ private HashMap<String, Long> xLabelRangeHash;
+ private boolean legend = true;
+ private String xLabel = "";
+ private String yLabel = "";
+ private String yRightLabel = "";
+ private double max = 0;
+ private double min = 0;
+ private boolean userDefinedMax = true;
+ private boolean userDefinedMin = true;
+ private String yUnitType = "";
+
+ public Chart(String id) {
+ this.id = id;
+ this.title = "Untitled Chart";
+ this.xLabelOn = true;
+ this.yLabelOn = true;
+ this.width = 100;
+ this.height = 100;
+ this.legend = true;
+ this.max = 0;
+ this.userDefinedMax = false;
+ this.userDefinedMin = false;
+ }
+
+ public void setYMax(double max) {
+ this.max = max;
+ this.userDefinedMax = true;
+ }
+
+ public double getYMax() {
+ return this.max;
+ }
+
+ public boolean getUserDefinedMax() {
+ return this.userDefinedMax;
+ }
+
+ public void setYMin(double min) {
+ this.min = min;
+ this.userDefinedMin = true;
+ }
+
+ public double getYMin() {
+ return this.min;
+ }
+
+ public boolean getUserDefinedMin() {
+ return this.userDefinedMin;
+ }
+
+ public void setSize(int width, int height) {
+ this.width = width;
+ this.height = height;
+ }
+
+ public int getWidth() {
+ return this.width;
+ }
+
+ public int getHeight() {
+ return this.height;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getTitle() {
+ return this.title;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getId() {
+ return this.id;
+ }
+
+ public void SetSeries(List<SeriesMetaData> series) {
+ this.series = series;
+ }
+
+ public List<SeriesMetaData> getSeries() {
+ return this.series;
+ }
+
+ public void setXAxisLabelsOn(boolean toggle) {
+ xLabelOn = toggle;
+ }
+
+ public boolean isXAxisLabelsOn() {
+ return xLabelOn;
+ }
+
+ public void setYAxisLabels(boolean toggle) {
+ yLabelOn = toggle;
+ }
+
+ public boolean isYAxisLabelsOn() {
+ return yLabelOn;
+ }
+
+ public void setYAxisRightLabels(boolean toggle) {
+ yRightLabelOn = toggle;
+ }
+
+ public boolean isYAxisRightLabelsOn() {
+ return yRightLabelOn;
+ }
+
+ public void setXAxisLabel(String label) {
+ xLabel = label;
+ }
+
+ public String getXAxisLabel() {
+ return xLabel;
+ }
+
+ public void setYAxisLabel(String label) {
+ yLabel = label;
+ }
+
+ public String getYAxisLabel() {
+ return yLabel;
+ }
+
+ public void setYAxisRightLabel(String label) {
+ yRightLabel = label;
+ }
+
+ public String getYAxisRightLabel() {
+ return yRightLabel;
+ }
+
+ public void setXLabelsRange(List<String> range) {
+ xLabelRange = range;
+ xLabelRangeHash = new HashMap<String, Long>();
+ long value = 0;
+ for (String label : range) {
+ xLabelRangeHash.put(label, value);
+ value++;
+ }
+ }
+
+ public List<String> getXLabelsRange() {
+ return xLabelRange;
+ }
+
+ public void setLegend(boolean toggle) {
+ legend = toggle;
+ }
+
+ public boolean getLegend() {
+ return legend;
+ }
+
+ public void setYUnitType(String yUnitType) {
+ this.yUnitType = yUnitType;
+ }
+
+ public String getYUnitType() {
+ return this.yUnitType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/chukwa/blob/0f9b5cf3/src/main/java/org/apache/hadoop/chukwa/hicc/bean/LineOptions.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/bean/LineOptions.java b/src/main/java/org/apache/hadoop/chukwa/hicc/bean/LineOptions.java
new file mode 100644
index 0000000..3cbb44d
--- /dev/null
+++ b/src/main/java/org/apache/hadoop/chukwa/hicc/bean/LineOptions.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.chukwa.hicc.bean;
+
+public class LineOptions extends SeriesOptions {
+ public boolean zero;
+ public boolean steps;
+
+
+}
http://git-wip-us.apache.org/repos/asf/chukwa/blob/0f9b5cf3/src/main/java/org/apache/hadoop/chukwa/hicc/bean/PointOptions.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/bean/PointOptions.java b/src/main/java/org/apache/hadoop/chukwa/hicc/bean/PointOptions.java
new file mode 100644
index 0000000..8d9ae6c
--- /dev/null
+++ b/src/main/java/org/apache/hadoop/chukwa/hicc/bean/PointOptions.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.chukwa.hicc.bean;
+
+public class PointOptions extends SeriesOptions {
+ public int radius;
+ public String symbol = "circle";
+
+ public PointOptions() {
+ radius = 5;
+ }
+}
http://git-wip-us.apache.org/repos/asf/chukwa/blob/0f9b5cf3/src/main/java/org/apache/hadoop/chukwa/hicc/bean/SeriesMetaData.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/bean/SeriesMetaData.java b/src/main/java/org/apache/hadoop/chukwa/hicc/bean/SeriesMetaData.java
new file mode 100644
index 0000000..e7eec39
--- /dev/null
+++ b/src/main/java/org/apache/hadoop/chukwa/hicc/bean/SeriesMetaData.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.chukwa.hicc.bean;
+
+import java.net.URI;
+import java.util.ArrayList;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class SeriesMetaData implements Cloneable {
+
+ @XmlElement
+ public URI url;
+ @XmlElement
+ public String color;
+ @XmlElement
+ public String label;
+ @XmlElement
+ public LineOptions lines;
+ @XmlElement
+ public BarOptions bars;
+ @XmlElement
+ public PointOptions points;
+ @XmlElement
+ public int xaxis;
+ @XmlElement
+ public int yaxis;
+ @XmlElement
+ public boolean clickable;
+ @XmlElement
+ public boolean hoverable;
+ @XmlElement
+ public int shadowSize;
+ @XmlElement
+ public int highlightColor;
+ public ArrayList<ArrayList<Number>> data = null;
+
+ public SeriesMetaData() {
+
+ }
+
+ public void setUrl(URI url) {
+ this.url = url;
+ }
+
+ public URI getUrl() {
+ return url;
+ }
+
+ public void setLineOptions(LineOptions lines) {
+ this.lines = lines;
+
+ }
+
+ public LineOptions getLineOptions() {
+ return lines;
+ }
+
+ public void setBarOptions(BarOptions bars) {
+ this.bars = bars;
+ }
+
+ public BarOptions getBarOptions() {
+ return bars;
+ }
+
+ public void setPointOptions(PointOptions points) {
+ this.points = points;
+ }
+
+ public PointOptions getPointOptions() {
+ return points;
+ }
+
+ public void setColor(String color) {
+ this.color = color;
+ }
+
+ public String getColor() {
+ return color;
+ }
+
+ public void setData(ArrayList<ArrayList<Number>> data) {
+ this.data = data;
+ }
+
+ public ArrayList<ArrayList<Number>> getData() {
+ return data;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ @Override
+ public Object clone()throws CloneNotSupportedException{
+ return super.clone();
+ }
+}
http://git-wip-us.apache.org/repos/asf/chukwa/blob/0f9b5cf3/src/main/java/org/apache/hadoop/chukwa/hicc/bean/SeriesOptions.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/bean/SeriesOptions.java b/src/main/java/org/apache/hadoop/chukwa/hicc/bean/SeriesOptions.java
new file mode 100644
index 0000000..1cdb40f
--- /dev/null
+++ b/src/main/java/org/apache/hadoop/chukwa/hicc/bean/SeriesOptions.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.chukwa.hicc.bean;
+
+public class SeriesOptions {
+ public boolean show = true;
+ public boolean fill = false;
+ public int lineWidth;
+ public String fillColor;
+
+ public boolean getFill() {
+ return fill;
+ }
+
+ public void setFill(boolean fill) {
+ this.fill = fill;
+ }
+}
http://git-wip-us.apache.org/repos/asf/chukwa/blob/0f9b5cf3/src/main/java/org/apache/hadoop/chukwa/hicc/rest/ChartController.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/ChartController.java b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/ChartController.java
index 93b8ab9..41ef551 100644
--- a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/ChartController.java
+++ b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/ChartController.java
@@ -17,12 +17,10 @@
*/
package org.apache.hadoop.chukwa.hicc.rest;
-import java.io.IOException;
import java.io.StringWriter;
import java.lang.reflect.Type;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
@@ -38,14 +36,13 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.hadoop.chukwa.datastore.ChukwaHBaseStore;
-import org.apache.hadoop.chukwa.hicc.Chart;
-import org.apache.hadoop.chukwa.hicc.Series;
import org.apache.hadoop.chukwa.hicc.TimeHandler;
+import org.apache.hadoop.chukwa.hicc.bean.Chart;
+import org.apache.hadoop.chukwa.hicc.bean.SeriesMetaData;
import org.apache.log4j.Logger;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
-import org.mortbay.log.Log;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
@@ -73,7 +70,7 @@ public class ChartController {
StringWriter sw = null;
try {
Chart chart = ChukwaHBaseStore.getChart(id);
- List<Series> series = chart.getSeries();
+ List<SeriesMetaData> series = chart.getSeries();
Gson gson = new Gson();
String seriesMetaData = gson.toJson(series);
@@ -112,15 +109,13 @@ public class ChartController {
@Path("save")
@Consumes(MediaType.APPLICATION_JSON)
public Response create(String buffer) {
- try {
- Gson gson = new Gson();
- Chart chart = gson.fromJson(buffer, Chart.class);
- String id = ChukwaHBaseStore.createChart(chart);
+ Gson gson = new Gson();
+ Chart chart = gson.fromJson(buffer, Chart.class);
+ String id = ChukwaHBaseStore.createChart(chart);
+ if (id != null) {
return Response.ok(id).build();
- } catch (IOException e) {
- return Responses.notAcceptable().build();
}
-
+ return Responses.notAcceptable().build();
}
/**
@@ -151,7 +146,7 @@ public class ChartController {
try {
Gson gson = new Gson();
Chart chart = gson.fromJson(buffer, Chart.class);
- List<Series> series = chart.getSeries();
+ List<SeriesMetaData> series = chart.getSeries();
String seriesMetaData = gson.toJson(series);
context.put("chart", chart);
@@ -170,7 +165,7 @@ public class ChartController {
@Path("preview/series")
@Produces("application/json")
public String previewSeries(@Context HttpServletRequest request, String buffer) {
- Type listType = new TypeToken<ArrayList<Series>>() {
+ Type listType = new TypeToken<ArrayList<SeriesMetaData>>() {
}.getType();
long startTime = 0;
long endTime = 0;
@@ -178,7 +173,7 @@ public class ChartController {
startTime = time.getStartTime();
endTime = time.getEndTime();
Gson gson = new Gson();
- ArrayList<Series> series = gson.fromJson(buffer, listType);
+ ArrayList<SeriesMetaData> series = gson.fromJson(buffer, listType);
series = ChukwaHBaseStore.getChartSeries(series, startTime, endTime);
String result = gson.toJson(series);
return result;
http://git-wip-us.apache.org/repos/asf/chukwa/blob/0f9b5cf3/src/main/web/hicc/css/default.css
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/css/default.css b/src/main/web/hicc/css/default.css
index 3a2741b..5c5e5bd 100644
--- a/src/main/web/hicc/css/default.css
+++ b/src/main/web/hicc/css/default.css
@@ -76,21 +76,19 @@ body {font-family:Oswald,Arial;background-color:#ffffff;}
z-index:25;
border:none;
text-decoration:none;
- filter:progid:DXImageTransform.Microsoft.Alpha(opacity=100);
opacity:1.00;
}
.glossy_icon:hover img {
z-index:25;
border:none;
- filter:progid:DXImageTransform.Microsoft.Alpha(opacity=100);
opacity:1.00;
}
.glossy_icon span{display: none}
.glossy_icon:hover span{ /*the span will display just on :hover state*/
- filter:progid:DXImageTransform.Microsoft.Alpha(opacity=100);
+ opacity: 1.00;
color:#000;
display:block;
position:absolute;
@@ -105,7 +103,6 @@ body {font-family:Oswald,Arial;background-color:#ffffff;}
.glossy_icon:disabled {
border:none;
- filter:progid:DXImageTransform.Microsoft.Alpha(opacity=25);
opacity:.25;
}
http://git-wip-us.apache.org/repos/asf/chukwa/blob/0f9b5cf3/src/main/web/hicc/graph-explorer.html
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/graph-explorer.html b/src/main/web/hicc/graph-explorer.html
new file mode 100644
index 0000000..44768c4
--- /dev/null
+++ b/src/main/web/hicc/graph-explorer.html
@@ -0,0 +1,328 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <link href="/hicc/css/default.css" rel="stylesheet" type="text/css">
+ <link href="/hicc/css/formalize.css" rel="stylesheet" type="text/css">
+ <script src="/hicc/js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
+ <script src="/hicc/js/jquery.formalize.js"></script>
+ <script src="/hicc/js/autoHeight.js" type="text/javascript" charset="utf-8"></script>
+ <script>
+ function randString(n) {
+ if(!n) {
+ n = 5;
+ }
+
+ var text = '';
+ var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
+
+ for(var i=0; i < n; i++) {
+ text += possible.charAt(Math.floor(Math.random() * possible.length));
+ }
+
+ return text;
+ }
+
+ var checkDataLength = function(curOption) {
+ return function(data) {
+ if (data.length == 0) {
+ curOption.attr('disabled', 'disabled');
+ }
+ }
+ };
+
+ $.ajax({ url: "/hicc/v1/metrics/schema", dataType: "json", success: function(data){
+ for(var i in data) {
+ $('#table').append("<option>"+data[i]+"</option>");
+ }
+ // Look through each table option and see if it has anything in its family?
+ $('#table').children().each(
+ function() {
+ var table = $(this).text();
+ $.ajax({ url: encodeURI("/hicc/v1/metrics/schema/"+table),
+ dataType: "json",
+ success: checkDataLength($(this))
+ });
+ }
+ );
+ }});
+
+
+ function getFamilies() {
+ var size = $('#family option').size();
+ $('#family').find('option').remove();
+ var table = $('#table').val();
+ $.ajax({ url: encodeURI("/hicc/v1/metrics/schema/"+table), dataType: "json", success: function(data){
+ for(var i in data) {
+ $('#family').append("<option>"+data[i]+"</option>");
+ }
+ // Look through each family option and see if it has any columns
+ var table = $('#table').val();
+ $('#family').children().each(
+ function() {
+ var family = $(this).text();
+ $.ajax({ url: encodeURI("/hicc/v1/metrics/source/"+table),
+ dataType: "json",
+ success: checkDataLength($(this))
+ });
+ }
+ );
+ }});
+ }
+
+ function getColumns() {
+ var size = $('#column option').size();
+ $('#column').find('option').remove();
+ var table = $('#table').val();
+ var family = $('#family').val();
+ $('#family :selected').each(function(i, selected) {
+ var family = $(selected).val();
+ var url = encodeURI("/hicc/v1/metrics/schema/"+table+"/"+family);
+ var tableFamily = table+"/"+family;
+ // Look through each column option and see if it has any rows
+ $.ajax({ url: url, dataType: "json", success: function(data){
+ for(var i in data) {
+ $('#column').append(
+ $("<option></option>")
+ .attr("value", tableFamily+"/"+data[i])
+ .text(data[i])
+ );
+ }
+ }});
+ });
+ }
+
+ function getRows() {
+ var size = $('#row option').size();
+ $('#row').find('option').remove();
+ $('#chartType').html("");
+ $('#family :selected').each(function(i, selected) {
+ var metric = $(selected).val();
+ var selection = metric+": <select id='ctype"+i+"'><option>lines</option><option>bars</option><option>points</option><option>area</option></select><br>";
+ $('#chartType').append(selection);
+ });
+ $('#table :selected').each(function(i, selected) {
+ var metricGroup = $(selected).val();
+ var url = encodeURI("/hicc/v1/metrics/source/"+metricGroup);
+ $.ajax({ url: url, dataType: "json", success: function(data){
+ for(var i in data) {
+ var test = $('#row').find('option[value="'+data[i]+'"]').val();
+ if(typeof(test) == "undefined") {
+ $('#row').append('<option value="'+data[i]+'">'+data[i]+'</option>');
+ }
+ }
+ }});
+ });
+ }
+
+ function buildChart() {
+ var test = $('#row').val();
+ if(test == null) {
+ $('#row option:eq(0)').attr('selected',true);
+ }
+ var url = [];
+ var idx = 0;
+ $('#family :selected').each(function(i, selected) {
+ var id = '#ctype' + i;
+ var chartType = $(id).val();
+ var chartTypeOption = { show: true };
+ if (chartType=='area') {
+ chartTypeOption = { show: true, fill: true };
+ }
+ $('#row :selected').each(function(j, rowSelected) {
+ var s = { 'label' : $(selected).val() + "/" + $(rowSelected).val(), 'url' : encodeURI("/hicc/v1/metrics/series/" + $(selected).val() + "/" + $(rowSelected).val())};
+ if(chartType=='area') {
+ s['lines']=chartTypeOption;
+ } else {
+ s[chartType]=chartTypeOption;
+ }
+ url[idx++] = s;
+ });
+ });
+ var title = $('#title').val();
+ var ymin = $('#ymin').val() ;
+ var ymax = $('#ymax').val();
+ var yunit = $('#yunit').val();
+ var data = { 'title' : title, 'yUnitType' : yunit, 'width' : 300, 'height' : 200, 'series' : url };
+ if(ymin!='') {
+ data['min']=ymin;
+ }
+ if(ymax!='') {
+ data['max']=ymax;
+ }
+ return data;
+ }
+
+ function plot() {
+ var data = buildChart();
+ $.ajax({
+ url: '/hicc/v1/chart/preview',
+ type: 'PUT',
+ contentType: 'application/json',
+ data: JSON.stringify(data),
+ success: function(result) {
+ $('#graph')[0].src="about:blank";
+ $('#graph')[0].contentWindow.document.open();
+ $('#graph')[0].contentWindow.document.write(result);
+ $('#graph')[0].contentWindow.document.close();
+ }
+ });
+ }
+
+ function buildWidget(title, url) {
+ var widget = {
+ title: title,
+ url: url,
+ }
+ widget['tokens'] = title.split(" ");
+ $.ajax({
+ type: "POST",
+ url: '/hicc/v1/widget/create',
+ contentType: "application/json",
+ data: JSON.stringify(widget),
+ success: function(data) {
+ alert("Widget exported.");
+ },
+ fail: function(data) {
+ alert("Widget export failed.");
+ }
+ });
+ }
+
+ function publishChart() {
+ var json = buildChart();
+ var url = "/hicc/v1/chart/save";
+ try {
+ if($('#title').val()=="") {
+ $("#title").val("Please provide a title");
+ $("#title").addClass("error");
+ $("#title").bind("click", function() {
+ $("#title").val("");
+ $("#title").removeClass("error");
+ $("#title").unbind("click");
+ });
+ throw "no title provided.";
+ }
+ } catch(err) {
+ console.log(err);
+ return false;
+ }
+ $.ajax({
+ type: "POST",
+ url: url,
+ contentType : "application/json",
+ data: JSON.stringify(json),
+ success: function(data) {
+ buildWidget(json.title, '/hicc/v1/chart/draw/'+data);
+ },
+ fail: function(data) {
+ alert("Chart export failed.");
+ }
+ });
+ }
+ </script>
+ </head>
+ <body>
+ <form>
+ <center>
+ <table>
+ <tr>
+ <th>Metric Groups</th>
+ <th>Metrics</th>
+ <th>Sources</th>
+ <th>Options</th>
+ <th>Chart Type</th>
+ </tr>
+ <tr>
+ <td>
+ <select id="table" size="10" onMouseUp="getFamilies()" style="min-width: 100px;" class="select">
+ </select>
+ </td>
+ <td>
+ <select id="family" multiple size="10" style="min-width: 110px;" onMouseUp="getRows()">
+ </select>
+ </td>
+ <td>
+ <select id="row" size="10" style="min-width: 100px;">
+ </select>
+ </td>
+ <td>
+ <table>
+ <tr>
+ <td>
+ <label>Title</label>
+ </td>
+ <td>
+ <input type=text id="title">
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label>Y-axis Min</label>
+ </td>
+ <td>
+ <input type="text" id="ymin" />
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label>Y-axis Max</label>
+ </td>
+ <td>
+ <input type="text" id="ymax" />
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label>Y-axis Unit</label>
+ </td>
+ <td>
+ <select id="yunit">
+ <option>bytes</option>
+ <option>bytes-decimal</option>
+ <option value="ops">op/s</option>
+ <option value="percent">%</option>
+ <option>generic</option>
+ </select>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <div id="chartType"></div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input type=button name="action" value="Plot" onClick="plot()">
+ <input type=button name="action" value="Publish" onClick="publishChart()">
+ </td>
+ <td>
+ </td>
+ <td>
+ </td>
+ </tr>
+ </table>
+ </form>
+ <iframe id="graph" width="95%" class="autoHeight" height="70%" frameBorder="0" scrolling="no"></iframe>
+ </center>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/chukwa/blob/0f9b5cf3/src/main/web/hicc/js/flot.extend.js
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/js/flot.extend.js b/src/main/web/hicc/js/flot.extend.js
index d7a2056..783a97d 100644
--- a/src/main/web/hicc/js/flot.extend.js
+++ b/src/main/web/hicc/js/flot.extend.js
@@ -118,7 +118,9 @@ function showTooltip(x, y, contents) {
'border-radius': '5px',
border: '2px solid #aaa',
padding: '2px',
- 'background-color': '#fff',
+ 'color': '#fff',
+ 'background-color': '#333',
+ 'opacity': '0.5'
}).appendTo("body").fadeIn(200);
}
http://git-wip-us.apache.org/repos/asf/chukwa/blob/0f9b5cf3/src/main/web/hicc/jsp/graph_explorer.jsp
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/jsp/graph_explorer.jsp b/src/main/web/hicc/jsp/graph_explorer.jsp
deleted file mode 100644
index 79f71f8..0000000
--- a/src/main/web/hicc/jsp/graph_explorer.jsp
+++ /dev/null
@@ -1,318 +0,0 @@
-<%
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-%>
-<%@ page import = "java.text.DecimalFormat,java.text.NumberFormat" %>
-<%@ page import = "org.apache.hadoop.chukwa.util.XssFilter" %>
-
-<%
- XssFilter xf = new XssFilter(request);
- NumberFormat nf = new DecimalFormat("###,###,###,##0.00");
- response.setHeader("boxId", xf.getParameter("boxId"));
- response.setContentType("text/html; chartset=UTF-8//IGNORE");
- String boxId=xf.getParameter("boxId");
- String cluster = (String) session.getAttribute("cluster");
-%>
-<html>
- <head>
- <link href="/hicc/css/default.css" rel="stylesheet" type="text/css">
- <link href="/hicc/css/formalize.css" rel="stylesheet" type="text/css">
- <script src="/hicc/js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
- <script src="/hicc/js/jquery.formalize.js"></script>
- <script src="/hicc/js/autoHeight.js" type="text/javascript" charset="utf-8"></script>
- <script>
- function randString(n) {
- if(!n) {
- n = 5;
- }
-
- var text = '';
- var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
-
- for(var i=0; i < n; i++) {
- text += possible.charAt(Math.floor(Math.random() * possible.length));
- }
-
- return text;
- }
-
- var checkDataLength = function(curOption) {
- return function(data) {
- if (data.length == 0) {
- curOption.attr('disabled', 'disabled');
- }
- }
- };
-
- $.ajax({ url: "/hicc/v1/metrics/schema", dataType: "json", success: function(data){
- for(var i in data) {
- $('#table').append("<option>"+data[i]+"</option>");
- }
- // Look through each table option and see if it has anything in its family?
- $('#table').children().each(
- function() {
- var table = $(this).text();
- $.ajax({ url: encodeURI("/hicc/v1/metrics/schema/"+table),
- dataType: "json",
- success: checkDataLength($(this))
- });
- }
- );
- }});
-
-
- function getFamilies() {
- var size = $('#family option').size();
- $('#family').find('option').remove();
- var table = $('#table').val();
- $.ajax({ url: encodeURI("/hicc/v1/metrics/schema/"+table), dataType: "json", success: function(data){
- for(var i in data) {
- $('#family').append("<option>"+data[i]+"</option>");
- }
- // Look through each family option and see if it has any columns
- var table = $('#table').val();
- $('#family').children().each(
- function() {
- var family = $(this).text();
- $.ajax({ url: encodeURI("/hicc/v1/metrics/source/"+table),
- dataType: "json",
- success: checkDataLength($(this))
- });
- }
- );
- }});
- }
-
- function getColumns() {
- var size = $('#column option').size();
- $('#column').find('option').remove();
- var table = $('#table').val();
- var family = $('#family').val();
- $('#family :selected').each(function(i, selected) {
- var family = $(selected).val();
- var url = encodeURI("/hicc/v1/metrics/schema/"+table+"/"+family);
- var tableFamily = table+"/"+family;
- // Look through each column option and see if it has any rows
- $.ajax({ url: url, dataType: "json", success: function(data){
- for(var i in data) {
- $('#column').append(
- $("<option></option>")
- .attr("value", tableFamily+"/"+data[i])
- .text(data[i])
- );
- }
- }});
- });
- }
-
- function getRows() {
- var size = $('#row option').size();
- $('#row').find('option').remove();
- $('#chartType').html("");
- $('#family :selected').each(function(i, selected) {
- var metric = $(selected).val();
- var selection = metric+": <select id='ctype"+i+"'><option>lines</option><option>bars</option><option>points</option><option>area</option></select><br>";
- $('#chartType').append(selection);
- });
- $('#table :selected').each(function(i, selected) {
- var metricGroup = $(selected).val();
- var url = encodeURI("/hicc/v1/metrics/source/"+metricGroup);
- $.ajax({ url: url, dataType: "json", success: function(data){
- for(var i in data) {
- var test = $('#row').find('option[value="'+data[i]+'"]').val();
- if(typeof(test) == "undefined") {
- $('#row').append('<option value="'+data[i]+'">'+data[i]+'</option>');
- }
- }
- }});
- });
- }
-
- function buildChart() {
- var test = $('#row').val();
- if(test == null) {
- $('#row option:eq(0)').attr('selected',true);
- }
- var url = [];
- var idx = 0;
- $('#family :selected').each(function(i, selected) {
- var id = '#ctype' + i;
- var chartType = $(id).val();
- var chartTypeOption = { show: true };
- if (chartType=='area') {
- chartTypeOption = { show: true, fill: true };
- }
- $('#row :selected').each(function(j, rowSelected) {
- var s = { 'label' : $(selected).val() + "/" + $(rowSelected).val(), 'url' : encodeURI("/hicc/v1/metrics/series/" + $(selected).val() + "/" + $(rowSelected).val())};
- if(chartType=='area') {
- s['lines']=chartTypeOption;
- } else {
- s[chartType]=chartTypeOption;
- }
- url[idx++] = s;
- });
- });
- var title = $('#title').val();
- var ymin = $('#ymin').val() ;
- var ymax = $('#ymax').val();
- var yunit = $('#yunit').val();
- var data = { 'title' : title, 'yUnitType' : yunit, 'width' : 300, 'height' : 200, 'series' : url };
- if(ymin!='') {
- data['min']=ymin;
- }
- if(ymax!='') {
- data['max']=ymax;
- }
- return data;
- }
-
- function plot() {
- var data = buildChart();
- $.ajax({
- url: '/hicc/v1/chart/preview',
- type: 'PUT',
- contentType: 'application/json',
- data: JSON.stringify(data),
- success: function(result) {
- $('#graph')[0].src="about:blank";
- $('#graph')[0].contentWindow.document.open();
- $('#graph')[0].contentWindow.document.write(result);
- $('#graph')[0].contentWindow.document.close();
- }
- });
- }
-
- function publishChart() {
- var json = buildChart();
- var url = "/hicc/v1/chart/save";
- try {
- if($('#title').val()=="") {
- $("#title").val("Please provide a title");
- $("#title").addClass("error");
- $("#title").bind("click", function() {
- $("#title").val("");
- $("#title").removeClass("error");
- $("#title").unbind("click");
- });
- throw "no title provided.";
- }
- } catch(err) {
- console.log(err);
- return false;
- }
- $.ajax({
- type: "POST",
- url: url,
- contentType : "application/json",
- data: JSON.stringify(json),
- success: function(data) {
- alert("Chart exported.");
- },
- fail: function(data) {
- alert("Chart export failed.");
- }
- });
- }
- </script>
- </head>
- <body>
- <form>
- <center>
- <table>
- <tr>
- <th>Metric Groups</th>
- <th>Metrics</th>
- <th>Sources</th>
- <th>Options</th>
- <th>Chart Type</th>
- </tr>
- <tr>
- <td>
- <select id="table" size="10" onMouseUp="getFamilies()" style="min-width: 100px;" class="select">
- </select>
- </td>
- <td>
- <select id="family" multiple size="10" style="min-width: 110px;" onMouseUp="getRows()">
- </select>
- </td>
- <td>
- <select id="row" size="10" style="min-width: 100px;">
- </select>
- </td>
- <td>
- <table>
- <tr>
- <td>
- <label>Title</label>
- </td>
- <td>
- <input type=text id="title">
- </td>
- </tr>
- <tr>
- <td>
- <label>Y-axis Min</label>
- </td>
- <td>
- <input type="text" id="ymin" />
- </td>
- </tr>
- <tr>
- <td>
- <label>Y-axis Max</label>
- </td>
- <td>
- <input type="text" id="ymax" />
- </td>
- </tr>
- <tr>
- <td>
- <label>Y-axis Unit</label>
- </td>
- <td>
- <select id="yunit">
- <option>bytes</option>
- <option>bytes-decimal</option>
- <option value="ops">op/s</option>
- <option value="percent">%</option>
- <option>generic</option>
- </select>
- </td>
- </tr>
- </table>
- </td>
- <td>
- <div id="chartType"></div>
- </td>
- </tr>
- <tr>
- <td>
- <input type=button name="action" value="Plot" onClick="plot()">
- <input type=button name="action" value="Publish" onClick="publishChart()">
- </td>
- <td>
- </td>
- <td>
- </td>
- </tr>
- </table>
- </form>
- <iframe id="graph" width="95%" class="autoHeight" height="70%" frameBorder="0" scrolling="no"></iframe>
- </center>
- </body>
-</html>