Remove clients over time graph if no data is returned (privacy mode!)

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2018-04-04 14:24:59 +02:00
parent 634fa7f2b3
commit 081afa4924

View File

@@ -294,6 +294,13 @@ function updateClientsOverTime() {
// convert received objects to arrays
data.over_time = objectToArray(data.over_time);
// Remove graph if there are no results (e.g. privacy mode enabled)
if(jQuery.isEmptyObject(data.over_time))
{
$("#clients").parent().remove();
return;
}
// remove last data point since it not representative
data.over_time[0].splice(-1,1);
var timestamps = data.over_time[0];
@@ -492,6 +499,7 @@ function updateTopClientsChart() {
if(jQuery.isEmptyObject(data.top_sources))
{
$("#client-frequency").parent().remove();
return;
}
$("#client-frequency .overlay").hide();
@@ -535,6 +543,7 @@ function updateTopLists() {
if(jQuery.isEmptyObject(data.top_queries))
{
$("#domain-frequency").parent().remove();
return;
}
for (domain in data.top_ads) {
@@ -558,6 +567,7 @@ function updateTopLists() {
if(jQuery.isEmptyObject(data.top_ads))
{
$("#ad-frequency").parent().remove();
return;
}
$("#domain-frequency .overlay").hide();