aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-09-21 11:37:35 +0500
committerAbyss777 <abyss@fox5.ru>2017-09-21 11:37:35 +0500
commit364ae5f1862d9d416fc27f9fc56b04c23778d612 (patch)
tree7af1d7906dfddfd51897819b7649a617d8216170
parentee56eda11f169a8a9157098827b57a79dc7c841a (diff)
downloadetbsa-traccar-web-364ae5f1862d9d416fc27f9fc56b04c23778d612.tar.gz
etbsa-traccar-web-364ae5f1862d9d416fc27f9fc56b04c23778d612.tar.bz2
etbsa-traccar-web-364ae5f1862d9d416fc27f9fc56b04c23778d612.zip
Implement UI setting to hide listed Position Attributes
-rw-r--r--web/app/store/CommonUserAttributes.js4
-rw-r--r--web/app/view/StateController.js11
-rw-r--r--web/l10n/en.json1
3 files changed, 15 insertions, 1 deletions
diff --git a/web/app/store/CommonUserAttributes.js b/web/app/store/CommonUserAttributes.js
index 1ba223f..d6b0b10 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.hiddenPositionAttributes',
+ name: Strings.attributeUiHiddenPositionAttributes,
+ 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..0ce8b1f 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, hiddenAttributesPreference, 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'));
}
+ hiddenAttributesPreference = Traccar.app.getAttributePreference('ui.hiddenPositionAttributes');
+ this.hiddenAttributes = {};
+ if (hiddenAttributesPreference) {
+ attributesList = hiddenAttributesPreference.split(/[ ,]+/).filter(Boolean);
+ for (i = 0; i < attributesList.length; i++) {
+ this.hiddenAttributes[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.hiddenAttributes[key]) {
this.lookupAttribute = key;
name = Ext.getStore('PositionAttributes').getAttributeName(key, true);
if (this.position.get('attribute.' + key) !== undefined) {
diff --git a/web/l10n/en.json b/web/l10n/en.json
index 77b7d03..15d97ff 100644
--- a/web/l10n/en.json
+++ b/web/l10n/en.json
@@ -99,6 +99,7 @@
"attributeUiDisableDrivers": "UI: Disable Drivers",
"attributeUiDisableComputedAttributes": "UI: Disable Computed Attributes",
"attributeUiDisableCalendars": "UI: Disable Calendars",
+ "attributeUiHiddenPositionAttributes": "UI: Hidden Position Attributes",
"errorTitle": "Error",
"errorGeneral": "Invalid parameters or constraints violation",
"errorConnection": "Connection error",