aboutsummaryrefslogtreecommitdiff
path: root/web/app/controller
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-11-17 15:52:39 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-11-17 15:52:39 +1300
commitb247a05d4cc34cf587fc0b4299692d401124055a (patch)
tree2865e78e19fae20f4961898c4ad54038d24457e0 /web/app/controller
parent5e56a1fbf80033cf5cc30ec7767d3cd92ab41cde (diff)
downloadtrackermap-server-b247a05d4cc34cf587fc0b4299692d401124055a.tar.gz
trackermap-server-b247a05d4cc34cf587fc0b4299692d401124055a.tar.bz2
trackermap-server-b247a05d4cc34cf587fc0b4299692d401124055a.zip
Show last update in the status table
Diffstat (limited to 'web/app/controller')
-rw-r--r--web/app/controller/Root.js21
1 files changed, 17 insertions, 4 deletions
diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js
index 041e0b902..733055cdf 100644
--- a/web/app/controller/Root.js
+++ b/web/app/controller/Root.js
@@ -97,19 +97,32 @@ Ext.define('Traccar.controller.Root', {
first: first
},
callback: Traccar.app.getErrorHandler(this, function (options, success, response) {
- var i, store, data, devices, positions, position;
+ var i, deviceStore, positionStore, data, devices, positions, device, position;
if (success) {
- store = Ext.getStore('LatestPositions');
+ deviceStore = Ext.getStore('Devices');
+ positionStore = Ext.getStore('LatestPositions');
data = Ext.decode(response.responseText).data;
devices = data.devices;
positions = data.positions;
+ for (i = 0; i < devices.length; i++) {
+ device = deviceStore.findRecord('id', devices[i].id, 0, false, false, true);
+ if (device) {
+ device.set({
+ status: devices[i].status,
+ lastUpdate: devices[i].lastUpdate
+ }, {
+ dirty: false
+ });
+ }
+ }
+
for (i = 0; i < positions.length; i++) {
- position = store.findRecord('deviceId', positions[i].deviceId, 0, false, false, true);
+ position = positionStore.findRecord('deviceId', positions[i].deviceId, 0, false, false, true);
if (position) {
position.set(positions[i]);
} else {
- store.add(Ext.create('Traccar.model.Position', positions[i]));
+ positionStore.add(Ext.create('Traccar.model.Position', positions[i]));
}
}