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/12 17:59:02 UTC
git commit: Added back in the user to the web ui.
Repository: incubator-storm
Updated Branches:
refs/heads/security 118b9221b -> 2131a0aeb
Added back in the user to the web ui.
Project: http://git-wip-us.apache.org/repos/asf/incubator-storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-storm/commit/2131a0ae
Tree: http://git-wip-us.apache.org/repos/asf/incubator-storm/tree/2131a0ae
Diff: http://git-wip-us.apache.org/repos/asf/incubator-storm/diff/2131a0ae
Branch: refs/heads/security
Commit: 2131a0aeb9074b2c83a09d7515ff8e8ae86f6eaf
Parents: 118b922
Author: Robert (Bobby) Evans <bo...@apache.org>
Authored: Thu Jun 12 10:58:13 2014 -0500
Committer: Robert (Bobby) Evans <bo...@apache.org>
Committed: Thu Jun 12 10:58:13 2014 -0500
----------------------------------------------------------------------
storm-core/src/clj/backtype/storm/ui/core.clj | 20 ++++++++++++--------
storm-core/src/ui/public/component.html | 7 +++++++
storm-core/src/ui/public/index.html | 8 +++++++-
.../src/ui/public/templates/user-template.html | 9 +++++++++
storm-core/src/ui/public/topology.html | 7 +++++++
5 files changed, 42 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/2131a0ae/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 216c304..9f8f3b8 100644
--- a/storm-core/src/clj/backtype/storm/ui/core.clj
+++ b/storm-core/src/clj/backtype/storm/ui/core.clj
@@ -452,10 +452,10 @@
(.getNimbusConf ^Nimbus$Client nimbus)))
(defn cluster-summary
- ([]
+ ([user]
(with-nimbus nimbus
- (cluster-summary (.getClusterInfo ^Nimbus$Client nimbus))))
- ([^ClusterSummary summ]
+ (cluster-summary (.getClusterInfo ^Nimbus$Client nimbus) user)))
+ ([^ClusterSummary summ user]
(let [sups (.get_supervisors summ)
used-slots (reduce + (map #(.get_num_used_workers ^SupervisorSummary %) sups))
total-slots (reduce + (map #(.get_num_workers ^SupervisorSummary %) sups))
@@ -466,7 +466,8 @@
total-executors (->> (.get_topologies summ)
(map #(.get_num_executors ^TopologySummary %))
(reduce +))]
- { "stormVersion" (read-storm-version)
+ { "user" user
+ "stormVersion" (read-storm-version)
"nimbusUptime" (pretty-uptime-sec (.get_nimbus_uptime_secs summ))
"supervisors" (count sups)
"slotsTotal" total-slots
@@ -619,7 +620,8 @@
(assert-authorized-ui-user user *STORM-CONF* topology-conf)
(merge
(topology-summary summ)
- {"window" window
+ {"user" user
+ "window" window
"windowHint" window-hint
"msgTimeout" msg-timeout
"topologyStats" (topology-stats id window (total-aggregate-stats spout-summs bolt-summs include-sys?))
@@ -778,7 +780,8 @@
errors (component-errors (get (.get_errors summ) component))]
(assert-authorized-ui-user user *STORM-CONF* topology-conf)
(merge
- {"id" component
+ {"user" user
+ "id" component
"name" (.get_name summ)
"executors" (count summs)
"tasks" (sum-tasks summs)
@@ -802,8 +805,9 @@
(defroutes main-routes
(GET "/api/v1/cluster/configuration" []
(cluster-configuration))
- (GET "/api/v1/cluster/summary" []
- (json-response (cluster-summary)))
+ (GET "/api/v1/cluster/summary" [:as {:keys [cookies servlet-request]}]
+ (let [user (.getUserName http-creds-handler servlet-request)]
+ (json-response (cluster-summary user))))
(GET "/api/v1/supervisor/summary" []
(json-response (supervisor-summary)))
(GET "/api/v1/topology/summary" []
http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/2131a0ae/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 90ca630..337d09b 100644
--- a/storm-core/src/ui/public/component.html
+++ b/storm-core/src/ui/public/component.html
@@ -12,6 +12,8 @@
<script src="/js/script.js" type="text/javascript"></script>
</head>
<body>
+<div id="ui-user">
+</div>
<h1><a href="/">Storm UI</a></h1>
<div id="component-summary">
</div>
@@ -47,6 +49,11 @@ $(document).ready(function() {
});
$.getJSON(url,function(response,status,jqXHR) {
+ var uiUser = $("#ui-user");
+ $.get("/templates/user-template.html", function(template) {
+ uiUser.append(Mustache.render($(template).filter("#user-template").html(),response));
+ });
+
var componentSummary = $("#component-summary");
var componentStatsDetail = $("#component-stats-detail")
var inputStats = $("#component-input-stats");
http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/2131a0ae/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 fe83b2c..2bf616f 100644
--- a/storm-core/src/ui/public/index.html
+++ b/storm-core/src/ui/public/index.html
@@ -10,6 +10,8 @@
<script src="/js/script.js" type="text/javascript"></script>
</head>
<body>
+<div id="ui-user">
+</div>
<h1><a href="/">Storm UI</a></h1>
<h2>Cluster Summary</h2>
<div id="cluster-summary">
@@ -34,13 +36,17 @@ $(document).ready(function() {
});
}
});
- var template = $.get("/templates/index-page-template.html");
+ var uiUser = $("#ui-user");
var clusterSummary = $("#cluster-summary");
var topologySummary = $("#topology-summary");
var supervisorSummary = $("#supervisor-summary");
var config = $("#nimbus-configuration");
$.getJSON("/api/v1/cluster/summary",function(response,status,jqXHR) {
+ $.get("/templates/user-template.html", function(template) {
+ uiUser.append(Mustache.render($(template).filter("#user-template").html(),response));
+ });
+
$.get("/templates/index-page-template.html", function(template) {
clusterSummary.append(Mustache.render($(template).filter("#cluster-summary-template").html(),response));
});
http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/2131a0ae/storm-core/src/ui/public/templates/user-template.html
----------------------------------------------------------------------
diff --git a/storm-core/src/ui/public/templates/user-template.html b/storm-core/src/ui/public/templates/user-template.html
new file mode 100644
index 0000000..2b4eaa4
--- /dev/null
+++ b/storm-core/src/ui/public/templates/user-template.html
@@ -0,0 +1,9 @@
+<script id="user-template" type="text/html">
+ {{#user}}
+ <div class="ui-user"><p>
+ <span class="tip below" data-original-title="This should be you.">
+ User: {{user}}
+ </span>
+ </p></div>
+ {{/user}}
+</script>
http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/2131a0ae/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 b2ac1e5..5f7480d 100644
--- a/storm-core/src/ui/public/topology.html
+++ b/storm-core/src/ui/public/topology.html
@@ -15,6 +15,8 @@
<script src="/js/arbor-graphics.js" type="text/javascript"></script>
</head>
<body>
+<div id="ui-user">
+</div>
<h1><a href="/">Storm UI</a></h1>
<h2>Topology summary</h2>
<div id="topology-summary">
@@ -52,6 +54,11 @@ $(document).ready(function() {
});
$.getJSON(url,function(response,status,jqXHR) {
+ var uiUser = $("#ui-user");
+ $.get("/templates/user-template.html", function(template) {
+ uiUser.append(Mustache.render($(template).filter("#user-template").html(),response));
+ });
+
var topologySummary = $("#topology-summary");
var topologyStats = $("#topology-stats");
var spoutStats = $("#spout-stats");