fix minidash statistics on node,site, and slice pages
diff --git a/planetstack/core/static/page_analytics.js b/planetstack/core/static/page_analytics.js
index 4e961b4..b9d0c35 100644
--- a/planetstack/core/static/page_analytics.js
+++ b/planetstack/core/static/page_analytics.js
@@ -1,8 +1,8 @@
-function getObjectQuery() {
- var selectedNodeTxt = $('.currentOriginalNode').text();
+function getObjectAndEventQuery() {
+ var selectedNodeTxt = $('#currentOriginalNode').text();
selectedNodeTxt = selectedNodeTxt.trim();
selectedNodeTxt = selectedNodeTxt.split(' ').join('');//selectedNodeTxt.replace(" ", "")
- var parentNodeTxt = $('.selectedMainNav').text();
+ var parentNodeTxt = $('#selectedMainNav').text();
parentNodeTxt = parentNodeTxt.replace("/\n","");
parentNodeTxt = parentNodeTxt.replace("»","");
parentNodeTxt = parentNodeTxt.trim();
@@ -11,13 +11,13 @@
}
if (parentNodeTxt == "Slice") {
- return "&slice=" + selectedNodeTxt;
+ return "&event=libvirt_heartbeat&slice=" + selectedNodeTxt;
} else if (parentNodeTxt == "Site") {
- return "&site=" + selectedNodeTxt;
+ return "&event=node_heartbeat&site=" + selectedNodeTxt;
} else if (parentNodeTxt == "Node") {
- return "&node=" + selectedNodeTxt;
+ return "&event=node_heartbeat&node=" + selectedNodeTxt;
} else {
- return "";
+ return "&event=node_heartbeat";
}
}
@@ -48,8 +48,10 @@
}
function updatePageAnalytics() {
+ var url= '/analytics/bigquery/?avg=%cpu&count=%hostname&cached=1' + getObjectAndEventQuery();
+ console.log(url);
$.ajax({
- url : '/analytics/bigquery/?avg=%cpu&count=%hostname&cached=1' + getObjectQuery(),
+ url: url,
dataType : 'json',
type : 'GET',
success: function(newData)
@@ -73,8 +75,10 @@
}
function updatePageBandwidth() {
+ var url='/analytics/bigquery/?computed=%bytes_sent/%elapsed&cached=1' + getObjectAndEventQuery();
+
$.ajax({
- url : '/analytics/bigquery/?computed=%bytes_sent/%elapsed&cached=1' + getObjectQuery(),
+ url : url,
dataType : 'json',
type : 'GET',
success: function(newData)
diff --git a/planetstack/templates/admin/newminidashboard.html b/planetstack/templates/admin/newminidashboard.html
index 5b9bc4d..1c6d661 100644
--- a/planetstack/templates/admin/newminidashboard.html
+++ b/planetstack/templates/admin/newminidashboard.html
@@ -1,4 +1,6 @@
<div id="newMiniDashboard">
+ <div class="hide" id="selectedMainNav">{{ opts.verbose_name_plural|capfirst }}</div>
+ <div class="hide" id="currentOriginalNode">{{ original|truncatewords:"18" }}</div>
<div class="miniDashPair">
<button type="button" name="nodeCount" id="miniDashNodeCount" class="minidashbutton">--</button>
<label for="nodeCount" id="miniDashNodeCountLabel">Node Count</label>