Skip to content

Commit

Permalink
index.js: minor simplification
Browse files Browse the repository at this point in the history
Signed-off-by: XhmikosR <xhmikosr@gmail.com>
  • Loading branch information
XhmikosR committed May 26, 2020
1 parent 1767c3a commit dccbeb8
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions scripts/pi-hole/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,19 +354,12 @@ function updateClientsOverTime() {
var plotdata = data.over_time[1];
var labels = [];
var key, i, j;
for (key in data.clients) {
if (!Object.prototype.hasOwnProperty.call(data.clients, key)) {
continue;
}

var clientname;
if (data.clients[key].name.length > 0) {
clientname = data.clients[key].name;
} else {
clientname = data.clients[key].ip;
for (key in data.clients) {
if (Object.prototype.hasOwnProperty.call(data.clients, key)) {
var client = data.clients[key];
labels.push(client.name.length > 0 ? client.name : client.ip);
}

labels.push(clientname);
}

// Remove possibly already existing data
Expand Down Expand Up @@ -406,11 +399,9 @@ function updateClientsOverTime() {
}

for (key in plotdata[j]) {
if (!Object.prototype.hasOwnProperty.call(plotdata[j], key)) {
continue;
if (Object.prototype.hasOwnProperty.call(plotdata[j], key)) {
clientsChart.data.datasets[key].data.push(plotdata[j][key]);
}

clientsChart.data.datasets[key].data.push(plotdata[j][key]);
}

var d = new Date(1000 * parseInt(timestamps[j]));
Expand Down Expand Up @@ -767,7 +758,7 @@ function updateSummaryData(runOnce) {
);
}

window.setTimeout(function () {
setTimeout(function () {
$("span.glow").removeClass("glow");
}, 500);
})
Expand Down

0 comments on commit dccbeb8

Please sign in to comment.