diff options
-rw-r--r-- | web/app/view/State.js | 10 | ||||
-rw-r--r-- | web/app/view/StateController.js | 22 |
2 files changed, 31 insertions, 1 deletions
diff --git a/web/app/view/State.js b/web/app/view/State.js index 82149713..d161251c 100644 --- a/web/app/view/State.js +++ b/web/app/view/State.js @@ -35,6 +35,16 @@ Ext.define('Traccar.view.State', { xtype: 'tbtext', html: Strings.stateTitle, baseCls: 'x-panel-header-title-default' + }, { + xtype: 'tbfill' + }, { + xtype: 'button', + disabled: true, + handler: 'onComputedAttributesClick', + reference: 'computedAttributesButton', + glyph: 'xf0ae@FontAwesome', + tooltip: Strings.sharedComputedAttributes, + tooltipType: 'title' }] }, diff --git a/web/app/view/StateController.js b/web/app/view/StateController.js index 3bf76717..c6c1507d 100644 --- a/web/app/view/StateController.js +++ b/web/app/view/StateController.js @@ -22,7 +22,9 @@ Ext.define('Traccar.view.StateController', { requires: [ 'Traccar.AttributeFormatter', 'Traccar.model.Attribute', - 'Traccar.model.Position' + 'Traccar.model.Position', + 'Traccar.view.BaseWindow', + 'Traccar.view.edit.ComputedAttributes' ], config: { @@ -46,6 +48,24 @@ Ext.define('Traccar.view.StateController', { } }, + + init: function () { + if (Traccar.app.getUser().get('admin') || + !Traccar.app.getUser().get('deviceReadonly') && !Traccar.app.getPreference('readonly', false)) { + this.lookupReference('computedAttributesButton').setDisabled( + Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes')); + } + }, + + onComputedAttributesClick: function () { + Ext.create('Traccar.view.BaseWindow', { + title: Strings.sharedComputedAttributes, + items: { + xtype: 'computedAttributesView' + } + }).show(); + }, + keys: (function () { var i, list, result; result = {}; |