aboutsummaryrefslogtreecommitdiff
path: root/web/app
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-05-19 09:25:53 +0500
committerAbyss777 <abyss@fox5.ru>2017-05-19 09:25:53 +0500
commit3cd2d2e792d558886e404913780116d99a443d74 (patch)
tree9aec911b9af73dfdcd2db6e8514887a34aaa5eec /web/app
parent788a499b346724d753798597fb18f8aef17e1588 (diff)
downloadetbsa-traccar-web-3cd2d2e792d558886e404913780116d99a443d74.tar.gz
etbsa-traccar-web-3cd2d2e792d558886e404913780116d99a443d74.tar.bz2
etbsa-traccar-web-3cd2d2e792d558886e404913780116d99a443d74.zip
Position attribute name rendering optimization
Diffstat (limited to 'web/app')
-rw-r--r--web/app/store/PositionAttributes.js12
-rw-r--r--web/app/view/StateController.js2
-rw-r--r--web/app/view/dialog/DeviceDistance.js2
-rw-r--r--web/app/view/edit/ComputedAttributes.js7
-rw-r--r--web/app/view/permissions/DeviceAttributes.js7
-rw-r--r--web/app/view/permissions/GroupAttributes.js7
-rw-r--r--web/app/view/permissions/UserAttributes.js7
7 files changed, 14 insertions, 30 deletions
diff --git a/web/app/store/PositionAttributes.js b/web/app/store/PositionAttributes.js
index 6d6c0b7..ec1cbf8 100644
--- a/web/app/store/PositionAttributes.js
+++ b/web/app/store/PositionAttributes.js
@@ -236,14 +236,18 @@ Ext.define('Traccar.store.PositionAttributes', {
valueType: 'string'
}],
- getAttributeName: function (key) {
+ getAttributeName: function (key, capitalize) {
var model = this.getById(key);
if (model) {
return model.get('name');
} else {
- return key.replace(/^./, function (match) {
- return match.toUpperCase();
- });
+ if (capitalize) {
+ return key.replace(/^./, function (match) {
+ return match.toUpperCase();
+ });
+ } else {
+ return key;
+ }
}
},
diff --git a/web/app/view/StateController.js b/web/app/view/StateController.js
index 1525db2..0723dc1 100644
--- a/web/app/view/StateController.js
+++ b/web/app/view/StateController.js
@@ -124,7 +124,7 @@ Ext.define('Traccar.view.StateController', {
if (aliasIndex !== -1) {
name = this.aliasesStore.getAt(aliasIndex).get('alias');
} else {
- name = Ext.getStore('PositionAttributes').getAttributeName(key);
+ name = Ext.getStore('PositionAttributes').getAttributeName(key, true);
}
store.add(Ext.create('Traccar.model.Attribute', {
priority: 1024,
diff --git a/web/app/view/dialog/DeviceDistance.js b/web/app/view/dialog/DeviceDistance.js
index f908e45..c6ac9f2 100644
--- a/web/app/view/dialog/DeviceDistance.js
+++ b/web/app/view/dialog/DeviceDistance.js
@@ -39,7 +39,7 @@ Ext.define('Traccar.view.dialog.DeviceDistance', {
}
}, {
xtype: 'customNumberField',
- convert: 'distance',
+ dataType: 'distance',
reference: 'totalDistance',
fieldLabel: Strings.deviceTotalDistance
}],
diff --git a/web/app/view/edit/ComputedAttributes.js b/web/app/view/edit/ComputedAttributes.js
index 741a104..b4699e8 100644
--- a/web/app/view/edit/ComputedAttributes.js
+++ b/web/app/view/edit/ComputedAttributes.js
@@ -48,12 +48,7 @@ Ext.define('Traccar.view.edit.ComputedAttributes', {
text: Strings.sharedAttribute,
dataIndex: 'attribute',
renderer: function (value) {
- var attribute = Ext.getStore('PositionAttributes').getById(value);
- if (attribute) {
- return attribute.get('name');
- } else {
- return value;
- }
+ return Ext.getStore('PositionAttributes').getAttributeName(value);
}
}, {
text: Strings.sharedExpression,
diff --git a/web/app/view/permissions/DeviceAttributes.js b/web/app/view/permissions/DeviceAttributes.js
index baca9d3..2ce0763 100644
--- a/web/app/view/permissions/DeviceAttributes.js
+++ b/web/app/view/permissions/DeviceAttributes.js
@@ -32,12 +32,7 @@ Ext.define('Traccar.view.permissions.DeviceAttributes', {
flex: 1,
minWidth: Traccar.Style.columnWidthNormal,
renderer: function (value) {
- var attribute = Ext.getStore('PositionAttributes').getById(value);
- if (attribute) {
- return attribute.get('name');
- } else {
- return value;
- }
+ return Ext.getStore('PositionAttributes').getAttributeName(value);
}
}]
}
diff --git a/web/app/view/permissions/GroupAttributes.js b/web/app/view/permissions/GroupAttributes.js
index 3972dbe..44089da 100644
--- a/web/app/view/permissions/GroupAttributes.js
+++ b/web/app/view/permissions/GroupAttributes.js
@@ -32,12 +32,7 @@ Ext.define('Traccar.view.permissions.GroupAttributes', {
flex: 1,
minWidth: Traccar.Style.columnWidthNormal,
renderer: function (value) {
- var attribute = Ext.getStore('PositionAttributes').getById(value);
- if (attribute) {
- return attribute.get('name');
- } else {
- return value;
- }
+ return Ext.getStore('PositionAttributes').getAttributeName(value);
}
}]
}
diff --git a/web/app/view/permissions/UserAttributes.js b/web/app/view/permissions/UserAttributes.js
index 8a8a454..7bca622 100644
--- a/web/app/view/permissions/UserAttributes.js
+++ b/web/app/view/permissions/UserAttributes.js
@@ -32,12 +32,7 @@ Ext.define('Traccar.view.permissions.UserAttributes', {
flex: 1,
minWidth: Traccar.Style.columnWidthNormal,
renderer: function (value) {
- var attribute = Ext.getStore('PositionAttributes').getById(value);
- if (attribute) {
- return attribute.get('name');
- } else {
- return value;
- }
+ return Ext.getStore('PositionAttributes').getAttributeName(value);
}
}]
}