aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-11-16 12:24:24 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-11-16 12:24:24 +1300
commit28d60da9a2f80fa8fc3dd28ec5bdd7847a36727c (patch)
tree22ae7f454d71e1e37ce5acdedbd8373b930dbfe7 /web
parentaeaa108befa6b9851db0cb9473a808f6ce9695ae (diff)
downloadtraccar-server-28d60da9a2f80fa8fc3dd28ec5bdd7847a36727c.tar.gz
traccar-server-28d60da9a2f80fa8fc3dd28ec5bdd7847a36727c.tar.bz2
traccar-server-28d60da9a2f80fa8fc3dd28ec5bdd7847a36727c.zip
Extend async request to include devices
Diffstat (limited to 'web')
-rw-r--r--web/app/controller/Root.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js
index 79827b8a6..b260cb8a1 100644
--- a/web/app/controller/Root.js
+++ b/web/app/controller/Root.js
@@ -96,19 +96,22 @@ Ext.define('Traccar.controller.Root', {
first: first
},
callback: Traccar.app.getErrorHandler(this, function (options, success, response) {
- var i, store, data, position;
+ var i, store, data, devices, positions, position;
if (success) {
store = Ext.getStore('LatestPositions');
data = Ext.decode(response.responseText).data;
+ devices = data.devices;
+ positions = data.positions;
- for (i = 0; i < data.length; i++) {
- position = store.findRecord('deviceId', data[i].deviceId, 0, false, false, true);
+ for (i = 0; i < positions.length; i++) {
+ position = store.findRecord('deviceId', positions[i].deviceId, 0, false, false, true);
if (position) {
- position.set(data[i]);
+ position.set(positions[i]);
} else {
- store.add(Ext.create('Traccar.model.Position', data[i]));
+ store.add(Ext.create('Traccar.model.Position', positions[i]));
}
}
+
this.asyncUpdate(false);
}
})