aboutsummaryrefslogtreecommitdiff
path: root/web/app/AttributeFormatter.js
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-06-07 09:05:18 +0500
committerAbyss777 <abyss@fox5.ru>2017-06-07 09:05:18 +0500
commite0030185daa54eda46157cd35b989d1a63c79656 (patch)
treef2a0f94172721af1f7e01153300879bcdc39fb04 /web/app/AttributeFormatter.js
parent4f61e2a9fd0f9632e05d5bac0648c2548b9cef39 (diff)
downloadtrackermap-web-e0030185daa54eda46157cd35b989d1a63c79656.tar.gz
trackermap-web-e0030185daa54eda46157cd35b989d1a63c79656.tar.bz2
trackermap-web-e0030185daa54eda46157cd35b989d1a63c79656.zip
- Move addAttributeColumns functional to init
- Remove empty convert functions - Add check for undefined in some formatters
Diffstat (limited to 'web/app/AttributeFormatter.js')
-rw-r--r--web/app/AttributeFormatter.js51
1 files changed, 15 insertions, 36 deletions
diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js
index 9d66794d..423492dd 100644
--- a/web/app/AttributeFormatter.js
+++ b/web/app/AttributeFormatter.js
@@ -44,44 +44,33 @@ Ext.define('Traccar.AttributeFormatter', {
},
voltageFormatter: function (value) {
- return Number(value.toFixed(Traccar.Style.numberPrecision)) + ' ' + Strings.sharedVoltAbbreviation;
- },
-
- voltageConverter: function (value) {
- return Number(value);
+ if (value !== undefined) {
+ return Number(value.toFixed(Traccar.Style.numberPrecision)) + ' ' + Strings.sharedVoltAbbreviation;
+ }
},
percentageFormatter: function (value) {
- return Number(value.toFixed(Traccar.Style.numberPrecision)) + ' &#37;';
- },
-
- percentageConverter: function (value) {
- return Number(value);
+ if (value !== undefined) {
+ return Number(value.toFixed(Traccar.Style.numberPrecision)) + ' &#37;';
+ }
},
temperatureFormatter: function (value) {
- return Number(value.toFixed(Traccar.Style.numberPrecision)) + ' &deg;C';
- },
-
- temperatureConverter: function (value) {
- return Number(value);
+ if (value !== undefined) {
+ return Number(value.toFixed(Traccar.Style.numberPrecision)) + ' &deg;C';
+ }
},
-
volumeFormatter: function (value) {
- return Number(value.toFixed(Traccar.Style.numberPrecision)) + ' ' + Strings.sharedLiterAbbreviation;
- },
-
- volumeConverter: function (value) {
- return Number(value);
+ if (value !== undefined) {
+ return Number(value.toFixed(Traccar.Style.numberPrecision)) + ' ' + Strings.sharedLiterAbbreviation;
+ }
},
consumptionFormatter: function (value) {
- return Number(value.toFixed(Traccar.Style.numberPrecision)) + ' ' + Strings.sharedLiterPerHourAbbreviation;
- },
-
- consumptionConverter: function (value) {
- return Number(value);
+ if (value !== undefined) {
+ return Number(value.toFixed(Traccar.Style.numberPrecision)) + ' ' + Strings.sharedLiterPerHourAbbreviation;
+ }
},
hoursFormatter: function (value) {
@@ -208,16 +197,6 @@ Ext.define('Traccar.AttributeFormatter', {
return this.distanceConverter;
} else if (dataType === 'speed') {
return this.speedConverter;
- } else if (dataType === 'voltage') {
- return this.voltageConverter;
- } else if (dataType === 'percentage') {
- return this.percentageConverter;
- } else if (dataType === 'temperature') {
- return this.temperatureConverter;
- } else if (dataType === 'volume') {
- return this.volumeConverter;
- } else if (dataType === 'consumption') {
- return this.consumptionConverter;
} else {
return function (value) {
return value;