You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by bo...@apache.org on 2014/06/04 02:33:34 UTC

[11/13] git commit: STORM-205. Add REST API to Storm UI. Fixed component errors response. Changed naming of template ids and div.

STORM-205. Add REST API to Storm UI.
Fixed component errors response. Changed naming of template ids and div.


Project: http://git-wip-us.apache.org/repos/asf/incubator-storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-storm/commit/71817e7e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-storm/tree/71817e7e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-storm/diff/71817e7e

Branch: refs/heads/master
Commit: 71817e7e14412a29764271ecbb2e59f6e227400e
Parents: 49a9a92
Author: Sriharsha Chintalapani <ma...@harsha.io>
Authored: Mon Jun 2 11:09:25 2014 -0700
Committer: Sriharsha Chintalapani <ma...@harsha.io>
Committed: Mon Jun 2 11:09:25 2014 -0700

----------------------------------------------------------------------
 storm-core/src/clj/backtype/storm/ui/core.clj         |  7 +++----
 storm-core/src/ui/public/component.html               | 14 +++++++-------
 storm-core/src/ui/public/index.html                   |  6 +++---
 .../ui/public/templates/component-page-template.html  |  8 ++++----
 .../src/ui/public/templates/error-template.html       |  4 ----
 .../src/ui/public/templates/json-error-template.html  |  4 ++++
 storm-core/src/ui/public/topology.html                |  7 +++----
 7 files changed, 24 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/71817e7e/storm-core/src/clj/backtype/storm/ui/core.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/ui/core.clj b/storm-core/src/clj/backtype/storm/ui/core.clj
index f523d7a..ba6827c 100644
--- a/storm-core/src/clj/backtype/storm/ui/core.clj
+++ b/storm-core/src/clj/backtype/storm/ui/core.clj
@@ -515,12 +515,11 @@
   (let [errors (->> errors-list
                     (sort-by #(.get_error_time_secs ^ErrorInfo %))
                     reverse)]
-    {"errors"
+    {"componentErrors"
      (for [^ErrorInfo e errors]
-       [{"time" (date-str (.get_error_time_secs e))
+       {"time" (date-str (.get_error_time_secs e))
          "error" (.get_error e)
-         }])}
-     ))
+         })}))
 
 (defn spout-stats [window ^TopologyInfo topology-info component executors include-sys?]
   (let [window-hint (str " (" (window-hint window) ")")

http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/71817e7e/storm-core/src/ui/public/component.html
----------------------------------------------------------------------
diff --git a/storm-core/src/ui/public/component.html b/storm-core/src/ui/public/component.html
index 432b33d..90ca630 100644
--- a/storm-core/src/ui/public/component.html
+++ b/storm-core/src/ui/public/component.html
@@ -25,7 +25,7 @@
 </div>
 <div id="component-errors">
 </div>
-<div id="error">
+<div id="json-response-error">
 </div>
 <p id="toggle-switch" style="display: block;" class="js-only"></p>
 <script>
@@ -40,8 +40,8 @@ $(document).ready(function() {
     $.ajaxSetup({
         "error":function(jqXHR,textStatus,response) {
             var errorJson = jQuery.parseJSON(jqXHR.responseText);
-            $.get("/templates/error-template.html", function(template) {
-                $("#error").append(Mustache.render($(template).filter("#error-template").html(),errorJson));
+            $.get("/templates/json-error-template.html", function(template) {
+                $("#json-response-error").append(Mustache.render($(template).filter("#json-error-template").html(),errorJson));
             });
         }
     });
@@ -52,7 +52,7 @@ $(document).ready(function() {
         var inputStats = $("#component-input-stats");
         var outputStats = $("#component-output-stats");
         var executorStats = $("#component-executor-stats");
-        var errors = $("#component-errors");
+        var componentErrors = $("#component-errors");
         $.get("/templates/component-page-template.html", function(template) {
             componentSummary.append(Mustache.render($(template).filter("#component-summary-template").html(),response));
             if(response["componentType"] == "spout") {
@@ -76,9 +76,9 @@ $(document).ready(function() {
                     $("#bolt-executor-table").tablesorter({ sortList: [[0,0]], headers: {}});
                 }
             }
-            errors.append(Mustache.render($(template).filter("#errors-template").html(),response));
-            if(response["errors"].length > 0) {
-                $("#errors-table").tablesorter({ sortList: [[0,0]], headers: {1: { sorter: "stormtimestr"}}});
+            componentErrors.append(Mustache.render($(template).filter("#component-errors-template").html(),response));
+            if(response["componentErrors"].length > 0) {
+                $("#component-errors-table").tablesorter({ sortList: [[0,0]], headers: {1: { sorter: "stormtimestr"}}});
             }
         });
     });

http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/71817e7e/storm-core/src/ui/public/index.html
----------------------------------------------------------------------
diff --git a/storm-core/src/ui/public/index.html b/storm-core/src/ui/public/index.html
index 102b3c6..77af159 100644
--- a/storm-core/src/ui/public/index.html
+++ b/storm-core/src/ui/public/index.html
@@ -22,15 +22,15 @@
 </div>
 <h2>Nimbus Configuration</h2>
 <div id="nimbus-configuration"></div>
-<div id="error"></div>
+<div id="json-response-error"></div>
 </body>
 <script>
 $(document).ready(function() {
     $.ajaxSetup({
         "error":function(jqXHR,textStatus,response) {
             var errorJson = jQuery.parseJSON(jqXHR.responseText);
-            $.get("/templates/error-template.html", function(template) {
-                $("#error").append(Mustache.render($(template).filter("#error-template").html(),errorJson));
+            $.get("/templates/json-error-template.html", function(template) {
+                $("#json-response-error").append(Mustache.render($(template).filter("#json-error-template").html(),errorJson));
             });
         }
     });

http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/71817e7e/storm-core/src/ui/public/templates/component-page-template.html
----------------------------------------------------------------------
diff --git a/storm-core/src/ui/public/templates/component-page-template.html b/storm-core/src/ui/public/templates/component-page-template.html
index 9275a82..f2a5266 100644
--- a/storm-core/src/ui/public/templates/component-page-template.html
+++ b/storm-core/src/ui/public/templates/component-page-template.html
@@ -137,16 +137,16 @@
 </table>
 </script>
 
-<script id="errors-template" type="text/html">
+<script id="component-errors-template" type="text/html">
 <h2>Errors</h2>
-<table class="zebra-striped" id="errors-table"><thead><tr><th>Time</th><th>Error</th></tr></thead>
+<table class="zebra-striped" id="component-errors-table"><thead><tr><th>Time</th><th>Error</th></tr></thead>
 <tbody>
-{{#errors}}
+{{#componentErrors}}
 <tr>
 <td>{{time}}</td>
 <td>{{error}}</td>
 </tr>
-{{/errors}}
+{{/componentErrors}}
 </tbody>
 </table>
 </script>

http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/71817e7e/storm-core/src/ui/public/templates/error-template.html
----------------------------------------------------------------------
diff --git a/storm-core/src/ui/public/templates/error-template.html b/storm-core/src/ui/public/templates/error-template.html
deleted file mode 100644
index 09f3b76..0000000
--- a/storm-core/src/ui/public/templates/error-template.html
+++ /dev/null
@@ -1,4 +0,0 @@
-<script id="error-template" type="text/html">
-<h2>{{error}}</h2>
-<pre>{{errorMessage}}</pre>
-</script>

http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/71817e7e/storm-core/src/ui/public/templates/json-error-template.html
----------------------------------------------------------------------
diff --git a/storm-core/src/ui/public/templates/json-error-template.html b/storm-core/src/ui/public/templates/json-error-template.html
new file mode 100644
index 0000000..d797726
--- /dev/null
+++ b/storm-core/src/ui/public/templates/json-error-template.html
@@ -0,0 +1,4 @@
+<script id="json-error-template" type="text/html">
+<h2>{{error}}</h2>
+<pre>{{errorMessage}}</pre>
+</script>

http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/71817e7e/storm-core/src/ui/public/topology.html
----------------------------------------------------------------------
diff --git a/storm-core/src/ui/public/topology.html b/storm-core/src/ui/public/topology.html
index 55e8ea0..69c09cb 100644
--- a/storm-core/src/ui/public/topology.html
+++ b/storm-core/src/ui/public/topology.html
@@ -29,7 +29,7 @@
 <div id="topology-configuration">
 </div>
 <p id="toggle-switch" style="display: block;" class="js-only"></p>
-<div id="error">
+<div id="json-response-error">
 </div>
 </body>
 <script>
@@ -43,8 +43,8 @@ $(document).ready(function() {
     $.ajaxSetup({
         "error":function(jqXHR,textStatus,response) {
             var errorJson = jQuery.parseJSON(jqXHR.responseText);
-            $.get("/templates/error-template.html", function(template) {
-                $("#error").append(Mustache.render($(template).filter("#error-template").html(),errorJson));
+            $.get("/templates/json-error-template.html", function(template) {
+                $("#json-response-error").append(Mustache.render($(template).filter("#json-error-template").html(),errorJson));
             });
         }
     });
@@ -73,7 +73,6 @@ $(document).ready(function() {
             }
             config.append(Mustache.render($(template).filter("#topology-configuration-template").html(),formattedConfig));
             $("#topology-configuration-table").tablesorter({ sortList: [[0,0]], headers: {}});
-
         });
     });
  });