From 7b421acdea391fe3fa6c957661e7c5e903f6f065 Mon Sep 17 00:00:00 2001 From: Martin Geno Date: Sat, 16 Jul 2016 16:12:37 +0200 Subject: [PATCH] current channel --- public/app/changes.jade | 16 ---------------- public/app/changes.js | 25 ------------------------- public/app/index.js | 7 +------ public/app/main.jade | 4 ++-- public/app/nodes/nodesGroup.jade | 10 ++++++++-- public/app/nodes/nodesGroup.js | 2 +- public/app/nodes/nodesSort.jade | 5 ++++- public/app/nodes/nodesSort.js | 2 +- public/components/config.js | 15 ++++++++------- public/components/store.js | 15 +++++++++++---- public/index.html | 1 - 11 files changed, 36 insertions(+), 66 deletions(-) delete mode 100644 public/app/changes.jade delete mode 100644 public/app/changes.js diff --git a/public/app/changes.jade b/public/app/changes.jade deleted file mode 100644 index 0bccd27..0000000 --- a/public/app/changes.jade +++ /dev/null @@ -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}} diff --git a/public/app/changes.js b/public/app/changes.js deleted file mode 100644 index 9d9901f..0000000 --- a/public/app/changes.js +++ /dev/null @@ -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); - }); - }); diff --git a/public/app/index.js b/public/app/index.js index eaf9efe..17b283b 100644 --- a/public/app/index.js +++ b/public/app/index.js @@ -26,13 +26,8 @@ angular.module('ffhb') templateUrl: 'app/node.html', controller: 'NodeCtrl' }) - .state('app.changes',{ - url:'/changes', - templateUrl: 'app/changes.html', - controller: 'ChangesCtrl' - }) .state('app.mapedit',{ - url:'/map/edit', + url:'/mapedit', templateUrl: 'app/map/index.html', controller: 'MapEditCtrl' }) diff --git a/public/app/main.jade b/public/app/main.jade index 5537a14..0e15cf0 100644 --- a/public/app/main.jade +++ b/public/app/main.jade @@ -12,10 +12,10 @@ ui.nav.navbar-nav li(ui-sref="app.nodes.sort",ng-class="{ active: $state.includes('app.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") 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 li a.bt.btn-link(ng-click="autorefreshUpdate()") diff --git a/public/app/nodes/nodesGroup.jade b/public/app/nodes/nodesGroup.jade index 6f23632..b5e69ca 100644 --- a/public/app/nodes/nodesGroup.jade +++ b/public/app/nodes/nodesGroup.jade @@ -1,6 +1,6 @@ table.table.table-striped.table-condensed( ng-table="tableParams") tr.ng-table-group(ng-repeat-start="group in $groups") - td(colspan=10) + td(colspan=12) a(ng-click="group.$hideRows = !group.$hideRows") span.glyphicon(ng-class="{ 'glyphicon-chevron-right': group.$hideRows, 'glyphicon-chevron-down': !group.$hideRows }") strong {{ group.value }} @@ -28,6 +28,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="'CurChannel'") + span {{row.current.wireless.channel24}} + span {{row.current.wireless.channel5}} td.split.text-right(data-title="'Clients'", sortable="'statistics.clients.wifi24'") span {{row.statistics.clients.wifi24}} 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}} 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) + td.text-right.split(data-title="'CurPower'") + span {{row.current.wireless.txpower24}} + span {{row.current.wireless.txpower5}} td(data-title="'Options'") .btn.btn-success.btn-sm(ng-click="save(row, rowForm)",ng-if="row.isEditing",ng-disabled="rowForm.$pristine || rowForm.$invalid") span.glyphicon.glyphicon-ok @@ -55,7 +61,7 @@ table.table.table-striped.table-condensed( ng-table="tableParams") td.split.text-right(data-title="'Freq'") span 2.4 Ghz span 5 Ghz - td + td(colspan=2) td.text-right.split span {{sum.client24}} span {{sum.client5}} diff --git a/public/app/nodes/nodesGroup.js b/public/app/nodes/nodesGroup.js index fa64f9d..f2f61bb 100644 --- a/public/app/nodes/nodesGroup.js +++ b/public/app/nodes/nodesGroup.js @@ -34,7 +34,7 @@ angular.module('ffhb') function render(prom){ prom.then(function(data){ $scope.sum = { - all: data.nodesCount, + all: data.aliasesCount, online: 0, client24: 0, client5: 0 diff --git a/public/app/nodes/nodesSort.jade b/public/app/nodes/nodesSort.jade index 3d8a07f..0a2aa26 100644 --- a/public/app/nodes/nodesSort.jade +++ b/public/app/nodes/nodesSort.jade @@ -22,6 +22,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="'CurChannel'") + span {{row.current.wireless.channel24}} + span {{row.current.wireless.channel5}} td.split.text-right(data-title="'Clients'") span {{row.statistics.clients.wifi24}} 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'") span 2.4 Ghz span 5 Ghz - td + td(colspan=2) td.text-right.split span {{sum.client24}} span {{sum.client5}} diff --git a/public/app/nodes/nodesSort.js b/public/app/nodes/nodesSort.js index 76e416a..c3afe7f 100644 --- a/public/app/nodes/nodesSort.js +++ b/public/app/nodes/nodesSort.js @@ -39,7 +39,7 @@ angular.module('ffhb') function render(prom){ prom.then(function(data){ $scope.sum = { - all: data.nodesCount, + all: data.aliasesCount, online: 0, client24: 0, client5: 0 diff --git a/public/components/config.js b/public/components/config.js index 6d500e5..847bc8e 100644 --- a/public/components/config.js +++ b/public/components/config.js @@ -2,11 +2,14 @@ angular.module('config', []) .factory('config', function() { return { - api: 'https://mgmt.ffhb.de/api', + api: 'https://ffhb.h.sum7.de/api', + showOnlyManaged: true, + geojson: false, + refresh: 15000, map: { - view: {lat: 53.0702, lng: 8.815, zoom: 16}, - maxZoom: 19, - tileLayer: 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', + view: {lat: 53.07093, lng: 8.79464, zoom: 17}, + maxZoom: 20, + tileLayer: '//tiles.bremen.freifunk.net/{z}/{x}/{y}.png', heatMax: { wifi24: 15, wifi5: 50 @@ -45,8 +48,6 @@ angular.module('config', []) }; } } - }, - geojson: 'https://mgmt.ffhb.de/meshviewer.geojson', - refresh: 15000 + } }; }); diff --git a/public/components/store.js b/public/components/store.js index 4a620d4..0e053d8 100644 --- a/public/components/store.js +++ b/public/components/store.js @@ -28,9 +28,11 @@ angular.module('ffhb') aliases: {},aliasesCount:0 }; var geojsonDeferred = $q.defer(); - $http.get(config.geojson).success(function(geojson) { - geojsonDeferred.resolve(geojson); - }); + if(config.geojson){ + $http.get(config.geojson).success(function(geojson) { + geojsonDeferred.resolve(geojson); + }); + } myservice.getGeojson = geojsonDeferred.promise; myservice.refresh = function(notify) { @@ -50,8 +52,13 @@ angular.module('ffhb') }else { 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){ + if(config.showOnlyManaged){ + myservice._data.merged[key] = angular.copy(nodes[key]); + } var node = myservice._data.merged[key], alias = aliases[key]; node.nodeinfo.hostname = alias.hostname; diff --git a/public/index.html b/public/index.html index 6530c4e..4c19a93 100644 --- a/public/index.html +++ b/public/index.html @@ -63,7 +63,6 @@ -