add autorefresh-toggle + map layer node and geojson

This commit is contained in:
Martin Geno 2016-07-15 13:55:52 +02:00
parent 674aa3f4d5
commit ed6c96cbae
7 changed files with 20 additions and 13 deletions

View File

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

View File

@ -1 +1 @@
leaflet.map.global(id="globalmap")
leaflet.map.global(id="globalmap",defaults="defaults")

View File

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

View File

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

View File

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

View File

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

View File

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