aboutsummaryrefslogtreecommitdiff
path: root/web/app
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-05-04 09:20:02 +0500
committerAbyss777 <abyss@fox5.ru>2017-05-04 09:20:02 +0500
commit26289d388106eed3b75cb1bfd84b0c23f0523a83 (patch)
tree33249e27b2b27c69af059e0e2354a1ebe9b99d81 /web/app
parent454541646fa1675e9cf3695fceb5e72c5f5a4fe6 (diff)
downloadtrackermap-web-26289d388106eed3b75cb1bfd84b0c23f0523a83.tar.gz
trackermap-web-26289d388106eed3b75cb1bfd84b0c23f0523a83.tar.bz2
trackermap-web-26289d388106eed3b75cb1bfd84b0c23f0523a83.zip
Use user units in TotalDistance dialog
Diffstat (limited to 'web/app')
-rw-r--r--web/app/Application.js6
-rw-r--r--web/app/view/dialog/DeviceDistance.js6
-rw-r--r--web/app/view/dialog/DeviceDistanceController.js7
3 files changed, 13 insertions, 6 deletions
diff --git a/web/app/Application.js b/web/app/Application.js
index d7a5bae8..b9d074e4 100644
--- a/web/app/Application.js
+++ b/web/app/Application.js
@@ -164,9 +164,9 @@ Ext.define('Traccar.Application', {
if (Ext.isString(error)) {
Ext.Msg.alert(Strings.errorTitle, error);
} else if (error.responseText) {
- Ext.Msg.alert(Strings.errorTitle, Strings.errorGeneral
- + '<br><br><textarea readonly rows="5" style="resize: none; width: 100%;">'
- + error.responseText + '</textarea>');
+ Ext.Msg.alert(Strings.errorTitle, Strings.errorGeneral +
+ '<br><br><textarea readonly rows="5" style="resize: none; width: 100%;">' +
+ error.responseText + '</textarea>');
} else if (error.statusText) {
Ext.Msg.alert(Strings.errorTitle, error.statusText);
} else {
diff --git a/web/app/view/dialog/DeviceDistance.js b/web/app/view/dialog/DeviceDistance.js
index 14a795ad..f908e45e 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 fd106a8d..bd9e059d 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) {