aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/edit
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-04-19 14:17:11 +0500
committerAbyss777 <abyss@fox5.ru>2017-04-19 14:17:11 +0500
commit3810a8be84b010f6c26f7541be22ecd6a973af58 (patch)
treea266c3fad333c50d0c1361ccc358fd685625ea01 /web/app/view/edit
parent648d5fe1e4a0d92b79410572d386dac45b4e8d36 (diff)
downloadtrackermap-web-3810a8be84b010f6c26f7541be22ecd6a973af58.tar.gz
trackermap-web-3810a8be84b010f6c26f7541be22ecd6a973af58.tar.bz2
trackermap-web-3810a8be84b010f6c26f7541be22ecd6a973af58.zip
Convert speed and distance for known attributes
Diffstat (limited to 'web/app/view/edit')
-rw-r--r--web/app/view/edit/Attributes.js24
1 files changed, 20 insertions, 4 deletions
diff --git a/web/app/view/edit/Attributes.js b/web/app/view/edit/Attributes.js
index 80083193..981d5399 100644
--- a/web/app/view/edit/Attributes.js
+++ b/web/app/view/edit/Attributes.js
@@ -43,15 +43,31 @@ Ext.define('Traccar.view.edit.Attributes', {
text: Strings.sharedName,
dataIndex: 'name',
renderer: function (value, metaData) {
- var result;
+ var attribute;
if (this.attributesStore) {
- result = Ext.getStore(this.attributesStore).getById(value);
+ attribute = Ext.getStore(this.attributesStore).getById(value);
}
- return result && result.get('name') ? result.get('name') : value;
+ return attribute && attribute.get('name') ? attribute.get('name') : value;
}
}, {
text: Strings.stateValue,
- dataIndex: 'value'
+ dataIndex: 'value',
+ renderer: function (value, metaData, record) {
+ var attribute;
+ if (this.attributesStore) {
+ attribute = Ext.getStore(this.attributesStore).getById(record.get('name'));
+ }
+ if (attribute && attribute.get('convert') === 'speed') {
+ return Ext.getStore('SpeedUnits').formatValue(value, Traccar.app.getPreference('speedUnit', 'kn'));
+ } else if (attribute && attribute.get('convert') === 'distance') {
+ return Ext.getStore('DistanceUnits').formatValue(value, Traccar.app.getPreference('distanceUnit', 'km'));
+ } else if (attribute && attribute.get('type') === 'color') {
+ metaData.tdStyle = 'background-color:' + value;
+ return value;
+ } else {
+ return value;
+ }
+ }
}]
}
});