You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by pt...@apache.org on 2016/04/01 18:47:16 UTC

[3/5] storm git commit: Showing tooltip on Debug button only when disabled and event loggers are disabled. Also enable/disable of Debug button along with toltip in component page

Showing tooltip on Debug button only when disabled and event loggers are disabled. Also enable/disable of Debug button along with toltip in component page


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

Branch: refs/heads/1.x-branch
Commit: 7d7b3c2086a0172757af4bfc2a1a9dd9feee696c
Parents: 3354cc7
Author: Roshan Naik <ro...@hortonworks.com>
Authored: Thu Mar 31 18:16:52 2016 -0700
Committer: Roshan Naik <ro...@hortonworks.com>
Committed: Thu Mar 31 18:16:52 2016 -0700

----------------------------------------------------------------------
 storm-core/src/ui/public/component.html           | 18 +++++++++++++++++-
 storm-core/src/ui/public/js/script.js             |  6 ++++--
 .../public/templates/component-page-template.html |  8 +++++++-
 .../public/templates/topology-page-template.html  |  8 +++++++-
 4 files changed, 35 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/7d7b3c20/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 6d5465f..37ee525 100644
--- a/storm-core/src/ui/public/component.html
+++ b/storm-core/src/ui/public/component.html
@@ -192,10 +192,26 @@ $(document).ready(function() {
             $('#ui-user [data-toggle="tooltip"]').tooltip()
         });
 
+        var topologyUrl = "/api/v1/topology/"+topologyId;
+
+        var eventLoggers = (function() {
+              $.ajaxSetup({
+                  async: false
+              });
+              var eventLoggers;
+              $.getJSON(topologyUrl, function(response, status, jqXHR) {
+                  eventLoggers = response["configuration"]["topology.eventlogger.executors"];
+               });
+               $.ajaxSetup({
+                  async: true
+              })
+              return eventLoggers;
+         })();
+
         var componentSummary = $("#component-summary");
         var componentActions = $("#component-actions");
         var buttonJsonData = componentActionJson(response["encodedTopologyId"], response["encodedId"], response["id"],
-                                                 response["topologyStatus"], response["debug"], response["samplingPct"]);
+                                                 response["topologyStatus"], eventLoggers, response["debug"], response["samplingPct"]);
         var componentStatsDetail = $("#component-stats-detail")
         var inputStats = $("#component-input-stats");
         var outputStats = $("#component-output-stats");

http://git-wip-us.apache.org/repos/asf/storm/blob/7d7b3c20/storm-core/src/ui/public/js/script.js
----------------------------------------------------------------------
diff --git a/storm-core/src/ui/public/js/script.js b/storm-core/src/ui/public/js/script.js
index c25195d..ff3c525 100644
--- a/storm-core/src/ui/public/js/script.js
+++ b/storm-core/src/ui/public/js/script.js
@@ -222,17 +222,19 @@ function topologyActionJson(id, encodedId, name, status, msgTimeout, loggersTota
     jsonData["killStatus"] = (status !== "KILLED") ? "enabled" : "disabled";
     jsonData["startDebugStatus"] = (status === "ACTIVE" && loggersTotal!=null && loggersTotal!=0 && !debug) ? "enabled" : "disabled";
     jsonData["stopDebugStatus"] = (status === "ACTIVE" && debug) ? "enabled" : "disabled";
+    jsonData["loggersDisabled"] = loggersTotal==null || loggersTotal==0;
     jsonData["currentSamplingPct"] = samplingPct;
     return jsonData;
 }
 
-function componentActionJson(encodedTopologyId, encodedId, componentName, status, debug, samplingPct) {
+function componentActionJson(encodedTopologyId, encodedId, componentName, status, loggersTotal, debug, samplingPct) {
     var jsonData = {};
     jsonData["encodedTopologyId"] = encodedTopologyId;
     jsonData["encodedId"] = encodedId;
     jsonData["componentName"] = componentName;
-    jsonData["startDebugStatus"] = (status === "ACTIVE" && !debug) ? "enabled" : "disabled";
+    jsonData["startDebugStatus"] = (status === "ACTIVE" && loggersTotal!=null && loggersTotal!=0 && !debug) ? "enabled" : "disabled";
     jsonData["stopDebugStatus"] = (status === "ACTIVE" && debug) ? "enabled" : "disabled";
+    jsonData["loggersDisabled"] = loggersTotal==null || loggersTotal==0;
     jsonData["currentSamplingPct"] = samplingPct;
     return jsonData;
 }

http://git-wip-us.apache.org/repos/asf/storm/blob/7d7b3c20/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 3626291..472a769 100644
--- a/storm-core/src/ui/public/templates/component-page-template.html
+++ b/storm-core/src/ui/public/templates/component-page-template.html
@@ -557,7 +557,13 @@
 <script id="component-actions-template" type="text/html">
   <h2>Component actions</h2>
   <p id="component-actions">
-    <input {{startDebugStatus}} onclick="confirmComponentAction('{{encodedTopologyId}}', '{{encodedId}}', '{{componentName}}', 'debug/enable', true, {{currentSamplingPct}}, 'sampling percentage', 'debug')" type="button" value="Debug" class="btn btn-default">
+    {{#loggersDisabled}}
+    <span style="display:inline-block;" data-toggle="tooltip" title="" data-original-title="To debug, set topology.eventlogger.executors to a value > 0">
+    {{/loggersDisabled}}
+      <input {{startDebugStatus}} onclick="confirmComponentAction('{{encodedTopologyId}}', '{{encodedId}}', '{{componentName}}', 'debug/enable', true, {{currentSamplingPct}}, 'sampling percentage', 'debug')" type="button" value="Debug" class="btn btn-default">
+    {{#loggersDisabled}}
+    </span>
+    {{/loggersDisabled}}
     <input {{stopDebugStatus}} onclick="confirmComponentAction('{{encodedTopologyId}}', '{{encodedId}}', '{{componentName}}', 'debug/disable', false, 0, 'sampling percentage', 'stop debugging')" type="button" value="Stop Debug" class="btn btn-default">
   </p>
 </script>

http://git-wip-us.apache.org/repos/asf/storm/blob/7d7b3c20/storm-core/src/ui/public/templates/topology-page-template.html
----------------------------------------------------------------------
diff --git a/storm-core/src/ui/public/templates/topology-page-template.html b/storm-core/src/ui/public/templates/topology-page-template.html
index a72effc..917831a 100644
--- a/storm-core/src/ui/public/templates/topology-page-template.html
+++ b/storm-core/src/ui/public/templates/topology-page-template.html
@@ -434,7 +434,13 @@
     <input {{deactivateStatus}} onclick="confirmAction('{{encodedId}}', '{{name}}', 'deactivate', false)" type="button" value="Deactivate" class="btn btn-default">
     <input {{rebalanceStatus}} onclick="confirmAction('{{encodedId}}', '{{name}}', 'rebalance', true, {{msgTimeout}}, 'wait time in seconds')" type="button" value="Rebalance" class="btn btn-default">
     <input {{killStatus}} onclick="confirmAction('{{encodedId}}', '{{name}}', 'kill', true, 30, 'wait time in seconds')" type="button" value="Kill" class="btn btn-default">
-    <input {{startDebugStatus}} onclick="confirmAction('{{encodedId}}', '{{name}}', 'debug/enable', true, {{currentSamplingPct}}, 'sampling percentage', 'debug')" type="button" value="Debug" class="btn btn-default" style="pointer-events:all; cursor: default;" title="To debug, set topology.eventlogger.executors > 0">
+    {{#loggersDisabled}}
+    <span style="display:inline-block;" data-toggle="tooltip" title="" data-original-title="To debug, set topology.eventlogger.executors to a value > 0">
+    {{/loggersDisabled}}
+      <input {{startDebugStatus}} onclick="confirmAction('{{encodedId}}', '{{name}}', 'debug/enable', true, {{currentSamplingPct}}, 'sampling percentage', 'debug')" type="button" value="Debug" class="btn btn-default" >
+    {{#loggersDisabled}}
+    </span>
+    {{/loggersDisabled}}
     <input {{stopDebugStatus}} onclick="confirmAction('{{encodedId}}', '{{name}}', 'debug/disable', false, 0, 'sampling percentage', 'stop debugging')" type="button" value="Stop Debug" class="btn btn-default">
     <input type="button" {{logLevel}} value="Change Log Level" onclick="toggleChangeLogLevel()" class="btn btn-default">
   </p>