Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow link to subgraphs via hash.

  • Loading branch information...
commit 3d7c9da4d62170f36e428700f5600a6abfcb9892 1 parent 8c2f128
@dustin dustin authored
Showing with 18 additions and 2 deletions.
  1. +18 −2 static/vb2.html
View
20 static/vb2.html
@@ -70,7 +70,7 @@
</div>
<h2>Nodes</h2>
<ul id="nodes"></ul>
- <form method="post" action="#">
+ <form method="post" action="#" id="statselection">
<input type="radio" name="stat" value="num_items"
checked="checked">Number of Items</input>
<input type="radio" name="stat" value="ht_item_memory">Memory Size</input>
@@ -94,7 +94,18 @@
'#levels');
function updateGraphs(json) {
- chart(json, $("input[@name=stat]:checked").val());
+
+ var selected = window.location.hash.substring(1);
+ if (window.location.hash.substring(1) === "") {
+ selected = "num_items";
+ }
+
+ $("#statselection input").attr("checked", null);
+ $("#statselection input").filter(function(i, e) {
+ return e.value === selected;
+ }).attr("checked", "checked");
+
+ chart(json, selected);
var nodes = d3.keys(json);
nodes.sort(d3.ascending);
var legend = d3.select("#nodes").selectAll("li").data(nodes);
@@ -120,6 +131,11 @@
$("#loading").addClass("broken");
}, function() { $("#clusterform").show(); });
+ $("#statselection input").click(function(e) {
+ selected = $("input[@name=stat]:checked").val();
+ window.location.hash = selected;
+ });
+
setInterval(function() {
doVBStatRequest(clusterInfo, updateGraphs,
function() {
Please sign in to comment.
Something went wrong with that request. Please try again.