error and no data messages for historical tab
diff --git a/planetstack/templates/admin/dashboard/hpc_historical.html b/planetstack/templates/admin/dashboard/hpc_historical.html
index e312ee9..2e3b85e 100644
--- a/planetstack/templates/admin/dashboard/hpc_historical.html
+++ b/planetstack/templates/admin/dashboard/hpc_historical.html
@@ -21,11 +21,10 @@
function updateDataSourceUrl() {
var sliceName = $("#historical_slicename :selected").text();
var queryString = "/analytics/bigquery/?timeBucket=600&maxAge=86400&sum=@bytes_sent&avg=@cpu&groupBy=Time,city,@hostname,@site&slice=" + sliceName;
- var loadingDiv = '<div class="loading">Loading ...</div>';
$( "#control1").html("");
$( "#control2").html("");
- $( "#chart-site-agg" ).html(loadingDiv);
+ $( "#chart-site-agg" ).html("<div class='loading'>Loading ...</div>");
$( "#chart-site-time" ).html("");
$( "#chart-geo" ).html("");
@@ -191,6 +190,16 @@
var format0dp = new google.visualization.NumberFormat({fractionDigits:0});
var format2dp = new google.visualization.NumberFormat({fractionDigits:2});
+ if (response.isError()) {
+ $( "#chart-site-agg" ).html("<div class='loading'>Error while fetching data.</div>");
+ return;
+ }
+
+ if (response.getDataTable().getNumberOfRows() == 0) {
+ $( "#chart-site-agg" ).html("<div class='loading'>No data for this slice.</div>");
+ return;
+ }
+
// Create a group for charts that will have a horizontal axis that is
// time.