refactor setData

This commit is contained in:
Nils Schneider 2015-03-29 17:48:25 +02:00
commit a031ac336d
7 changed files with 47 additions and 35 deletions

View file

@ -3,12 +3,12 @@ define(["moment"], function (moment) {
var self = this
var p
self.setData = function (nodes) {
var totalNodes = sum(nodes.filter(online).map(one))
var totalClients = sum(nodes.filter(online).map( function (d) {
self.setData = function (d) {
var totalNodes = sum(d.nodes.all.filter(online).map(one))
var totalClients = sum(d.nodes.all.filter(online).map( function (d) {
return d.statistics.clients
}))
var totalGateways = sum(nodes.filter(online).filter( function (d) {
var totalGateways = sum(d.nodes.all.filter(online).filter( function (d) {
return d.flags.gateway
}).map(one))
@ -17,7 +17,7 @@ define(["moment"], function (moment) {
totalGateways + " Gateways"
p.appendChild(document.createElement("br"))
p.appendChild(document.createTextNode("Diese Daten sind von " + moment(nodes.timestamp).format("LLLL") + "."))
p.appendChild(document.createTextNode("Diese Daten sind von " + moment(d.timestamp).format("LLLL") + "."))
}
self.render = function (el) {