From ed6c96cbae131667b66cb448f010ad3f2f7af177 Mon Sep 17 00:00:00 2001 From: Martin Geno Date: Fri, 15 Jul 2016 13:55:52 +0200 Subject: [PATCH] add autorefresh-toggle + map layer node and geojson --- public/app/app.js | 4 ++++ public/app/map/index.jade | 2 +- public/app/map/index.js | 9 +++------ public/app/node.jade | 2 +- public/app/nodes/nodesSort.jade | 5 ++++- public/app/nodes/nodesSort.js | 5 +++-- public/components/config.js | 6 ++++-- 7 files changed, 20 insertions(+), 13 deletions(-) diff --git a/public/app/app.js b/public/app/app.js index 86c7658..064ae6d 100644 --- a/public/app/app.js +++ b/public/app/app.js @@ -18,6 +18,10 @@ angular.module('ffhb', [ //$locationProvider.html5Mode(true).hashPrefix('!'); //$httpProvider.defaults.withCredentials = true; }]).run(function(amMoment,$cookieStore,$rootScope,$http,config) { + $rootScope.defaults = { + maxZoom: config.map.maxZoom, + tileLayer: config.map.tileLayer + }; amMoment.changeLocale('de'); $rootScope.globals = $cookieStore.get('globals') || {}; $rootScope.autorefresh = config.refresh; diff --git a/public/app/map/index.jade b/public/app/map/index.jade index 9738d4d..1f43a20 100644 --- a/public/app/map/index.jade +++ b/public/app/map/index.jade @@ -1 +1 @@ -leaflet.map.global(id="globalmap") +leaflet.map.global(id="globalmap",defaults="defaults") diff --git a/public/app/map/index.js b/public/app/map/index.js index d606595..f25be2a 100644 --- a/public/app/map/index.js +++ b/public/app/map/index.js @@ -2,9 +2,6 @@ angular.module('ffhb') .controller('MapCtrl',function($state,$stateParams,$scope,store,config,leafletData){ - if($stateParams.nodeid){ - $scope.nodeid = $stateParams.nodeid.toLowerCase(); - } var layerControl,geoLayer,nodeLayer,client24Layer,client5Layer; leafletData.getMap('globalmap').then(function(map) { layerControl = L.control.layers().addTo(map); @@ -13,7 +10,7 @@ angular.module('ffhb') store.getGeojson.then(function(data){ leafletData.getMap('globalmap').then(function(map) { geoLayer = L.geoJson(data,config.map.geojson); - layerControl.addOverlay(geoLayer,'GEOJSON'); + layerControl.addOverlay(geoLayer,'Gelände'); geoLayer.addTo(map); }); }); @@ -33,8 +30,8 @@ angular.module('ffhb') client5Layer.clearLayers(); } nodeLayer = L.markerClusterGroup({maxClusterRadius:20}); - client24Layer = L.heatLayer([],{max: config.map.heatMax.wifi24}); - client5Layer = L.heatLayer([],{max: config.map.heatMax.wifi5}); + client24Layer = L.heatLayer([],{max: config.map.heatMax.wifi24,radius:50,blur:25}); + client5Layer = L.heatLayer([],{max: config.map.heatMax.wifi5,radius:50,blur:25}); Object.keys(data.merged).map(function(nodeid){ var node = data.merged[nodeid]; if(node.nodeinfo.location !== undefined && node.nodeinfo.location.latitude !== undefined && node.nodeinfo.location.longitude !== undefined){ diff --git a/public/app/node.jade b/public/app/node.jade index 677e717..70f11df 100644 --- a/public/app/node.jade +++ b/public/app/node.jade @@ -16,7 +16,7 @@ .form-group(ng-class="rowForm.hostname.$invalid ? 'has-error' : ''") label(for="formHostname") Hostname input.form-control(id="formHostname",placeholder="Hostname",type="text",name="hostname",pattern="[a-zA-Z0-9-]*",ng-model='node.nodeinfo.hostname',required) - leaflet.map.node(id="nodemap",geojson="geojson",center="center",markers="markers",event-broadcast="events") + leaflet.map.node(id="nodemap",geojson="geojson",center="center",markers="markers",event-broadcast="events",defaults="defaults") button.btn.btn-default(type="submit") span.glyphicon.glyphicon-floppy-disk(aria-hidden="true") | Save diff --git a/public/app/nodes/nodesSort.jade b/public/app/nodes/nodesSort.jade index cd2da3f..3d8a07f 100644 --- a/public/app/nodes/nodesSort.jade +++ b/public/app/nodes/nodesSort.jade @@ -35,6 +35,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 @@ -53,4 +56,4 @@ table.table.table-striped.table-condensed(ng-table="tableParams") td.text-right.split span {{sum.client24}} span {{sum.client5}} - td(colspan=3) + td(colspan=4) diff --git a/public/app/nodes/nodesSort.js b/public/app/nodes/nodesSort.js index 3beba7d..76e416a 100644 --- a/public/app/nodes/nodesSort.js +++ b/public/app/nodes/nodesSort.js @@ -9,7 +9,7 @@ angular.module('ffhb') client5: 0 }; $scope.tableParams = new NgTableParams({ - sorting: { 'hostname': 'asc' }, + sorting: { 'nodeinfo.owner.contact': 'asc' }, total: 0, count: 100 }, { @@ -45,8 +45,9 @@ angular.module('ffhb') client5: 0 }; originalData = Object.keys(data.merged).map(function(nodeid){ - var merg = data.merged[nodeid]; + var merg = data.merged[nodeid],node = data.nodes[nodeid]; merg.nodeid = nodeid; + merg.current = { wireless: node.nodeinfo.wireless}; if(merg.flags.online){ $scope.sum.online++; } diff --git a/public/components/config.js b/public/components/config.js index 05421bf..6d500e5 100644 --- a/public/components/config.js +++ b/public/components/config.js @@ -5,9 +5,11 @@ angular.module('config', []) api: 'https://mgmt.ffhb.de/api', map: { view: {lat: 53.0702, lng: 8.815, zoom: 16}, + maxZoom: 19, + tileLayer: 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', heatMax: { - wifi24: 30, - wifi5: 100 + wifi24: 15, + wifi5: 50 }, icon:{ warn:{wifi24:20,wifi5:20},