From c16972a1f574189b9b21fc237336440cdba10f0d Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Wed, 20 Sep 2017 15:20:41 +0500 Subject: Move Device Distance to Device Menu --- web/app/view/dialog/DeviceDistanceController.js | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'web/app/view/dialog/DeviceDistanceController.js') 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(); } }); -- cgit v1.2.3