diff options
author | Abyss777 <abyss@fox5.ru> | 2017-09-20 15:20:41 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2017-09-20 15:20:41 +0500 |
commit | c16972a1f574189b9b21fc237336440cdba10f0d (patch) | |
tree | 33158a0fca300aac5013e23a7fce89eb3998e8d4 /web/app/view/DeviceMenuController.js | |
parent | adf79e9bc86bc485ea3fa02c4d25b11d8fffee1f (diff) | |
download | trackermap-web-c16972a1f574189b9b21fc237336440cdba10f0d.tar.gz trackermap-web-c16972a1f574189b9b21fc237336440cdba10f0d.tar.bz2 trackermap-web-c16972a1f574189b9b21fc237336440cdba10f0d.zip |
Move Device Distance to Device Menu
Diffstat (limited to 'web/app/view/DeviceMenuController.js')
-rw-r--r-- | web/app/view/DeviceMenuController.js | 12 |
1 files changed, 12 insertions, 0 deletions
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(); } }); |