storm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kabh...@apache.org
Subject [1/2] storm git commit: STORM-2877: Add an option to configure pagination in Storm UI
Date Thu, 01 Feb 2018 15:30:42 GMT
Repository: storm
Updated Branches:
  refs/heads/1.x-branch 3da2a4966 -> 1b0e88e2f


STORM-2877: Add an option to configure pagination in Storm UI


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

Branch: refs/heads/1.x-branch
Commit: 075f9e1666eac72534ba7fdf4fff718fd52b4c3d
Parents: c335ad3
Author: Srishty Agrawal <srishtyagrawal9@gmail.com>
Authored: Thu Jan 25 12:45:11 2018 -0800
Committer: Srishty Agrawal <srishtyagrawal9@gmail.com>
Committed: Thu Jan 25 13:47:13 2018 -0800

----------------------------------------------------------------------
 conf/defaults.yaml                              |   1 +
 storm-core/src/jvm/org/apache/storm/Config.java |   7 +
 storm-core/src/ui/public/component.html         |  22 +--
 storm-core/src/ui/public/index.html             | 148 +++++++++----------
 storm-core/src/ui/public/topology.html          |  22 +--
 5 files changed, 106 insertions(+), 94 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/075f9e16/conf/defaults.yaml
----------------------------------------------------------------------
diff --git a/conf/defaults.yaml b/conf/defaults.yaml
index 435a7e8..46d08ac 100644
--- a/conf/defaults.yaml
+++ b/conf/defaults.yaml
@@ -92,6 +92,7 @@ ui.users: null
 ui.header.buffer.bytes: 4096
 ui.http.creds.plugin: org.apache.storm.security.auth.DefaultHttpCredentialsPlugin
 ui.http.x-frame-options: DENY
+ui.pagination: 20
 
 logviewer.port: 8000
 logviewer.childopts: "-Xmx128m"

http://git-wip-us.apache.org/repos/asf/storm/blob/075f9e16/storm-core/src/jvm/org/apache/storm/Config.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/org/apache/storm/Config.java b/storm-core/src/jvm/org/apache/storm/Config.java
index 35b4fbd..cb1cca7 100644
--- a/storm-core/src/jvm/org/apache/storm/Config.java
+++ b/storm-core/src/jvm/org/apache/storm/Config.java
@@ -735,6 +735,13 @@ public class Config extends HashMap<String, Object> {
     public static final String UI_CENTRAL_LOGGING_URL = "ui.central.logging.url";
 
     /**
+     * Storm UI drop-down pagination value. Set ui.pagination to be a positive integer
+     * or -1 (displays all entries). Valid values: -1, 10, 20, 25 etc.
+     */
+    @isInteger
+    public static final String UI_PAGINATION = "ui.pagination";
+
+    /**
      * HTTP UI port for log viewer
      */
     @isInteger

http://git-wip-us.apache.org/repos/asf/storm/blob/075f9e16/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 942b12d..64bc84d 100644
--- a/storm-core/src/ui/public/component.html
+++ b/storm-core/src/ui/public/component.html
@@ -140,16 +140,18 @@ $(document).ready(function() {
     var url = "/api/v1/topology/"+topologyId+"/component/"+componentId+"?sys="+sys;
     if(window) url += "&window="+window;
 
-    $.extend( $.fn.dataTable.defaults, {
-      stateSave: true,
-      stateSaveCallback: function (oSettings, oData) {
-        sessionStorage.setItem( oSettings.sTableId.concat(tableStateKey), JSON.stringify(oData)
);
-      },
-      stateLoadCallback: function (oSettings) {
-        return JSON.parse( sessionStorage.getItem(oSettings.sTableId.concat(tableStateKey))
);
-      },
-      lengthMenu: [[20,40,60,100,-1], [20, 40, 60, 100, "All"]],
-      pageLength: 20
+    $.getJSON("/api/v1/cluster/configuration",function(response,status,jqXHR) {
+        $.extend( $.fn.dataTable.defaults, {
+          stateSave: true,
+          stateSaveCallback: function (oSettings, oData) {
+            sessionStorage.setItem( oSettings.sTableId.concat(tableStateKey), JSON.stringify(oData)
);
+          },
+          stateLoadCallback: function (oSettings) {
+            return JSON.parse( sessionStorage.getItem(oSettings.sTableId.concat(tableStateKey))
);
+          },
+          lengthMenu: [[20,40,60,100,-1], [20, 40, 60, 100, "All"]],
+          pageLength: response["ui.pagination"]
+        });
     });
 
     renderToggleSys($("#toggle-switch"));

http://git-wip-us.apache.org/repos/asf/storm/blob/075f9e16/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 69081d4..62cfdbf 100644
--- a/storm-core/src/ui/public/index.html
+++ b/storm-core/src/ui/public/index.html
@@ -97,92 +97,92 @@ $(document).ajaxStart(function(){
     $.blockUI({ message: '<img src="images/spinner.gif" /> <h3>Loading summary...</h3>'});
 });
 $(document).ready(function() {
-    $.extend( $.fn.dataTable.defaults, {
-      stateSave: true,
-      lengthMenu: [[20,40,60,100,-1], [20, 40, 60, 100, "All"]],
-      pageLength: 20
-    });
+    $.getJSON("/api/v1/cluster/configuration",function(responseClusterConfig,status,jqXHR)
{
+        $.extend( $.fn.dataTable.defaults, {
+          stateSave: true,
+          lengthMenu: [[20,40,60,100,-1], [20, 40, 60, 100, "All"]],
+          pageLength: responseClusterConfig["ui.pagination"]
+        });
 
-    $.ajaxSetup({
-        "error":function(jqXHR,textStatus,response) {
-            var errorJson = jQuery.parseJSON(jqXHR.responseText);
-            getStatic("/templates/json-error-template.html", function(template) {
-                $("#json-response-error").append(Mustache.render($(template).filter("#json-error-template").html(),errorJson));
-            });
-        }
-    });
-    var uiUser = $("#ui-user");
-    var clusterSummary = $("#cluster-summary");
-    var clusterResources = $("#cluster-resources");
-    var nimbusSummary = $("#nimbus-summary");
-    var topologySummary = $("#topology-summary");
-    var supervisorSummary = $("#supervisor-summary");
-    var config = $("#nimbus-configuration");
+        $.ajaxSetup({
+            "error":function(jqXHR,textStatus,response) {
+                var errorJson = jQuery.parseJSON(jqXHR.responseText);
+                getStatic("/templates/json-error-template.html", function(template) {
+                    $("#json-response-error").append(Mustache.render($(template).filter("#json-error-template").html(),errorJson));
+                });
+            }
+        });
+        var uiUser = $("#ui-user");
+        var clusterSummary = $("#cluster-summary");
+        var clusterResources = $("#cluster-resources");
+        var nimbusSummary = $("#nimbus-summary");
+        var topologySummary = $("#topology-summary");
+        var supervisorSummary = $("#supervisor-summary");
+        var config = $("#nimbus-configuration");
 
-    getStatic("/templates/index-page-template.html", function(indexTemplate) {
-        $.getJSON("/api/v1/cluster/summary",function(response,status,jqXHR) {
-            getStatic("/templates/user-template.html", function(template) {
-                uiUser.append(Mustache.render($(template).filter("#user-template").html(),response));
-                $('#ui-user [data-toggle="tooltip"]').tooltip()
-            });
+        getStatic("/templates/index-page-template.html", function(indexTemplate) {
+            $.getJSON("/api/v1/cluster/summary",function(response,status,jqXHR) {
+                getStatic("/templates/user-template.html", function(template) {
+                    uiUser.append(Mustache.render($(template).filter("#user-template").html(),response));
+                    $('#ui-user [data-toggle="tooltip"]').tooltip()
+                });
 
-            clusterSummary.append(Mustache.render($(indexTemplate).filter("#cluster-summary-template").html(),response));
-            $('#cluster-summary [data-toggle="tooltip"]').tooltip();
+                clusterSummary.append(Mustache.render($(indexTemplate).filter("#cluster-summary-template").html(),response));
+                $('#cluster-summary [data-toggle="tooltip"]').tooltip();
 
-            clusterResources.append(Mustache.render($(indexTemplate).filter("#cluster-resources-template").html(),response));
-            $('#cluster-resources [data-toggle="tooltip"]').tooltip();
+                clusterResources.append(Mustache.render($(indexTemplate).filter("#cluster-resources-template").html(),response));
+                $('#cluster-resources [data-toggle="tooltip"]').tooltip();
 
-            var displayResource = response["schedulerDisplayResource"];
-            $('#cluster-resources [data-toggle="tooltip"]').tooltip();
-            if (!displayResource){
-                $('#cluster-resources-header').hide();
-                $('#cluster-resources').hide();
-            };
-        });
+                var displayResource = response["schedulerDisplayResource"];
+                $('#cluster-resources [data-toggle="tooltip"]').tooltip();
+                if (!displayResource){
+                    $('#cluster-resources-header').hide();
+                    $('#cluster-resources').hide();
+                };
+            });
 
-        $.getJSON("/api/v1/nimbus/summary",function(response,status,jqXHR) {
-            nimbusSummary.append(Mustache.render($(indexTemplate).filter("#nimbus-summary-template").html(),response));
-            //host, port, isLeader, version, uptime
-            dtAutoPage("#nimbus-summary-table", {
-              columnDefs: [
-                {type: "num", targets: [1]},
-                {type: "time-str", targets: [4]}
-              ]
+            $.getJSON("/api/v1/nimbus/summary",function(response,status,jqXHR) {
+                nimbusSummary.append(Mustache.render($(indexTemplate).filter("#nimbus-summary-template").html(),response));
+                //host, port, isLeader, version, uptime
+                dtAutoPage("#nimbus-summary-table", {
+                  columnDefs: [
+                    {type: "num", targets: [1]},
+                    {type: "time-str", targets: [4]}
+                  ]
+                });
+                $('#nimbus-summary [data-toggle="tooltip"]').tooltip();
             });
-            $('#nimbus-summary [data-toggle="tooltip"]').tooltip();
-        });
 
-        $.getJSON("/api/v1/topology/summary",function(response,status,jqXHR) {
-            topologySummary.append(Mustache.render($(indexTemplate).filter("#topology-summary-template").html(),response));
-            //name, owner, status, uptime, num workers, num executors, num tasks, replication
count, assigned total mem, assigned total cpu, scheduler info
-            dtAutoPage("#topology-summary-table", {
-              columnDefs: [
-                {type: "num", targets: [4, 5, 6, 7, 8, 9]},
-                {type: "time-str", targets: [3]}
-              ]
+            $.getJSON("/api/v1/topology/summary",function(response,status,jqXHR) {
+                topologySummary.append(Mustache.render($(indexTemplate).filter("#topology-summary-template").html(),response));
+                //name, owner, status, uptime, num workers, num executors, num tasks, replication
count, assigned total mem, assigned total cpu, scheduler info
+                dtAutoPage("#topology-summary-table", {
+                  columnDefs: [
+                    {type: "num", targets: [4, 5, 6, 7, 8, 9]},
+                    {type: "time-str", targets: [3]}
+                  ]
+                });
+                $('#topology-summary [data-toggle="tooltip"]').tooltip();
             });
-            $('#topology-summary [data-toggle="tooltip"]').tooltip();
-        });
 
-        $.getJSON("/api/v1/supervisor/summary",function(response,status,jqXHR) {
-            supervisorSummary.append(Mustache.render($(indexTemplate).filter("#supervisor-summary-template").html(),response));
-            //id, host, uptime, slots, used slots
-            dtAutoPage("#supervisor-summary-table", {
-              columnDefs: [
-                {type: "num", targets: [3, 4]},
-                {type: "time-str", targets: [2]}
-              ]
+            $.getJSON("/api/v1/supervisor/summary",function(response,status,jqXHR) {
+                supervisorSummary.append(Mustache.render($(indexTemplate).filter("#supervisor-summary-template").html(),response));
+                //id, host, uptime, slots, used slots
+                dtAutoPage("#supervisor-summary-table", {
+                  columnDefs: [
+                    {type: "num", targets: [3, 4]},
+                    {type: "time-str", targets: [2]}
+                  ]
+                });
+                $('#supervisor-summary [data-toggle="tooltip"]').tooltip();
             });
-            $('#supervisor-summary [data-toggle="tooltip"]').tooltip();
-        });
 
-        $.getJSON("/api/v1/cluster/configuration",function(response,status,jqXHR) {
-          var formattedResponse = formatConfigData(response);
-          config.append(Mustache.render($(indexTemplate).filter("#configuration-template").html(),formattedResponse));
-          $('#nimbus-configuration-table td').jsonFormatter();
-          //key, value
-          dtAutoPage("#nimbus-configuration-table", {});
-          $('#nimbus-configuration [data-toggle="tooltip"]').tooltip();
+            var formattedResponse = formatConfigData(responseClusterConfig);
+            config.append(Mustache.render($(indexTemplate).filter("#configuration-template").html(),formattedResponse));
+            $('#nimbus-configuration-table td').jsonFormatter();
+            //key, value
+            dtAutoPage("#nimbus-configuration-table", {});
+            $('#nimbus-configuration [data-toggle="tooltip"]').tooltip();
         });
     });
   });

http://git-wip-us.apache.org/repos/asf/storm/blob/075f9e16/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 b1879e6..23b1c4f 100644
--- a/storm-core/src/ui/public/topology.html
+++ b/storm-core/src/ui/public/topology.html
@@ -252,16 +252,18 @@ $(document).ready(function() {
     var sys = $.cookies.get("sys") || "false";
     var url = "/api/v1/topology/"+topologyId+"?sys="+sys;
     if(window) url += "&window="+window;
-    $.extend( $.fn.dataTable.defaults, {
-      stateSave: true,
-      stateSaveCallback: function (oSettings, oData) {
-        sessionStorage.setItem( oSettings.sTableId.concat(tableStateKey), JSON.stringify(oData)
);
-      },
-      stateLoadCallback: function (oSettings) {
-        return JSON.parse( sessionStorage.getItem(oSettings.sTableId.concat(tableStateKey))
);
-      },
-      lengthMenu: [[20,40,60,100,-1], [20, 40, 60, 100, "All"]],
-      pageLength: 20
+    $.getJSON("/api/v1/cluster/configuration",function(response,status,jqXHR) {
+        $.extend( $.fn.dataTable.defaults, {
+          stateSave: true,
+          stateSaveCallback: function (oSettings, oData) {
+            sessionStorage.setItem( oSettings.sTableId.concat(tableStateKey), JSON.stringify(oData)
);
+          },
+          stateLoadCallback: function (oSettings) {
+            return JSON.parse( sessionStorage.getItem(oSettings.sTableId.concat(tableStateKey))
);
+          },
+          lengthMenu: [[20,40,60,100,-1], [20, 40, 60, 100, "All"]],
+          pageLength: response["ui.pagination"]
+        });
     });
 
     renderToggleSys($("#toggle-switch"));


Mime
View raw message