From 748e170f7079a7cbd3b7bcc2dc7265917712805a Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Mon, 12 Sep 2016 10:29:30 +0500 Subject: Move column sets outside the method --- web/app/view/ReportController.js | 320 +++++++++++++++++++-------------------- 1 file changed, 160 insertions(+), 160 deletions(-) (limited to 'web/app') diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js index a6253952a..19baec815 100644 --- a/web/app/view/ReportController.js +++ b/web/app/view/ReportController.js @@ -168,176 +168,176 @@ Ext.define('Traccar.view.ReportController', { }, onTypeChange: function (combobox, newValue, oldValue) { - var routeColumns, eventsColumns, summaryColumns, tripsColumns; if (oldValue !== null) { this.onClearClick(); } - routeColumns = [{ - text: Strings.positionValid, - dataIndex: 'valid', - flex: 1, - renderer: Traccar.AttributeFormatter.getFormatter('valid') - }, { - text: Strings.positionFixTime, - dataIndex: 'fixTime', - flex: 1, - xtype: 'datecolumn', - renderer: Traccar.AttributeFormatter.getFormatter('fixTime') - }, { - text: Strings.positionLatitude, - dataIndex: 'latitude', - flex: 1, - renderer: Traccar.AttributeFormatter.getFormatter('latitude') - }, { - text: Strings.positionLongitude, - dataIndex: 'longitude', - flex: 1, - renderer: Traccar.AttributeFormatter.getFormatter('latitude') - }, { - text: Strings.positionAltitude, - dataIndex: 'altitude', - flex: 1, - renderer: Traccar.AttributeFormatter.getFormatter('altitude') - }, { - text: Strings.positionSpeed, - dataIndex: 'speed', - flex: 1, - renderer: Traccar.AttributeFormatter.getFormatter('speed') - }, { - text: Strings.positionAddress, - dataIndex: 'address', - flex: 1, - renderer: Traccar.AttributeFormatter.getFormatter('address') - }]; - - eventsColumns = [{ - text: Strings.positionFixTime, - dataIndex: 'serverTime', - flex: 1, - xtype: 'datecolumn', - renderer: Traccar.AttributeFormatter.getFormatter('serverTime') - }, { - text: Strings.reportDeviceName, - dataIndex: 'deviceId', - flex: 1, - renderer: function (value) { - return Ext.getStore('Devices').findRecord('id', value).get('name'); - } - }, { - text: Strings.sharedType, - dataIndex: 'type', - flex: 1, - renderer: function (value) { - var typeKey = 'event' + value.charAt(0).toUpperCase() + value.slice(1); - return Strings[typeKey]; - } - }, { - text: Strings.sharedGeofence, - dataIndex: 'geofenceId', - flex: 1, - renderer: function (value) { - if (value !== 0) { - return Ext.getStore('Geofences').findRecord('id', value).get('name'); - } - } - }]; - - summaryColumns = [{ - text: Strings.reportDeviceName, - dataIndex: 'deviceId', - flex: 1, - renderer: function (value) { - return Ext.getStore('Devices').findRecord('id', value).get('name'); - } - }, { - text: Strings.sharedDistance, - dataIndex: 'distance', - flex: 1, - renderer: Traccar.AttributeFormatter.getFormatter('distance') - }, { - text: Strings.reportAverageSpeed, - dataIndex: 'averageSpeed', - flex: 1, - renderer: Traccar.AttributeFormatter.getFormatter('speed') - }, { - text: Strings.reportMaximumSpeed, - dataIndex: 'maxSpeed', - flex: 1, - renderer: Traccar.AttributeFormatter.getFormatter('speed') - }, { - text: Strings.reportEngineHours, - dataIndex: 'engineHours', - flex: 1, - renderer: Traccar.AttributeFormatter.getFormatter('hours') - }]; - - tripsColumns = [{ - text: Strings.reportDeviceName, - dataIndex: 'deviceId', - flex: 1, - renderer: function (value) { - return Ext.getStore('Devices').findRecord('id', value).get('name'); - } - }, { - text: Strings.reportStartTime, - dataIndex: 'startTime', - flex: 1, - xtype: 'datecolumn', - renderer: Traccar.AttributeFormatter.getFormatter('startTime') - }, { - text: Strings.reportStartAddress, - dataIndex: 'startAddress', - flex: 1, - renderer: Traccar.AttributeFormatter.getFormatter('address') - }, { - text: Strings.reportEndTime, - dataIndex: 'endTime', - flex: 1, - xtype: 'datecolumn', - renderer: Traccar.AttributeFormatter.getFormatter('endTime') - }, { - text: Strings.reportEndAddress, - dataIndex: 'endAddress', - flex: 1, - renderer: Traccar.AttributeFormatter.getFormatter('address') - }, { - text: Strings.sharedDistance, - dataIndex: 'distance', - flex: 1, - renderer: Traccar.AttributeFormatter.getFormatter('distance') - }, { - text: Strings.reportAverageSpeed, - dataIndex: 'averageSpeed', - flex: 1, - renderer: Traccar.AttributeFormatter.getFormatter('speed') - }, { - text: Strings.reportMaximumSpeed, - dataIndex: 'maxSpeed', - flex: 1, - renderer: Traccar.AttributeFormatter.getFormatter('speed') - }, { - text: Strings.reportDuration, - dataIndex: 'duration', - flex: 1, - renderer: Traccar.AttributeFormatter.getFormatter('duration') - }, { - text: Strings.reportSpentFuel, - dataIndex: 'spentFuel', - flex: 1, - renderer: Traccar.AttributeFormatter.getFormatter('spentFuel') - }]; if (newValue === 'route') { - this.getView().reconfigure('ReportRoute', routeColumns); + this.getView().reconfigure('ReportRoute', this.routeColumns); } else if (newValue === 'events') { - this.getView().reconfigure('ReportEvents', eventsColumns); + this.getView().reconfigure('ReportEvents', this.eventsColumns); } else if (newValue === 'summary') { - this.getView().reconfigure('ReportSummary', summaryColumns); + this.getView().reconfigure('ReportSummary', this.summaryColumns); } else if (newValue === 'trips') { - this.getView().reconfigure('ReportTrips', tripsColumns); + this.getView().reconfigure('ReportTrips', this.tripsColumns); } this.updateButtons(); - } + }, + + routeColumns: [{ + text: Strings.positionValid, + dataIndex: 'valid', + flex: 1, + renderer: Traccar.AttributeFormatter.getFormatter('valid') + }, { + text: Strings.positionFixTime, + dataIndex: 'fixTime', + flex: 1, + xtype: 'datecolumn', + renderer: Traccar.AttributeFormatter.getFormatter('fixTime') + }, { + text: Strings.positionLatitude, + dataIndex: 'latitude', + flex: 1, + renderer: Traccar.AttributeFormatter.getFormatter('latitude') + }, { + text: Strings.positionLongitude, + dataIndex: 'longitude', + flex: 1, + renderer: Traccar.AttributeFormatter.getFormatter('latitude') + }, { + text: Strings.positionAltitude, + dataIndex: 'altitude', + flex: 1, + renderer: Traccar.AttributeFormatter.getFormatter('altitude') + }, { + text: Strings.positionSpeed, + dataIndex: 'speed', + flex: 1, + renderer: Traccar.AttributeFormatter.getFormatter('speed') + }, { + text: Strings.positionAddress, + dataIndex: 'address', + flex: 1, + renderer: Traccar.AttributeFormatter.getFormatter('address') + }], + + eventsColumns: [{ + text: Strings.positionFixTime, + dataIndex: 'serverTime', + flex: 1, + xtype: 'datecolumn', + renderer: Traccar.AttributeFormatter.getFormatter('serverTime') + }, { + text: Strings.reportDeviceName, + dataIndex: 'deviceId', + flex: 1, + renderer: function (value) { + return Ext.getStore('Devices').findRecord('id', value).get('name'); + } + }, { + text: Strings.sharedType, + dataIndex: 'type', + flex: 1, + renderer: function (value) { + var typeKey = 'event' + value.charAt(0).toUpperCase() + value.slice(1); + return Strings[typeKey]; + } + }, { + text: Strings.sharedGeofence, + dataIndex: 'geofenceId', + flex: 1, + renderer: function (value) { + if (value !== 0) { + return Ext.getStore('Geofences').findRecord('id', value).get('name'); + } + } + }], + + summaryColumns: [{ + text: Strings.reportDeviceName, + dataIndex: 'deviceId', + flex: 1, + renderer: function (value) { + return Ext.getStore('Devices').findRecord('id', value).get('name'); + } + }, { + text: Strings.sharedDistance, + dataIndex: 'distance', + flex: 1, + renderer: Traccar.AttributeFormatter.getFormatter('distance') + }, { + text: Strings.reportAverageSpeed, + dataIndex: 'averageSpeed', + flex: 1, + renderer: Traccar.AttributeFormatter.getFormatter('speed') + }, { + text: Strings.reportMaximumSpeed, + dataIndex: 'maxSpeed', + flex: 1, + renderer: Traccar.AttributeFormatter.getFormatter('speed') + }, { + text: Strings.reportEngineHours, + dataIndex: 'engineHours', + flex: 1, + renderer: Traccar.AttributeFormatter.getFormatter('hours') + }], + + tripsColumns: [{ + text: Strings.reportDeviceName, + dataIndex: 'deviceId', + flex: 1, + renderer: function (value) { + return Ext.getStore('Devices').findRecord('id', value).get('name'); + } + }, { + text: Strings.reportStartTime, + dataIndex: 'startTime', + flex: 1, + xtype: 'datecolumn', + renderer: Traccar.AttributeFormatter.getFormatter('startTime') + }, { + text: Strings.reportStartAddress, + dataIndex: 'startAddress', + flex: 1, + renderer: Traccar.AttributeFormatter.getFormatter('address') + }, { + text: Strings.reportEndTime, + dataIndex: 'endTime', + flex: 1, + xtype: 'datecolumn', + renderer: Traccar.AttributeFormatter.getFormatter('endTime') + }, { + text: Strings.reportEndAddress, + dataIndex: 'endAddress', + flex: 1, + renderer: Traccar.AttributeFormatter.getFormatter('address') + }, { + text: Strings.sharedDistance, + dataIndex: 'distance', + flex: 1, + renderer: Traccar.AttributeFormatter.getFormatter('distance') + }, { + text: Strings.reportAverageSpeed, + dataIndex: 'averageSpeed', + flex: 1, + renderer: Traccar.AttributeFormatter.getFormatter('speed') + }, { + text: Strings.reportMaximumSpeed, + dataIndex: 'maxSpeed', + flex: 1, + renderer: Traccar.AttributeFormatter.getFormatter('speed') + }, { + text: Strings.reportDuration, + dataIndex: 'duration', + flex: 1, + renderer: Traccar.AttributeFormatter.getFormatter('duration') + }, { + text: Strings.reportSpentFuel, + dataIndex: 'spentFuel', + flex: 1, + renderer: Traccar.AttributeFormatter.getFormatter('spentFuel') + }] }); -- cgit v1.2.3