aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/state/StateController.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-08-18 13:48:54 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-08-18 13:48:54 +1200
commitc06de84d316e7c67f6d22e12f855e2df34bbc3fb (patch)
treef7ab337c360bf50a79855787e9fa80e45ebd808c /web/app/view/state/StateController.js
parentafaede42a0cc8170128219bd1dfa6277e4e1809a (diff)
parent3ad3edfadba59e94d95e967e9d5cd28ae671cae4 (diff)
downloadtrackermap-server-c06de84d316e7c67f6d22e12f855e2df34bbc3fb.tar.gz
trackermap-server-c06de84d316e7c67f6d22e12f855e2df34bbc3fb.tar.bz2
trackermap-server-c06de84d316e7c67f6d22e12f855e2df34bbc3fb.zip
Merge branch odometer
Diffstat (limited to 'web/app/view/state/StateController.js')
-rw-r--r--web/app/view/state/StateController.js17
1 files changed, 14 insertions, 3 deletions
diff --git a/web/app/view/state/StateController.js b/web/app/view/state/StateController.js
index 58b63120b..58bc5c55c 100644
--- a/web/app/view/state/StateController.js
+++ b/web/app/view/state/StateController.js
@@ -76,17 +76,20 @@ Ext.define('Traccar.view.state.StateController', {
updatePosition: function(position) {
var other;
+ var value;
+ var unit;
var store = Ext.getStore('Parameters');
store.removeAll();
for (var key in position.data) {
if (position.data.hasOwnProperty(key) && this.keys[key] !== undefined) {
- var value = position.get(key);
+ value = position.get(key);
if (key === 'speed') {
var speedUnits = Ext.getStore('SpeedUnits');
- var unit = Traccar.getApplication().getUser().get('speedUnit') || Traccar.getApplication().getServer().get('speedUnit') || '';
+ unit = Traccar.getApplication().getUser().get('speedUnit') || Traccar.getApplication().getServer().get('speedUnit') || '';
value = speedUnits.convert(value, unit) + ' ' + speedUnits.getUnitName(unit);
}
+
store.add(Ext.create('Traccar.model.Parameter', {
priority: this.keys[key].priority,
name: this.keys[key].name,
@@ -103,12 +106,20 @@ Ext.define('Traccar.view.state.StateController', {
}
for (var key in other) {
if (other.hasOwnProperty(key)) {
+
+ value = other[key];
+ if (key === 'distance' || key === 'odometer') {
+ var distanceUnits = Ext.getStore('DistanceUnits');
+ unit = Traccar.getApplication().getUser().get('distanceUnit') || Traccar.getApplication().getServer().get('distanceUnit') || '';
+ value = distanceUnits.convert(value, unit) + ' ' + distanceUnits.getUnitName(unit);
+ }
+
store.add(Ext.create('Traccar.model.Parameter', {
priority: 999,
name: key.replace(/^./, function (match) {
return match.toUpperCase();
}),
- value: other[key]
+ value: value
}));
}
}