print BigQuery Unavailable msg if bigquery is not initialized
diff --git a/planetstack/core/static/page_analytics.js b/planetstack/core/static/page_analytics.js
index d9e98e1..bf7e37d 100644
--- a/planetstack/core/static/page_analytics.js
+++ b/planetstack/core/static/page_analytics.js
@@ -44,13 +44,20 @@
window.pageAnalyticsUrl = summaryData["dataSourceUrl"];
lastRow = summaryData.rows.length-1;
+ if (summaryData.msg) {
+ $("#minidashStatus").text(summaryData.msg).show();
+ } else {
+ $("#minidashStatus").text("").hide();
+ }
+
if (summaryData.rows.length <= 0) {
//console.log("no data received from page analytics ajax")
return;
}
- setPageStatInt(".nodesLabel", ".nodesValue", "Node Count", "", summaryData.rows[lastRow]["count_hostname"]);
- setPageStatInt(".cpuLabel", ".cpuValue", "Avg Load", "%", summaryData.rows[lastRow]["avg_cpu"]);
+ //Old minidashboard
+ //setPageStatInt(".nodesLabel", ".nodesValue", "Node Count", "", summaryData.rows[lastRow]["count_hostname"]);
+ //setPageStatInt(".cpuLabel", ".cpuValue", "Avg Load", "%", summaryData.rows[lastRow]["avg_cpu"]);
//New miniDashboard
setPageStatInt("#miniDashNodeCountLabel", "#miniDashNodeCount", "Node Count", "", summaryData.rows[lastRow]["count_hostname"]);
@@ -86,7 +93,10 @@
return;
}
- setPageStatFloat(".bandwidthLabel", ".bandwidthValue", "Bandwidth", " Gbps", summaryData.rows[lastRow]["sum_computed_bytes_sent_div_elapsed"]*8.0/1024/1024/1024,2);
+ //Old minidashboard
+ //setPageStatFloat(".bandwidthLabel", ".bandwidthValue", "Bandwidth", " Gbps", summaryData.rows[lastRow]["sum_computed_bytes_sent_div_elapsed"]*8.0/1024/1024/1024,2);
+
+ //New minidashboard
setPageStatFloat("#miniDashBandwidthLabel", "#miniDashBandwidth", "Bandwidth", " Gbps", summaryData.rows[lastRow]["sum_computed_bytes_sent_div_elapsed"]*8.0/1024/1024/1024,2);
}
diff --git a/planetstack/hpc_wizard/planetstack_analytics.py b/planetstack/hpc_wizard/planetstack_analytics.py
index 3ba79a6..75462d4 100644
--- a/planetstack/hpc_wizard/planetstack_analytics.py
+++ b/planetstack/hpc_wizard/planetstack_analytics.py
@@ -1,4 +1,4 @@
-from bigquery_analytics import BigQueryAnalytics
+from bigquery_analytics import BigQueryAnalytics, BIGQUERY_AVAILABLE
import datetime
import re
import os
@@ -180,8 +180,13 @@
return value.split(",")
def format_result(self, format, result, query, dataSourceUrl):
+ if not BIGQUERY_AVAILABLE:
+ msg = "BigQuery Statistics Unavaiable"
+ else:
+ msg = None
+
if (format == "json_dicts"):
- result = {"query": query, "rows": result, "dataSourceUrl": dataSourceUrl}
+ result = {"query": query, "rows": result, "dataSourceUrl": dataSourceUrl, "msg": msg}
return ("application/javascript", json.dumps(result))
elif (format == "json_arrays"):
@@ -191,7 +196,7 @@
for key in sorted(row.keys()):
new_row.append(row[key])
new_result.append(new_row)
- new_result = {"query": query, "rows": new_result}
+ new_result = {"query": query, "rows": new_result, "msg": msg}
return ("application/javascript", json.dumps(new_result))
elif (format == "html_table"):
diff --git a/planetstack/templates/admin/newminidashboard.html b/planetstack/templates/admin/newminidashboard.html
index f576bbc..f1180ab 100644
--- a/planetstack/templates/admin/newminidashboard.html
+++ b/planetstack/templates/admin/newminidashboard.html
@@ -3,6 +3,7 @@
<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="hide" id="minidashStatus"></div>
<div class="miniDashPair">
<button type="button" name="nodeCount" id="miniDashNodeCount" class="minidashbutton">--</button>
<label for="nodeCount" id="miniDashNodeCountLabel">Active Nodes</label>