try sorting + cookie to localstorage
This commit is contained in:
parent
62c2c86868
commit
eaac3aab9c
|
@ -25,6 +25,7 @@
|
||||||
"ui-leaflet": "^1.0.1",
|
"ui-leaflet": "^1.0.1",
|
||||||
"angular-cookies": "^1.5.7",
|
"angular-cookies": "^1.5.7",
|
||||||
"Leaflet.label": "^0.2.1",
|
"Leaflet.label": "^0.2.1",
|
||||||
"lodash": "^4.13.1"
|
"lodash": "^4.13.1",
|
||||||
|
"angularLocalStorage": "^0.3.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
angular.module('ffhb', [
|
angular.module('ffhb', [
|
||||||
'ngTable',
|
'ngTable',
|
||||||
'ngResource',
|
'ngResource',
|
||||||
'ngCookies',
|
'angularLocalStorage',
|
||||||
'ui.router',
|
'ui.router',
|
||||||
'ui.bootstrap',
|
'ui.bootstrap',
|
||||||
'ui-leaflet',
|
'ui-leaflet',
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
angular.module('ffhb')
|
angular.module('ffhb')
|
||||||
.controller('NodeCtrl',function($stateParams,$scope,store,config,leafletData){
|
.controller('NodeCtrl',function($stateParams,$scope,store,config,leafletData){
|
||||||
$scope.nodeid = $stateParams.nodeid;
|
$scope.nodeid = $stateParams.nodeid.toLowerCase();
|
||||||
$scope.loadingGPS = false;
|
$scope.loadingGPS = false;
|
||||||
$scope.node = {};
|
$scope.node = {};
|
||||||
angular.extend($scope, {
|
angular.extend($scope, {
|
||||||
|
@ -14,7 +14,7 @@ angular.module('ffhb')
|
||||||
title: 'Marker',
|
title: 'Marker',
|
||||||
draggable: true,
|
draggable: true,
|
||||||
label: {
|
label: {
|
||||||
message: 'Node:'+$stateParams.nodeid,
|
message: 'Node:'+$scope.nodeid,
|
||||||
options: {
|
options: {
|
||||||
noHide: true
|
noHide: true
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ angular.module('ffhb')
|
||||||
});
|
});
|
||||||
function render(prom){
|
function render(prom){
|
||||||
prom.then(function(data){
|
prom.then(function(data){
|
||||||
$scope.node = data.merged[$stateParams.nodeid];
|
$scope.node = data.merged[$scope.nodeid];
|
||||||
if($scope.node !== undefined && $scope.node.nodeinfo !== undefined){
|
if($scope.node !== undefined && $scope.node.nodeinfo !== undefined){
|
||||||
$scope.markers.node.lat = $scope.node.nodeinfo.location.latitude;
|
$scope.markers.node.lat = $scope.node.nodeinfo.location.latitude;
|
||||||
$scope.markers.node.lng = $scope.node.nodeinfo.location.longitude;
|
$scope.markers.node.lng = $scope.node.nodeinfo.location.longitude;
|
||||||
|
@ -47,7 +47,7 @@ angular.module('ffhb')
|
||||||
'latitude': args.model.lat,
|
'latitude': args.model.lat,
|
||||||
'longitude': args.model.lng
|
'longitude': args.model.lng
|
||||||
};
|
};
|
||||||
store.saveNode($stateParams.nodeid);
|
store.saveNode($scope.nodeid);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var setToGps = function(position){
|
var setToGps = function(position){
|
||||||
|
@ -61,7 +61,7 @@ angular.module('ffhb')
|
||||||
leafletData.getMap().then(function(map) {
|
leafletData.getMap().then(function(map) {
|
||||||
map.setView(pos);
|
map.setView(pos);
|
||||||
});
|
});
|
||||||
store.saveNode($stateParams.nodeid);
|
store.saveNode($scope.nodeid);
|
||||||
$scope.markers.node.lat = position.coords.latitude;
|
$scope.markers.node.lat = position.coords.latitude;
|
||||||
$scope.markers.node.lng = position.coords.longitude;
|
$scope.markers.node.lng = position.coords.longitude;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ table.table.table-striped.table-condensed( ng-table="tableParams")
|
||||||
span(ng-switch-default) {{row.nodeinfo.wireless.txpower24}}
|
span(ng-switch-default) {{row.nodeinfo.wireless.txpower24}}
|
||||||
div.controls(ng-switch-when="true",ng-class="rowForm.txpower24.$invalid ? 'has-error' : ''")
|
div.controls(ng-switch-when="true",ng-class="rowForm.txpower24.$invalid ? 'has-error' : ''")
|
||||||
input.editable-input.form-control.input-sm(type="text" name="txpower24",ng-model='row.nodeinfo.wireless.txpower24',required)
|
input.editable-input.form-control.input-sm(type="text" name="txpower24",ng-model='row.nodeinfo.wireless.txpower24',required)
|
||||||
span(ng-switch-default) {{row.nodeinfo.wireless.channel5}}
|
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(data-title="'Options'")
|
td(data-title="'Options'")
|
||||||
|
|
|
@ -8,7 +8,7 @@ angular.module('ffhb')
|
||||||
total: 0,
|
total: 0,
|
||||||
count: 100
|
count: 100
|
||||||
}, {
|
}, {
|
||||||
dataset: []
|
dataset: [{}]
|
||||||
});
|
});
|
||||||
var originalData = {};
|
var originalData = {};
|
||||||
$scope.cancel = function(row, rowForm) {
|
$scope.cancel = function(row, rowForm) {
|
||||||
|
|
|
@ -7,7 +7,52 @@ angular.module('ffhb')
|
||||||
total: 0,
|
total: 0,
|
||||||
count: 100
|
count: 100
|
||||||
}, {
|
}, {
|
||||||
dataset: []
|
dataset: [{
|
||||||
|
lastseen: new Date(),
|
||||||
|
firstseen: new Date(),
|
||||||
|
nodeid: 'loading',
|
||||||
|
nodeinfo: {
|
||||||
|
hostname: 'loading',
|
||||||
|
owner: {
|
||||||
|
contact: 'loading'
|
||||||
|
},
|
||||||
|
wireless: {
|
||||||
|
channel24: 0,
|
||||||
|
channel5: 0,
|
||||||
|
txpower24: 0,
|
||||||
|
txpower5: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
statistics: {
|
||||||
|
clients: {
|
||||||
|
wifi24: 0,
|
||||||
|
wifi5: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
lastseen: new Date(),
|
||||||
|
firstseen: new Date(),
|
||||||
|
nodeid: 'loading',
|
||||||
|
nodeinfo: {
|
||||||
|
hostname: 'loading',
|
||||||
|
owner: {
|
||||||
|
contact: 'loading'
|
||||||
|
},
|
||||||
|
wireless: {
|
||||||
|
channel24: 0,
|
||||||
|
channel5: 0,
|
||||||
|
txpower24: 0,
|
||||||
|
txpower5: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
statistics: {
|
||||||
|
clients: {
|
||||||
|
wifi24: 0,
|
||||||
|
wifi5: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]
|
||||||
});
|
});
|
||||||
var originalData = {};
|
var originalData = {};
|
||||||
function find(nodeid){
|
function find(nodeid){
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
angular.module('ffhb')
|
angular.module('ffhb')
|
||||||
.factory('store', function($state, $q, $http, $rootScope,config,$interval,$cookieStore,webNotification) {
|
.factory('store', function($state, $q, $http, $rootScope,config,$interval,storage,webNotification) {
|
||||||
function notifyNew(nodeid){
|
function notifyNew(nodeid){
|
||||||
webNotification.showNotification('New Node',{
|
webNotification.showNotification('New Node',{
|
||||||
body: '"'+nodeid+'"',
|
body: '"'+nodeid+'"',
|
||||||
|
@ -22,7 +22,7 @@ angular.module('ffhb')
|
||||||
|
|
||||||
var myservice = {};
|
var myservice = {};
|
||||||
myservice._initialized = false;
|
myservice._initialized = false;
|
||||||
myservice._data = $cookieStore.get('data') ||{
|
myservice._data = storage.get('data') ||{
|
||||||
nodes: {},nodesCount:0,
|
nodes: {},nodesCount:0,
|
||||||
merged: {},
|
merged: {},
|
||||||
aliases: {},aliasesCount:0
|
aliases: {},aliasesCount:0
|
||||||
|
@ -96,7 +96,7 @@ angular.module('ffhb')
|
||||||
if (myservice._initialized) {
|
if (myservice._initialized) {
|
||||||
$rootScope.$broadcast('store', dataDeferred.promise);
|
$rootScope.$broadcast('store', dataDeferred.promise);
|
||||||
}
|
}
|
||||||
$cookieStore.put('data',myservice._data);
|
storage.set('data',myservice._data);
|
||||||
myservice._initialized = true;
|
myservice._initialized = true;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
<script src="bower_components/ui-leaflet/dist/ui-leaflet.js"></script>
|
<script src="bower_components/ui-leaflet/dist/ui-leaflet.js"></script>
|
||||||
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
|
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
|
||||||
<script src="bower_components/lodash/lodash.js"></script>
|
<script src="bower_components/lodash/lodash.js"></script>
|
||||||
|
<script src="bower_components/angularLocalStorage/dist/angularLocalStorage.min.js"></script>
|
||||||
<!-- endbower -->
|
<!-- endbower -->
|
||||||
<script src="bower_components/Leaflet.label/dist/leaflet.label.js"></script>
|
<script src="bower_components/Leaflet.label/dist/leaflet.label.js"></script>
|
||||||
<script src="bower_components/angular-bootstrap/ui-bootstrap.min.js"></script>
|
<script src="bower_components/angular-bootstrap/ui-bootstrap.min.js"></script>
|
||||||
|
|
Loading…
Reference in New Issue