preview
This commit is contained in:
parent
b5555f043d
commit
23fe7f2e0a
|
@ -5,3 +5,6 @@ form > .btn+.btn
|
|||
td.split
|
||||
span
|
||||
display block
|
||||
|
||||
.map.node
|
||||
height 300px
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
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
|
||||
ui.nav.navbar-nav.navbar-right
|
||||
li
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
.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(geojson=geojson,center=center,markers=markers)
|
||||
// leaflet.map.node(geojson=geojson,center=center,markers=markers)
|
||||
button.btn.btn-default(type="submit")
|
||||
span.glyphicon.glyphicon-floppy-disk(aria-hidden="true")
|
||||
| Save
|
||||
span.btn.btn-default(ng-click="gps()")
|
||||
// span.btn.btn-default(ng-click="gps()")
|
||||
span.glyphicon.glyphicon-map-marker(aria-hidden="true")
|
||||
| GPS
|
||||
|
|
|
@ -12,7 +12,7 @@ angular.module('ffhb')
|
|||
});
|
||||
function render(prom){
|
||||
prom.then(function(data){
|
||||
var result = Object.keys(data.nodes).map(function(nodeid){
|
||||
var result = Object.keys(data.merged).map(function(nodeid){
|
||||
data.merged[nodeid].nodeid = nodeid;
|
||||
return data.merged[nodeid];
|
||||
});
|
||||
|
|
|
@ -11,7 +11,7 @@ angular.module('ffhb')
|
|||
});
|
||||
function render(prom){
|
||||
prom.then(function(data){
|
||||
var result = Object.keys(data.nodes).map(function(nodeid){
|
||||
var result = Object.keys(data.merged).map(function(nodeid){
|
||||
data.merged[nodeid].nodeid = nodeid;
|
||||
return data.merged[nodeid];
|
||||
});
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
angular.module('config', [])
|
||||
.factory('config', function() {
|
||||
return {
|
||||
api: 'http://mgmt.ffhb.de/api',
|
||||
api: 'https://mgmt.ffhb.de/api',
|
||||
map: {
|
||||
view: {lat: 53.0702, lng: 8.815}
|
||||
},
|
||||
geojson: 'https://raw.githubusercontent.com/FreifunkBremen/internal-maps/master/breminale.geojson',
|
||||
geojson: 'https://meshviewer.breminale.ffhb.de/data/meshviewer.geojson',
|
||||
refresh: 60000
|
||||
};
|
||||
});
|
||||
|
|
|
@ -24,6 +24,7 @@ angular.module('ffhb')
|
|||
myservice._initialized = false;
|
||||
myservice._data = $cookieStore.get('data') ||{
|
||||
nodes: {},nodesCount:0,
|
||||
merged: {},
|
||||
aliases: {},aliasesCount:0
|
||||
};
|
||||
var geojsonDeferred = $q.defer();
|
||||
|
@ -32,22 +33,26 @@ angular.module('ffhb')
|
|||
});
|
||||
myservice.getGeojson = geojsonDeferred.promise;
|
||||
|
||||
myservice.refresh = function() {
|
||||
myservice.refresh = function(notify) {
|
||||
var dataDeferred = $q.defer();
|
||||
$http.get(config.api+'/nodes').success(function(nodes) {
|
||||
$http.get(config.api+'/aliases').success(function(aliases) {
|
||||
if(notify){
|
||||
Object.keys(nodes).map(function(key){
|
||||
if(myservice._data.nodes === undefined || myservice._data.nodes[key] === undefined){
|
||||
notifyNew(key);
|
||||
}
|
||||
if(myservice._data.nodes !== undefined && myservice._data.nodes[key].flags.offline){
|
||||
if(myservice._data.nodes !== undefined && myservice._data.nodes[key] !== undefined && myservice._data.nodes[key].flags.offline){
|
||||
notifyOffline(key);
|
||||
}
|
||||
myservice._data.nodes[key] = nodes[key];
|
||||
});
|
||||
}else {
|
||||
myservice._data.nodes = nodes;
|
||||
}
|
||||
angular.copy(nodes, myservice._data.merged);
|
||||
Object.keys(aliases).map(function(key){
|
||||
var node = myservice._data.merged[key],
|
||||
var node = myservice._data.nodes[key],
|
||||
alias = aliases[key];
|
||||
node.nodeinfo.hostname = alias.hostname;
|
||||
if(!node.nodeinfo.owner){
|
||||
|
@ -98,7 +103,7 @@ angular.module('ffhb')
|
|||
myservice.getData = dataDeferred.promise;
|
||||
return dataDeferred.promise;
|
||||
};
|
||||
myservice.refresh();
|
||||
myservice.refresh(false);
|
||||
|
||||
myservice.saveNode = function(nodeid){
|
||||
var result = $q.defer();
|
||||
|
@ -109,7 +114,7 @@ angular.module('ffhb')
|
|||
'owner':node.owner.contact
|
||||
}).then(function(){
|
||||
result.resolve(true);
|
||||
myservice.refresh();
|
||||
myservice.refresh(true);
|
||||
});
|
||||
}else{
|
||||
result.resolve(false);
|
||||
|
@ -120,7 +125,7 @@ angular.module('ffhb')
|
|||
|
||||
if(config.refresh){
|
||||
$interval(function () {
|
||||
myservice.refresh();
|
||||
myservice.refresh(true);
|
||||
}, config.refresh);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue