aboutsummaryrefslogtreecommitdiff
path: root/web/app/view
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-06-21 17:35:25 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-06-21 17:35:25 +1200
commite36f444cac7abef61dd63a7104f17e6b8de1637c (patch)
tree801f93bca1e18d441a19d43bf1a427ab52c8bfde /web/app/view
parent4a4b947cbbff599100e937400384b913b9152909 (diff)
downloadtraccar-server-e36f444cac7abef61dd63a7104f17e6b8de1637c.tar.gz
traccar-server-e36f444cac7abef61dd63a7104f17e6b8de1637c.tar.bz2
traccar-server-e36f444cac7abef61dd63a7104f17e6b8de1637c.zip
Implement parameters ordering
Diffstat (limited to 'web/app/view')
-rw-r--r--web/app/view/map/MapController.js7
-rw-r--r--web/app/view/state/StateController.js55
2 files changed, 45 insertions, 17 deletions
diff --git a/web/app/view/map/MapController.js b/web/app/view/map/MapController.js
index cad8f502a..cbe3ea6c3 100644
--- a/web/app/view/map/MapController.js
+++ b/web/app/view/map/MapController.js
@@ -49,16 +49,11 @@ Ext.define('Traccar.view.map.MapController', {
var i;
for (i = 0; i < data.length; i++) {
- // TODO check if exists and update
var store = Ext.getStore('LiveData');
var found = store.query('deviceId', data[i].deviceId);
if (found.getCount() > 0) {
- var model = found.first();
- model.set(data[i]);
-
- //store.commitChanges(); need for update?
-
+ found.first().set(data[i]);
} else {
store.add(Ext.create('Traccar.model.Position', data[i]));
}
diff --git a/web/app/view/state/StateController.js b/web/app/view/state/StateController.js
index 15f0639ba..fc23bbe96 100644
--- a/web/app/view/state/StateController.js
+++ b/web/app/view/state/StateController.js
@@ -35,14 +35,38 @@ Ext.define('Traccar.view.state.StateController', {
},
keys: {
- 'fixTime': strings.report_time,
- 'latitude': strings.report_latitude,
- 'longitude': strings.report_longitude,
- 'valid': strings.report_valid,
- 'altitude': strings.report_altitude,
- 'speed': strings.report_speed,
- 'course': strings.report_course,
- 'protocol': strings.state_protocol
+ 'fixTime': {
+ priority: 1,
+ name: strings.report_time
+ },
+ 'latitude': {
+ priority: 2,
+ name: strings.report_latitude
+ },
+ 'longitude': {
+ priority: 3,
+ name: strings.report_longitude
+ },
+ 'valid': {
+ priority: 4,
+ name: strings.report_valid
+ },
+ 'altitude': {
+ priority: 5,
+ name: strings.report_altitude
+ },
+ 'speed': {
+ priority: 6,
+ name: strings.report_speed
+ },
+ 'course': {
+ priority: 7,
+ name: strings.report_course
+ },
+ 'protocol': {
+ priority: 8,
+ name: strings.state_protocol
+ }
},
updatePosition: function(position) {
@@ -53,11 +77,20 @@ Ext.define('Traccar.view.state.StateController', {
for (var key in position.data) {
if (position.data.hasOwnProperty(key) && this.keys[key] !== undefined) {
store.add(Ext.create('Traccar.model.Parameter', {
- name: this.keys[key],
+ priority: this.keys[key].priority,
+ name: this.keys[key].name,
value: position.get(key)
}));
}
}
+
+ // TODO: decode XML
+ var xml = position.get('other');
+ store.add(Ext.create('Traccar.model.Parameter', {
+ priority: 99,
+ name: 'Other',
+ value: xml
+ }));
},
selectDevice: function(device) {
@@ -75,8 +108,8 @@ Ext.define('Traccar.view.state.StateController', {
},
update: function(store, data) {
- if (this.deviceId === data[0].get('deviceId')) {
- this.updatePosition(data[0]);
+ if (this.deviceId === data.get('deviceId')) {
+ this.updatePosition(data);
}
}