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/DeviceMenuController.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'web/app/view/DeviceMenuController.js') diff --git a/web/app/view/DeviceMenuController.js b/web/app/view/DeviceMenuController.js index 4fa00bee..9e5ef14a 100644 --- a/web/app/view/DeviceMenuController.js +++ b/web/app/view/DeviceMenuController.js @@ -35,6 +35,8 @@ Ext.define('Traccar.view.DeviceMenuController', { this.lookupReference('menuComputedAttributesButton').setHidden( Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes')); this.lookupReference('menuCommandsButton').setHidden(Traccar.app.getPreference('limitCommands', false)); + this.lookupReference('menuDeviceDistanceButton').setHidden( + !Traccar.app.getUser().get('admin') || Traccar.app.getVehicleFeaturesDisabled()); }, onGeofencesClick: function () { @@ -100,5 +102,15 @@ Ext.define('Traccar.view.DeviceMenuController', { baseObject: this.getView().up('deviceMenu').device.getId() } }).show(); + }, + + onDeviceDistanceClick: function () { + var position, dialog = Ext.create('Traccar.view.dialog.DeviceDistance'); + dialog.deviceId = this.getView().up('deviceMenu').device.getId(); + position = Ext.getStore('LatestPositions').findRecord('deviceId', dialog.deviceId, 0, false, false, true); + if (position) { + dialog.lookupReference('totalDistance').setValue(position.get('attributes').totalDistance); + } + dialog.show(); } }); -- cgit v1.2.3