aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-08-09 16:04:20 +0500
committerAbyss777 <abyss@fox5.ru>2017-08-09 16:04:20 +0500
commitfd4029af507afac83fa5db4b863b26ac2e205bd3 (patch)
treeec17e8d1c251817f06b3d2ee043fe2f288c52089 /web
parentc7888fcf5e92280ed4573ee0973872a59451ac52 (diff)
downloadetbsa-traccar-web-fd4029af507afac83fa5db4b863b26ac2e205bd3.tar.gz
etbsa-traccar-web-fd4029af507afac83fa5db4b863b26ac2e205bd3.tar.bz2
etbsa-traccar-web-fd4029af507afac83fa5db4b863b26ac2e205bd3.zip
Select device on load if there is deviceId url parameter
Diffstat (limited to 'web')
-rw-r--r--web/app/controller/Root.js14
-rw-r--r--web/app/view/edit/DevicesController.js3
-rw-r--r--web/load.js2
3 files changed, 16 insertions, 3 deletions
diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js
index d85102a..902ef21 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('Devices').getById(deviceId);
+ 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 9de298c..ae65fbb 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 86b9829..1845cd1 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');
}
}