diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-08-09 23:42:31 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-09 23:42:31 +1200 |
commit | 1873fc05dfa0532d1ca665bd3d32ce5cb1d8d040 (patch) | |
tree | 528d74d36e68e964a6238bc5aec9ab56e3620af7 /web | |
parent | c7888fcf5e92280ed4573ee0973872a59451ac52 (diff) | |
parent | 959797ec42f8ac770531c73101aa716c1a7b08fa (diff) | |
download | trackermap-web-1873fc05dfa0532d1ca665bd3d32ce5cb1d8d040.tar.gz trackermap-web-1873fc05dfa0532d1ca665bd3d32ce5cb1d8d040.tar.bz2 trackermap-web-1873fc05dfa0532d1ca665bd3d32ce5cb1d8d040.zip |
Merge pull request #543 from Abyss777/select_device_from_url
Select device from deviceId url parameter
Diffstat (limited to 'web')
-rw-r--r-- | web/app/controller/Root.js | 14 | ||||
-rw-r--r-- | web/app/view/edit/DevicesController.js | 3 | ||||
-rw-r--r-- | web/load.js | 2 |
3 files changed, 16 insertions, 3 deletions
diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js index d85102a7..baba68a1 100644 --- a/web/app/controller/Root.js +++ b/web/app/controller/Root.js @@ -17,6 +17,7 @@ Ext.define('Traccar.controller.Root', { extend: 'Ext.app.Controller', + alias: 'controller.root', requires: [ 'Traccar.view.dialog.Login', @@ -225,7 +226,7 @@ Ext.define('Traccar.controller.Root', { }, updatePositions: function (array, first) { - var i, store, entity; + var i, store, entity, deviceId, device; store = Ext.getStore('LatestPositions'); for (i = 0; i < array.length; i++) { entity = store.findRecord('deviceId', array[i].deviceId, 0, false, false, true); @@ -239,7 +240,16 @@ Ext.define('Traccar.controller.Root', { } } if (first) { - this.zoomToAllDevices(); + deviceId = Ext.Object.fromQueryString(window.location.search).deviceId; + if (deviceId) { + device = Ext.getStore('VisibleDevices').findRecord('id', deviceId, 0, false, true, true); + if (device) { + this.fireEvent('selectdevice', device, true); + } + } + if (!device) { + this.zoomToAllDevices(); + } } }, diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js index 9de298cf..ae65fbb1 100644 --- a/web/app/view/edit/DevicesController.js +++ b/web/app/view/edit/DevicesController.js @@ -36,6 +36,9 @@ Ext.define('Traccar.view.edit.DevicesController', { '*': { selectreport: 'selectReport' }, + 'root': { + selectdevice: 'selectDevice' + }, 'map': { selectdevice: 'selectDevice', deselectfeature: 'deselectFeature' diff --git a/web/load.js b/web/load.js index 86b98290..1845cd13 100644 --- a/web/load.js +++ b/web/load.js @@ -126,7 +126,7 @@ addScriptFile(debugMode ? 'app.js' : 'app.min.js'); } }); - } else { + } else { addScriptFile(debugMode ? 'app.js' : 'app.min.js'); } } |