current channel

This commit is contained in:
Martin Geno 2016-07-16 16:12:37 +02:00
parent ad88ed54d5
commit 7b421acdea
11 changed files with 36 additions and 66 deletions

View File

@ -1,16 +0,0 @@
.page-header
h1 Changes
table.table.table-striped.table-condensed( ng-table="tableParams")
tr(ng-repeat='row in $data',demo-tracked-table-row="row")
td(data-title="'Nodeid'", sortable="'row.nodeid'", filter="{'nodeid': 'text'}") {{row.nodeid}}
td(data-title="'Group'", sortable="'row.owner'", filter="{'owner': 'text'}") {{row.owner}}
td(data-title="'Hostname'", sortable="'row.hostname'", filter="{'hostname': 'text'}") {{row.hostname}}
td.split.text-right(data-title="'Freq'")
span 2.4 Ghz
span 5 Ghz
td.split.text-right(data-title="'Channel'", sortable="'row.wireless.channel24'",filter="{'wireless.channel24': 'number'}")
span {{row.wireless.channel24}}
span {{row.wireless.channel5}}
td.split.text-right(data-title="'TxPower'", sortable="'row.wireless.txpower24'",filter="{'wireless.txpower24': 'number'}")
span {{row.wireless.txpower24}}
span {{row.wireless.txpower5}}

View File

@ -1,25 +0,0 @@
'use strict';
angular.module('ffhb')
.controller('ChangesCtrl',function(NgTableParams,$scope,store){
$scope.tableParams = new NgTableParams({
sorting: { hostname: 'asc' },
total: 0,
count: 50
}, {
dataset: []
});
function render(prom){
prom.then(function(data){
var result = Object.keys(data.aliases).map(function(nodeid){
data.aliases[nodeid].nodeid = nodeid;
return data.aliases[nodeid];
});
$scope.tableParams.settings({dataset: result,total: data.aliasesCount});
});
}
render(store.getData);
$scope.$on('store', function(ev, prom) {
render(prom);
});
});

View File

@ -26,13 +26,8 @@ angular.module('ffhb')
templateUrl: 'app/node.html', templateUrl: 'app/node.html',
controller: 'NodeCtrl' controller: 'NodeCtrl'
}) })
.state('app.changes',{
url:'/changes',
templateUrl: 'app/changes.html',
controller: 'ChangesCtrl'
})
.state('app.mapedit',{ .state('app.mapedit',{
url:'/map/edit', url:'/mapedit',
templateUrl: 'app/map/index.html', templateUrl: 'app/map/index.html',
controller: 'MapEditCtrl' controller: 'MapEditCtrl'
}) })

View File

@ -12,10 +12,10 @@
ui.nav.navbar-nav ui.nav.navbar-nav
li(ui-sref="app.nodes.sort",ng-class="{ active: $state.includes('app.nodes') }") li(ui-sref="app.nodes.sort",ng-class="{ active: $state.includes('app.nodes') }")
a(nav navbar-nav) Nodes a(nav navbar-nav) Nodes
li(ui-sref="app.changes",ui-sref-active="active")
a(nav navbar-nav) Changes
li(ui-sref="app.map",ui-sref-active="active") li(ui-sref="app.map",ui-sref-active="active")
a(nav navbar-nav) Map a(nav navbar-nav) Map
li(ui-sref="app.mapedit",ui-sref-active="active")
a(nav navbar-nav) Edit
ui.nav.navbar-nav.navbar-right ui.nav.navbar-nav.navbar-right
li li
a.bt.btn-link(ng-click="autorefreshUpdate()") a.bt.btn-link(ng-click="autorefreshUpdate()")

View File

@ -1,6 +1,6 @@
table.table.table-striped.table-condensed( ng-table="tableParams") table.table.table-striped.table-condensed( ng-table="tableParams")
tr.ng-table-group(ng-repeat-start="group in $groups") tr.ng-table-group(ng-repeat-start="group in $groups")
td(colspan=10) td(colspan=12)
a(ng-click="group.$hideRows = !group.$hideRows") a(ng-click="group.$hideRows = !group.$hideRows")
span.glyphicon(ng-class="{ 'glyphicon-chevron-right': group.$hideRows, 'glyphicon-chevron-down': !group.$hideRows }") span.glyphicon(ng-class="{ 'glyphicon-chevron-right': group.$hideRows, 'glyphicon-chevron-down': !group.$hideRows }")
strong {{ group.value }} strong {{ group.value }}
@ -28,6 +28,9 @@ table.table.table-striped.table-condensed( ng-table="tableParams")
span(ng-switch-default) {{row.nodeinfo.wireless.channel5}} span(ng-switch-default) {{row.nodeinfo.wireless.channel5}}
div.controls(ng-switch-when="true",ng-class="rowForm.channel5.$invalid ? 'has-error' : ''") 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) input.editable-input.form-control.input-sm(type="text" name="channel5",ng-model='row.nodeinfo.wireless.channel5',required)
td.text-right.split(data-title="'CurChannel'")
span {{row.current.wireless.channel24}}
span {{row.current.wireless.channel5}}
td.split.text-right(data-title="'Clients'", sortable="'statistics.clients.wifi24'") td.split.text-right(data-title="'Clients'", sortable="'statistics.clients.wifi24'")
span {{row.statistics.clients.wifi24}} span {{row.statistics.clients.wifi24}}
span {{row.statistics.clients.wifi5}} span {{row.statistics.clients.wifi5}}
@ -41,6 +44,9 @@ table.table.table-striped.table-condensed( ng-table="tableParams")
span(ng-switch-default) {{row.nodeinfo.wireless.txpower5}} span(ng-switch-default) {{row.nodeinfo.wireless.txpower5}}
div.controls(ng-switch-when="true",ng-class="rowForm.txpower5.$invalid ? 'has-error' : ''") div.controls(ng-switch-when="true",ng-class="rowForm.txpower5.$invalid ? 'has-error' : ''")
input.editable-input.form-control.input-sm(type="text" name="txpower5",ng-model='row.nodeinfo.wireless.txpower5',required) input.editable-input.form-control.input-sm(type="text" name="txpower5",ng-model='row.nodeinfo.wireless.txpower5',required)
td.text-right.split(data-title="'CurPower'")
span {{row.current.wireless.txpower24}}
span {{row.current.wireless.txpower5}}
td(data-title="'Options'") td(data-title="'Options'")
.btn.btn-success.btn-sm(ng-click="save(row, rowForm)",ng-if="row.isEditing",ng-disabled="rowForm.$pristine || rowForm.$invalid") .btn.btn-success.btn-sm(ng-click="save(row, rowForm)",ng-if="row.isEditing",ng-disabled="rowForm.$pristine || rowForm.$invalid")
span.glyphicon.glyphicon-ok span.glyphicon.glyphicon-ok
@ -55,7 +61,7 @@ table.table.table-striped.table-condensed( ng-table="tableParams")
td.split.text-right(data-title="'Freq'") td.split.text-right(data-title="'Freq'")
span 2.4 Ghz span 2.4 Ghz
span 5 Ghz span 5 Ghz
td td(colspan=2)
td.text-right.split td.text-right.split
span {{sum.client24}} span {{sum.client24}}
span {{sum.client5}} span {{sum.client5}}

View File

@ -34,7 +34,7 @@ angular.module('ffhb')
function render(prom){ function render(prom){
prom.then(function(data){ prom.then(function(data){
$scope.sum = { $scope.sum = {
all: data.nodesCount, all: data.aliasesCount,
online: 0, online: 0,
client24: 0, client24: 0,
client5: 0 client5: 0

View File

@ -22,6 +22,9 @@ table.table.table-striped.table-condensed(ng-table="tableParams")
span(ng-switch-default) {{row.nodeinfo.wireless.channel5}} span(ng-switch-default) {{row.nodeinfo.wireless.channel5}}
div.controls(ng-switch-when="true",ng-class="rowForm.channel5.$invalid ? 'has-error' : ''") 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) input.editable-input.form-control.input-sm(type="text" name="channel5",ng-model='row.nodeinfo.wireless.channel5',required)
td.text-right.split(data-title="'CurChannel'")
span {{row.current.wireless.channel24}}
span {{row.current.wireless.channel5}}
td.split.text-right(data-title="'Clients'") td.split.text-right(data-title="'Clients'")
span {{row.statistics.clients.wifi24}} span {{row.statistics.clients.wifi24}}
span {{row.statistics.clients.wifi5}} span {{row.statistics.clients.wifi5}}
@ -52,7 +55,7 @@ table.table.table-striped.table-condensed(ng-table="tableParams")
td.split.text-right(data-title="'Freq'") td.split.text-right(data-title="'Freq'")
span 2.4 Ghz span 2.4 Ghz
span 5 Ghz span 5 Ghz
td td(colspan=2)
td.text-right.split td.text-right.split
span {{sum.client24}} span {{sum.client24}}
span {{sum.client5}} span {{sum.client5}}

View File

@ -39,7 +39,7 @@ angular.module('ffhb')
function render(prom){ function render(prom){
prom.then(function(data){ prom.then(function(data){
$scope.sum = { $scope.sum = {
all: data.nodesCount, all: data.aliasesCount,
online: 0, online: 0,
client24: 0, client24: 0,
client5: 0 client5: 0

View File

@ -2,11 +2,14 @@
angular.module('config', []) angular.module('config', [])
.factory('config', function() { .factory('config', function() {
return { return {
api: 'https://mgmt.ffhb.de/api', api: 'https://ffhb.h.sum7.de/api',
showOnlyManaged: true,
geojson: false,
refresh: 15000,
map: { map: {
view: {lat: 53.0702, lng: 8.815, zoom: 16}, view: {lat: 53.07093, lng: 8.79464, zoom: 17},
maxZoom: 19, maxZoom: 20,
tileLayer: 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', tileLayer: '//tiles.bremen.freifunk.net/{z}/{x}/{y}.png',
heatMax: { heatMax: {
wifi24: 15, wifi24: 15,
wifi5: 50 wifi5: 50
@ -45,8 +48,6 @@ angular.module('config', [])
}; };
} }
} }
}, }
geojson: 'https://mgmt.ffhb.de/meshviewer.geojson',
refresh: 15000
}; };
}); });

View File

@ -28,9 +28,11 @@ angular.module('ffhb')
aliases: {},aliasesCount:0 aliases: {},aliasesCount:0
}; };
var geojsonDeferred = $q.defer(); var geojsonDeferred = $q.defer();
$http.get(config.geojson).success(function(geojson) { if(config.geojson){
geojsonDeferred.resolve(geojson); $http.get(config.geojson).success(function(geojson) {
}); geojsonDeferred.resolve(geojson);
});
}
myservice.getGeojson = geojsonDeferred.promise; myservice.getGeojson = geojsonDeferred.promise;
myservice.refresh = function(notify) { myservice.refresh = function(notify) {
@ -50,8 +52,13 @@ angular.module('ffhb')
}else { }else {
myservice._data.nodes = nodes; myservice._data.nodes = nodes;
} }
angular.copy(nodes, myservice._data.merged); if(!config.showOnlyManaged){
angular.copy(nodes, myservice._data.merged);
}
Object.keys(aliases).map(function(key){ Object.keys(aliases).map(function(key){
if(config.showOnlyManaged){
myservice._data.merged[key] = angular.copy(nodes[key]);
}
var node = myservice._data.merged[key], var node = myservice._data.merged[key],
alias = aliases[key]; alias = aliases[key];
node.nodeinfo.hostname = alias.hostname; node.nodeinfo.hostname = alias.hostname;

View File

@ -63,7 +63,6 @@
<!-- build:js({.tmp,public}) app/app.js --> <!-- build:js({.tmp,public}) app/app.js -->
<script src="app/app.js"></script> <script src="app/app.js"></script>
<!-- injector:js --> <!-- injector:js -->
<script src="app/changes.js"></script>
<script src="app/index.js"></script> <script src="app/index.js"></script>
<script src="app/main.js"></script> <script src="app/main.js"></script>
<script src="app/map/edit.js"></script> <script src="app/map/edit.js"></script>