diff options
Diffstat (limited to 'web/app/view')
-rw-r--r-- | web/app/view/ReportController.js | 14 | ||||
-rw-r--r-- | web/app/view/StateController.js | 9 | ||||
-rw-r--r-- | web/app/view/dialog/ReportConfig.js | 2 | ||||
-rw-r--r-- | web/app/view/edit/Attributes.js | 4 |
4 files changed, 24 insertions, 5 deletions
diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js index d83d9986..3daa2957 100644 --- a/web/app/view/ReportController.js +++ b/web/app/view/ReportController.js @@ -64,6 +64,20 @@ Ext.define('Traccar.view.ReportController', { return this.getView().getComponent('chart'); }, + init: 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 + }); + } + }, + onConfigureClick: function () { var dialog = Ext.create('Traccar.view.dialog.ReportConfig'); dialog.lookupReference('eventTypeField').setHidden(this.lookupReference('reportTypeField').getValue() !== 'events'); diff --git a/web/app/view/StateController.js b/web/app/view/StateController.js index 0723dc13..4c99a8be 100644 --- a/web/app/view/StateController.js +++ b/web/app/view/StateController.js @@ -101,7 +101,7 @@ Ext.define('Traccar.view.StateController', { }, updatePosition: function () { - var attributes, store, key, aliasIndex, name; + var attributes, store, key, aliasIndex, name, value; store = Ext.getStore('Attributes'); store.removeAll(); @@ -126,11 +126,16 @@ Ext.define('Traccar.view.StateController', { } else { name = Ext.getStore('PositionAttributes').getAttributeName(key, true); } + if (this.position.get('attribute.' + key) !== undefined) { + value = Traccar.AttributeFormatter.getAttributeFormatter(key)(this.position.get('attribute.' + key)); + } else { + value = Traccar.AttributeFormatter.defaultFormatter(attributes[key]); + } store.add(Ext.create('Traccar.model.Attribute', { priority: 1024, name: name, attribute: key, - value: Traccar.AttributeFormatter.getAttributeFormatter(key)(attributes[key]) + value: value })); } } diff --git a/web/app/view/dialog/ReportConfig.js b/web/app/view/dialog/ReportConfig.js index b8493cbb..836b6050 100644 --- a/web/app/view/dialog/ReportConfig.js +++ b/web/app/view/dialog/ReportConfig.js @@ -61,7 +61,7 @@ Ext.define('Traccar.view.dialog.ReportConfig', { reference: 'chartTypeField', store: 'ReportChartTypes', hidden: true, - value: 'speedConverted', + value: 'speed', valueField: 'key', displayField: 'name', queryMode: 'local' diff --git a/web/app/view/edit/Attributes.js b/web/app/view/edit/Attributes.js index b080e569..66d8bb12 100644 --- a/web/app/view/edit/Attributes.js +++ b/web/app/view/edit/Attributes.js @@ -58,9 +58,9 @@ Ext.define('Traccar.view.edit.Attributes', { attribute = Ext.getStore(this.attributesStore).getById(record.get('name')); } if (attribute && attribute.get('dataType') === 'speed') { - return Ext.getStore('SpeedUnits').formatValue(value, Traccar.app.getPreference('speedUnit', 'kn')); + return Ext.getStore('SpeedUnits').formatValue(value, Traccar.app.getPreference('speedUnit', 'kn'), true); } else if (attribute && attribute.get('dataType') === 'distance') { - return Ext.getStore('DistanceUnits').formatValue(value, Traccar.app.getPreference('distanceUnit', 'km')); + return Ext.getStore('DistanceUnits').formatValue(value, Traccar.app.getPreference('distanceUnit', 'km'), true); } else { return value; } |