Skip to content

Commit

Permalink
Merge pull request #1068 from ploxiln/admin_counter_graph
Browse files Browse the repository at this point in the history
nsqadmin: fix: html-escaped large_graph url breaks inside javascript
  • Loading branch information
ploxiln authored Aug 4, 2018
2 parents de7d001 + d246d15 commit 431792b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
4 changes: 1 addition & 3 deletions nsqadmin/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,11 @@
"radix": [1],
"semi": [1, "always"],
"semi-spacing": [1],
"space-after-function-name": [1, "never"],
"space-after-keywords": [1, "always"],
"keyword-spacing": [1, {"before": true, "after": true}],
"space-before-blocks": [1, "always"],
"space-before-function-paren": [1, "never"],
"space-in-parens": [1, "never"],
"space-infix-ops": [1],
"space-return-throw-case": [1],
"space-unary-ops": [1],
"strict": [0],
"wrap-iife": [1]
Expand Down
20 changes: 10 additions & 10 deletions nsqadmin/bindata.go

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions nsqadmin/static/js/views/counter.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,6 @@ body {
<p class="processed">Messages Processed</p>
<p class="messagerate"></p>
{{#if graph_active}}
<script type="text/javascript">
var LARGE_GRAPH_URL = "{{large_graph "counter" "*" "" "" "message_count"}}";
</script>
<img id="big_graph" height="500" src=""/>
<img id="big_graph" height="500" src="{{large_graph "counter" "*" "" "" "message_count"}}"/>
{{/if}}
</div>
7 changes: 6 additions & 1 deletion nsqadmin/static/js/views/counter.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var CounterView = BaseView.extend({
this.targetPollInterval = 10000;
this.currentNum = -1;
this.interval = 100;
this.graphUrl = null;
this.updateStats();
},

Expand Down Expand Up @@ -87,7 +88,11 @@ var CounterView = BaseView.extend({
}.bind(this));

if ($('#big_graph').length) {
$('#big_graph').attr('src', LARGE_GRAPH_URL + '&_uniq=' + Math.random() * 1000000);
if (!this.graphUrl) {
this.graphUrl = $('#big_graph').attr('src');
}
var uniq = Math.floor(Math.random() * 1000000);
$('#big_graph').attr('src', this.graphUrl + '&_uniq=' + uniq);
}
},

Expand Down

0 comments on commit 431792b

Please sign in to comment.