aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/DeviceMenuController.js
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-09-20 15:20:41 +0500
committerAbyss777 <abyss@fox5.ru>2017-09-20 15:20:41 +0500
commitc16972a1f574189b9b21fc237336440cdba10f0d (patch)
tree33158a0fca300aac5013e23a7fce89eb3998e8d4 /web/app/view/DeviceMenuController.js
parentadf79e9bc86bc485ea3fa02c4d25b11d8fffee1f (diff)
downloadtrackermap-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.js12
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();
}
});