diff options
author | Abyss777 <abyss@fox5.ru> | 2016-09-12 10:29:30 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2016-09-12 10:29:30 +0500 |
commit | 748e170f7079a7cbd3b7bcc2dc7265917712805a (patch) | |
tree | 87b310da0be4849b9b2ab81fe72af4faa2f36a23 /web/app | |
parent | 4bf3da3cd0d9808fd43f3903f9702ec4686062b1 (diff) | |
download | traccar-server-748e170f7079a7cbd3b7bcc2dc7265917712805a.tar.gz traccar-server-748e170f7079a7cbd3b7bcc2dc7265917712805a.tar.bz2 traccar-server-748e170f7079a7cbd3b7bcc2dc7265917712805a.zip |
Move column sets outside the method
Diffstat (limited to 'web/app')
-rw-r--r-- | web/app/view/ReportController.js | 320 |
1 files changed, 160 insertions, 160 deletions
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') + }] }); |