aboutsummaryrefslogtreecommitdiff
path: root/web/app
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-09-22 00:30:34 +1200
committerGitHub <noreply@github.com>2017-09-22 00:30:34 +1200
commit9f7a04a6bf64554e3d2adccac9698801a0f47296 (patch)
treee0195d332db2f4d95b9d56d85774ec7930e22f62 /web/app
parentee56eda11f169a8a9157098827b57a79dc7c841a (diff)
parentcd3441751d939c06390a850f3457b67abab365a9 (diff)
downloadetbsa-traccar-web-9f7a04a6bf64554e3d2adccac9698801a0f47296.tar.gz
etbsa-traccar-web-9f7a04a6bf64554e3d2adccac9698801a0f47296.tar.bz2
etbsa-traccar-web-9f7a04a6bf64554e3d2adccac9698801a0f47296.zip
Merge pull request #590 from Abyss777/hide_attributes
Implement UI setting to hide listed Position Attributes
Diffstat (limited to 'web/app')
-rw-r--r--web/app/store/CommonUserAttributes.js4
-rw-r--r--web/app/view/StateController.js11
2 files changed, 14 insertions, 1 deletions
diff --git a/web/app/store/CommonUserAttributes.js b/web/app/store/CommonUserAttributes.js
index 1ba223f..eadb1c5 100644
--- a/web/app/store/CommonUserAttributes.js
+++ b/web/app/store/CommonUserAttributes.js
@@ -59,6 +59,10 @@ Ext.define('Traccar.store.CommonUserAttributes', {
name: Strings.attributeUiDisableCalendars,
valueType: 'boolean'
}, {
+ key: 'ui.hidePositionAttributes',
+ name: Strings.attributeUiHidePositionAttributes,
+ valueType: 'string'
+ }, {
key: 'distanceUnit',
name: Strings.settingsDistanceUnit,
valueType: 'string',
diff --git a/web/app/view/StateController.js b/web/app/view/StateController.js
index c6c1507..70f0228 100644
--- a/web/app/view/StateController.js
+++ b/web/app/view/StateController.js
@@ -50,11 +50,20 @@ Ext.define('Traccar.view.StateController', {
init: function () {
+ var i, hideAttributesPreference, attributesList;
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'));
}
+ hideAttributesPreference = Traccar.app.getAttributePreference('ui.hidePositionAttributes');
+ this.hideAttributes = {};
+ if (hideAttributesPreference) {
+ attributesList = hideAttributesPreference.split(/[ ,]+/).filter(Boolean);
+ for (i = 0; i < attributesList.length; i++) {
+ this.hideAttributes[attributesList[i]] = true;
+ }
+ }
},
onComputedAttributesClick: function () {
@@ -124,7 +133,7 @@ Ext.define('Traccar.view.StateController', {
attributes = this.position.get('attributes');
if (attributes instanceof Object) {
for (key in attributes) {
- if (attributes.hasOwnProperty(key)) {
+ if (attributes.hasOwnProperty(key) && !this.hideAttributes[key]) {
this.lookupAttribute = key;
name = Ext.getStore('PositionAttributes').getAttributeName(key, true);
if (this.position.get('attribute.' + key) !== undefined) {