aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/dialog/DeviceDistanceController.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/view/dialog/DeviceDistanceController.js')
-rw-r--r--web/app/view/dialog/DeviceDistanceController.js22
1 files changed, 6 insertions, 16 deletions
diff --git a/web/app/view/dialog/DeviceDistanceController.js b/web/app/view/dialog/DeviceDistanceController.js
index bd9e059d..ae14f33c 100644
--- a/web/app/view/dialog/DeviceDistanceController.js
+++ b/web/app/view/dialog/DeviceDistanceController.js
@@ -20,21 +20,11 @@ Ext.define('Traccar.view.dialog.DeviceDistanceController', {
extend: 'Ext.app.ViewController',
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) {
- var data = {};
- data.deviceId = this.lookupReference('deviceId').getValue();
- data.totalDistance = this.lookupReference('totalDistance').getValue();
+ onSetClick: function () {
+ var data = {
+ deviceId: this.getView().deviceId,
+ totalDistance: this.lookupReference('totalDistance').getValue()
+ };
Ext.Ajax.request({
scope: this,
method: 'PUT',
@@ -46,6 +36,6 @@ Ext.define('Traccar.view.dialog.DeviceDistanceController', {
}
}
});
- button.up('window').close();
+ this.closeView();
}
});