aboutsummaryrefslogtreecommitdiff
path: root/web/app
diff options
context:
space:
mode:
Diffstat (limited to 'web/app')
-rw-r--r--web/app/AttributeFormatter.js51
-rw-r--r--web/app/view/ReportController.js26
2 files changed, 26 insertions, 51 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)) + ' %';
- },
-
- percentageConverter: function (value) {
- return Number(value);
+ if (value !== undefined) {
+ return Number(value.toFixed(Traccar.Style.numberPrecision)) + ' %';
+ }
},
temperatureFormatter: function (value) {
- return Number(value.toFixed(Traccar.Style.numberPrecision)) + ' °C';
- },
-
- temperatureConverter: function (value) {
- return Number(value);
+ if (value !== undefined) {
+ return Number(value.toFixed(Traccar.Style.numberPrecision)) + ' °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;
diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js
index 8631b7ca..3daa2957 100644
--- a/web/app/view/ReportController.js
+++ b/web/app/view/ReportController.js
@@ -65,7 +65,17 @@ Ext.define('Traccar.view.ReportController', {
},
init: function () {
- this.addAttributeColumns();
+ var i, data, attribute;
+ data = Ext.getStore('PositionAttributes').getData().items;
+ for (i = 0; i < data.length; i++) {
+ attribute = data[i];
+ this.routeColumns.push({
+ text: attribute.get('name'),
+ dataIndex: 'attribute.' + attribute.get('key'),
+ renderer: Traccar.AttributeFormatter.getAttributeFormatter(attribute.get('key')),
+ hidden: true
+ });
+ }
},
onConfigureClick: function () {
@@ -387,20 +397,6 @@ Ext.define('Traccar.view.ReportController', {
this.updateButtons();
},
- addAttributeColumns: function () {
- var i, data, attribute;
- data = Ext.getStore('PositionAttributes').getData().items;
- for (i = 0; i < data.length; i++) {
- attribute = data[i];
- this.routeColumns.push({
- text: attribute.get('name'),
- dataIndex: 'attribute.' + attribute.get('key'),
- renderer: Traccar.AttributeFormatter.getAttributeFormatter(attribute.get('key')),
- hidden: true
- });
- }
- },
-
routeColumns: [{
text: Strings.reportDeviceName,
dataIndex: 'deviceId',