diff --git a/bower.json b/bower.json index 276fbb0..e1cfd23 100644 --- a/bower.json +++ b/bower.json @@ -25,6 +25,7 @@ "ui-leaflet": "^1.0.1", "angular-cookies": "^1.5.7", "Leaflet.label": "^0.2.1", - "lodash": "^4.13.1" + "lodash": "^4.13.1", + "angularLocalStorage": "^0.3.2" } } diff --git a/public/app/app.js b/public/app/app.js index d345e78..4a6b0d7 100644 --- a/public/app/app.js +++ b/public/app/app.js @@ -3,7 +3,7 @@ angular.module('ffhb', [ 'ngTable', 'ngResource', - 'ngCookies', + 'angularLocalStorage', 'ui.router', 'ui.bootstrap', 'ui-leaflet', diff --git a/public/app/node.js b/public/app/node.js index e76beb8..0596827 100644 --- a/public/app/node.js +++ b/public/app/node.js @@ -2,7 +2,7 @@ angular.module('ffhb') .controller('NodeCtrl',function($stateParams,$scope,store,config,leafletData){ - $scope.nodeid = $stateParams.nodeid; + $scope.nodeid = $stateParams.nodeid.toLowerCase(); $scope.loadingGPS = false; $scope.node = {}; angular.extend($scope, { @@ -14,7 +14,7 @@ angular.module('ffhb') title: 'Marker', draggable: true, label: { - message: 'Node:'+$stateParams.nodeid, + message: 'Node:'+$scope.nodeid, options: { noHide: true } @@ -29,7 +29,7 @@ angular.module('ffhb') }); function render(prom){ prom.then(function(data){ - $scope.node = data.merged[$stateParams.nodeid]; + $scope.node = data.merged[$scope.nodeid]; if($scope.node !== undefined && $scope.node.nodeinfo !== undefined){ $scope.markers.node.lat = $scope.node.nodeinfo.location.latitude; $scope.markers.node.lng = $scope.node.nodeinfo.location.longitude; @@ -47,7 +47,7 @@ angular.module('ffhb') 'latitude': args.model.lat, 'longitude': args.model.lng }; - store.saveNode($stateParams.nodeid); + store.saveNode($scope.nodeid); } }); var setToGps = function(position){ @@ -61,7 +61,7 @@ angular.module('ffhb') leafletData.getMap().then(function(map) { map.setView(pos); }); - store.saveNode($stateParams.nodeid); + store.saveNode($scope.nodeid); $scope.markers.node.lat = position.coords.latitude; $scope.markers.node.lng = position.coords.longitude; } diff --git a/public/app/nodes/nodesGroup.jade b/public/app/nodes/nodesGroup.jade index 7650ab2..3b5326c 100644 --- a/public/app/nodes/nodesGroup.jade +++ b/public/app/nodes/nodesGroup.jade @@ -34,7 +34,7 @@ table.table.table-striped.table-condensed( ng-table="tableParams") span(ng-switch-default) {{row.nodeinfo.wireless.txpower24}} 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) - 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' : ''") input.editable-input.form-control.input-sm(type="text" name="txpower5",ng-model='row.nodeinfo.wireless.txpower5',required) td(data-title="'Options'") diff --git a/public/app/nodes/nodesGroup.js b/public/app/nodes/nodesGroup.js index c719af7..fdb7547 100644 --- a/public/app/nodes/nodesGroup.js +++ b/public/app/nodes/nodesGroup.js @@ -8,7 +8,7 @@ angular.module('ffhb') total: 0, count: 100 }, { - dataset: [] + dataset: [{}] }); var originalData = {}; $scope.cancel = function(row, rowForm) { diff --git a/public/app/nodes/nodesSort.js b/public/app/nodes/nodesSort.js index 3d738f0..14dcf88 100644 --- a/public/app/nodes/nodesSort.js +++ b/public/app/nodes/nodesSort.js @@ -7,7 +7,52 @@ angular.module('ffhb') total: 0, 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 = {}; function find(nodeid){ diff --git a/public/components/store.js b/public/components/store.js index ee3a839..2f4bbbf 100644 --- a/public/components/store.js +++ b/public/components/store.js @@ -1,6 +1,6 @@ 'use strict'; 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){ webNotification.showNotification('New Node',{ body: '"'+nodeid+'"', @@ -22,7 +22,7 @@ angular.module('ffhb') var myservice = {}; myservice._initialized = false; - myservice._data = $cookieStore.get('data') ||{ + myservice._data = storage.get('data') ||{ nodes: {},nodesCount:0, merged: {}, aliases: {},aliasesCount:0 @@ -96,7 +96,7 @@ angular.module('ffhb') if (myservice._initialized) { $rootScope.$broadcast('store', dataDeferred.promise); } - $cookieStore.put('data',myservice._data); + storage.set('data',myservice._data); myservice._initialized = true; }); }); diff --git a/public/index.html b/public/index.html index 44fc12e..88091b8 100644 --- a/public/index.html +++ b/public/index.html @@ -52,6 +52,7 @@ +