add noise and endtable statistic

This commit is contained in:
Martin Geno 2016-07-13 20:47:26 +02:00
parent eaac3aab9c
commit 5dc0e75592
4 changed files with 68 additions and 7 deletions

View File

@ -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}}

View File

@ -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);

View File

@ -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}}

View File

@ -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});
});