From d2f8ca9cb1dae87591de1b5e6037c78c15d23d2a Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 8 Nov 2015 12:38:57 +1300 Subject: Generate priorities for postion keys --- web/app/view/Report.js | 2 +- web/app/view/StateController.js | 50 +++++++++++------------------------------ 2 files changed, 14 insertions(+), 38 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/Report.js b/web/app/view/Report.js index 6f2359253..65a151c4d 100644 --- a/web/app/view/Report.js +++ b/web/app/view/Report.js @@ -84,7 +84,7 @@ Ext.define('Traccar.view.Report', { flex: 1, renderer: Traccar.AttributeFormatter.getFormatter('valid') }, { - text: Strings.positionTime, + text: Strings.positionFixTime, dataIndex: 'fixTime', flex: 1, xtype: 'datecolumn', diff --git a/web/app/view/StateController.js b/web/app/view/StateController.js index 98adb6b11..e2b80643d 100644 --- a/web/app/view/StateController.js +++ b/web/app/view/StateController.js @@ -35,44 +35,20 @@ Ext.define('Traccar.view.StateController', { } }, - keys: { - fixTime: { - priority: 1, - name: Strings.positionTime - }, - latitude: { - priority: 2, - name: Strings.positionLatitude - }, - longitude: { - priority: 3, - name: Strings.positionLongitude - }, - valid: { - priority: 4, - name: Strings.positionValid - }, - altitude: { - priority: 5, - name: Strings.positionAltitude - }, - speed: { - priority: 6, - name: Strings.positionSpeed - }, - course: { - priority: 7, - name: Strings.positionCourse - }, - address: { - priority: 8, - name: Strings.positionAddress - }, - protocol: { - priority: 9, - name: Strings.positionProtocol + keys: (function () { + var i, list, result; + result = {}; + list = ['fixTime', 'latitude', 'longitude', 'valid', 'altitude', 'speed', 'course', 'address', 'protocol']; + for (i = 0; i < list.length; i++) { + result[list[i]] = { + priority: i, + name: Strings['position' + list[i].replace(/^\w/g, function (s) { + return s.toUpperCase(); + })] + }; } - }, + return result; + }()), formatValue: function (value) { if (typeof (id) === 'number') { -- cgit v1.2.3