diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-05-04 19:03:30 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-04 19:03:30 +1200 |
commit | e200c1b9fe2f840d0d28836e19abaebb7c33210e (patch) | |
tree | 33249e27b2b27c69af059e0e2354a1ebe9b99d81 /web/app/view | |
parent | 454541646fa1675e9cf3695fceb5e72c5f5a4fe6 (diff) | |
parent | 26289d388106eed3b75cb1bfd84b0c23f0523a83 (diff) | |
download | etbsa-traccar-web-e200c1b9fe2f840d0d28836e19abaebb7c33210e.tar.gz etbsa-traccar-web-e200c1b9fe2f840d0d28836e19abaebb7c33210e.tar.bz2 etbsa-traccar-web-e200c1b9fe2f840d0d28836e19abaebb7c33210e.zip |
Merge pull request #480 from Abyss777/convert_total_distance
Use user units in TotalDistance dialog
Diffstat (limited to 'web/app/view')
-rw-r--r-- | web/app/view/dialog/DeviceDistance.js | 6 | ||||
-rw-r--r-- | web/app/view/dialog/DeviceDistanceController.js | 7 |
2 files changed, 10 insertions, 3 deletions
diff --git a/web/app/view/dialog/DeviceDistance.js b/web/app/view/dialog/DeviceDistance.js index 14a795a..f908e45 100644 --- a/web/app/view/dialog/DeviceDistance.js +++ b/web/app/view/dialog/DeviceDistance.js @@ -38,10 +38,10 @@ Ext.define('Traccar.view.dialog.DeviceDistance', { change: 'onDeviceChange' } }, { - xtype: 'numberfield', + xtype: 'customNumberField', + convert: 'distance', reference: 'totalDistance', - fieldLabel: Strings.deviceTotalDistance, - value: 0 + fieldLabel: Strings.deviceTotalDistance }], buttons: [{ diff --git a/web/app/view/dialog/DeviceDistanceController.js b/web/app/view/dialog/DeviceDistanceController.js index fd106a8..bd9e059 100644 --- a/web/app/view/dialog/DeviceDistanceController.js +++ b/web/app/view/dialog/DeviceDistanceController.js @@ -21,7 +21,14 @@ Ext.define('Traccar.view.dialog.DeviceDistanceController', { alias: 'controller.deviceDistance', onDeviceChange: function (combobox, newValue) { + var position; this.lookupReference('setButton').setDisabled(newValue === null); + if (newValue) { + position = Ext.getStore('LatestPositions').findRecord('deviceId', newValue, 0, false, false, true); + if (position) { + this.lookupReference('totalDistance').setValue(position.get('attributes').totalDistance); + } + } }, onSetClick: function (button) { |