diff --git a/public/app/nodes/nodesGroup.jade b/public/app/nodes/nodesGroup.jade index 3b5326c..b88f642 100644 --- a/public/app/nodes/nodesGroup.jade +++ b/public/app/nodes/nodesGroup.jade @@ -30,6 +30,9 @@ table.table.table-striped.table-condensed( ng-table="tableParams") span(ng-switch-default) {{row.nodeinfo.wireless.channel5}} div.controls(ng-switch-when="true",ng-class="rowForm.channel5.$invalid ? 'has-error' : ''") input.editable-input.form-control.input-sm(type="text" name="channel5",ng-model='row.nodeinfo.wireless.channel5',required) + td.text-right.split(data-title="'Noise'") + span {{row.statistics.wireless.airtime24.noise}} + span {{row.statistics.wireless.airtime5.noise}} td.text-right.split(data-title="'Power'",filter="{'txpower24': 'number'}",ng-switch="row.isEditing") span(ng-switch-default) {{row.nodeinfo.wireless.txpower24}} div.controls(ng-switch-when="true",ng-class="rowForm.txpower24.$invalid ? 'has-error' : ''") @@ -46,3 +49,11 @@ table.table.table-striped.table-condensed( ng-table="tableParams") span.glyphicon.glyphicon-pencil a.btn.btn-default(ui-sref="app.node({nodeid: row.nodeid})") span.glyphicon.glyphicon-qrcode + tr + td(colspan=5) Online: {{sum.online}}/{{sum.all}} + td.split.text-right(data-title="'Freq'") + span 2.4 Ghz + span 5 Ghz + td.split(colspan=5) + span {{sum.client24}} + span {{sum.client5}} diff --git a/public/app/nodes/nodesGroup.js b/public/app/nodes/nodesGroup.js index fdb7547..fa64f9d 100644 --- a/public/app/nodes/nodesGroup.js +++ b/public/app/nodes/nodesGroup.js @@ -2,6 +2,12 @@ angular.module('ffhb') .controller('NodesGroupCtrl',function(NgTableParams,$scope,store){ + $scope.sum = { + all: 0, + online: 0, + client24: 0, + client5: 0 + }; $scope.tableParams = new NgTableParams({ sorting: { 'nodeinfo.hostname': 'asc' }, group: 'nodeinfo.owner.contact', @@ -27,12 +33,25 @@ angular.module('ffhb') function render(prom){ prom.then(function(data){ - var result = Object.keys(data.merged).map(function(nodeid){ - data.merged[nodeid].nodeid = nodeid; - return data.merged[nodeid]; + $scope.sum = { + all: data.nodesCount, + online: 0, + client24: 0, + client5: 0 + }; + originalData = Object.keys(data.merged).map(function(nodeid){ + var merg = data.merged[nodeid]; + merg.nodeid = nodeid; + if(merg.flags.online){ + $scope.sum.online++; + } + if(merg.statistics !== undefined && merg.statistics.clients !== undefined){ + $scope.sum.client24 += merg.statistics.clients.wifi24; + $scope.sum.client5 += merg.statistics.clients.wifi5; + } + return merg; }); - originalData = result; - $scope.tableParams.settings({dataset: angular.copy(result),total: data.nodesCount}); + $scope.tableParams.settings({dataset: angular.copy(originalData),total: data.nodesCount}); }); } render(store.getData); diff --git a/public/app/nodes/nodesSort.jade b/public/app/nodes/nodesSort.jade index 8754705..cfe16e1 100644 --- a/public/app/nodes/nodesSort.jade +++ b/public/app/nodes/nodesSort.jade @@ -24,6 +24,9 @@ table.table.table-striped.table-condensed( ng-table="tableParams") span(ng-switch-default) {{row.nodeinfo.wireless.channel5}} div.controls(ng-switch-when="true",ng-class="rowForm.channel5.$invalid ? 'has-error' : ''") input.editable-input.form-control.input-sm(type="text" name="channel5",ng-model='row.nodeinfo.wireless.channel5',required) + td.text-right.split(data-title="'Noise'") + span {{row.statistics.wireless.airtime24.noise}} + span {{row.statistics.wireless.airtime5.noise}} td.text-right.split(data-title="'Power'",filter="{'txpower24': 'number'}",ng-switch="row.isEditing") span(ng-switch-default) {{row.nodeinfo.wireless.txpower24}} div.controls(ng-switch-when="true",ng-class="rowForm.txpower24.$invalid ? 'has-error' : ''") @@ -40,3 +43,11 @@ table.table.table-striped.table-condensed( ng-table="tableParams") span.glyphicon.glyphicon-pencil a.btn.btn-default(ui-sref="app.node({nodeid: row.nodeid})") span.glyphicon.glyphicon-qrcode + tr + td(colspan=5) Online: {{sum.online}}/{{sum.all}} + td.split.text-right(data-title="'Freq'") + span 2.4 Ghz + span 5 Ghz + td.split(colspan=5) + span {{sum.client24}} + span {{sum.client5}} diff --git a/public/app/nodes/nodesSort.js b/public/app/nodes/nodesSort.js index 14dcf88..8e7179e 100644 --- a/public/app/nodes/nodesSort.js +++ b/public/app/nodes/nodesSort.js @@ -2,6 +2,12 @@ angular.module('ffhb') .controller('NodesSortCtrl',function(NgTableParams,$scope,store){ + $scope.sum = { + all: 0, + online: 0, + client24: 0, + client5: 0 + }; $scope.tableParams = new NgTableParams({ sorting: { 'nodeinfo.hostname': 'asc' }, total: 0, @@ -77,9 +83,23 @@ angular.module('ffhb') function render(prom){ prom.then(function(data){ + $scope.sum = { + all: data.nodesCount, + online: 0, + client24: 0, + client5: 0 + }; originalData = Object.keys(data.merged).map(function(nodeid){ - data.merged[nodeid].nodeid = nodeid; - return data.merged[nodeid]; + var merg = data.merged[nodeid]; + merg.nodeid = nodeid; + if(merg.flags.online){ + $scope.sum.online++; + } + if(merg.statistics !== undefined && merg.statistics.clients !== undefined){ + $scope.sum.client24 += merg.statistics.clients.wifi24; + $scope.sum.client5 += merg.statistics.clients.wifi5; + } + return merg; }); $scope.tableParams.settings({dataset: angular.copy(originalData),total: data.nodesCount}); });