aboutsummaryrefslogtreecommitdiff
path: root/web/app/view
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-09-06 09:53:06 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-09-06 09:53:06 +1200
commitae9de5a7b9cf43ad488022675d243a4b7a863aa4 (patch)
treec2880267bca7fe494c294d5ae59e15a9ad0e5a2d /web/app/view
parent00e840b3dbc087a0b187f283d14f5169a626da93 (diff)
downloadetbsa-traccar-web-ae9de5a7b9cf43ad488022675d243a4b7a863aa4.tar.gz
etbsa-traccar-web-ae9de5a7b9cf43ad488022675d243a4b7a863aa4.tar.bz2
etbsa-traccar-web-ae9de5a7b9cf43ad488022675d243a4b7a863aa4.zip
Add attributes button to state toolbar
Diffstat (limited to 'web/app/view')
-rw-r--r--web/app/view/State.js10
-rw-r--r--web/app/view/StateController.js22
2 files changed, 31 insertions, 1 deletions
diff --git a/web/app/view/State.js b/web/app/view/State.js
index 8214971..d161251 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 3bf7671..c6c1507 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 = {};