diff options
author | tsmgeek <tsmgeek@gmail.com> | 2017-08-22 00:21:29 +0100 |
---|---|---|
committer | tsmgeek <tsmgeek@gmail.com> | 2017-08-22 00:21:29 +0100 |
commit | fdf35488b5b3cd5725c6c2e179b65377d30c6577 (patch) | |
tree | da0b3927f3049475cd67977fe093d198920c1c37 /web/app/view | |
parent | f8b98b236fd676fe8945d942842640ddea5bbac8 (diff) | |
parent | e0bb9b92d07176677b3043530660af3bc30774d7 (diff) | |
download | trackermap-web-fdf35488b5b3cd5725c6c2e179b65377d30c6577.tar.gz trackermap-web-fdf35488b5b3cd5725c6c2e179b65377d30c6577.tar.bz2 trackermap-web-fdf35488b5b3cd5725c6c2e179b65377d30c6577.zip |
Merge from upstream, change .eslintrc.json
Diffstat (limited to 'web/app/view')
25 files changed, 150 insertions, 81 deletions
diff --git a/web/app/view/ArrayListFilter.js b/web/app/view/ArrayListFilter.js index cea748af..b6c1512f 100644 --- a/web/app/view/ArrayListFilter.js +++ b/web/app/view/ArrayListFilter.js @@ -34,10 +34,8 @@ Ext.define('Traccar.view.ArrayListFilter', { return true; } } - } else { - if (value.indexOf(property) !== -1) { - return true; - } + } else if (value.indexOf(property) !== -1) { + return true; } return false; }); diff --git a/web/app/view/CustomNumberField.js b/web/app/view/CustomNumberField.js index e116e934..887e5c9c 100644 --- a/web/app/view/CustomNumberField.js +++ b/web/app/view/CustomNumberField.js @@ -37,7 +37,7 @@ Ext.define('Traccar.view.CustomNumberField', { } else if (config.dataType === 'distance') { config.beforeSubTpl = this.beforeEl; unit = Traccar.app.getPreference('distanceUnit', 'km'); - config.afterSubTpl = this.unitEl + Ext.getStore('DistanceUnits').findRecord('key', unit).get('name') + '</div></div>'; + config.afterSubTpl = this.unitEl + Ext.getStore('DistanceUnits').findRecord('key', unit).get('name') + '</div></div>'; config.rawToValue = function (rawValue) { return Ext.getStore('DistanceUnits').convertValue(rawValue, Traccar.app.getPreference('distanceUnit', 'km'), true); }; diff --git a/web/app/view/EventsController.js b/web/app/view/EventsController.js index 62af967b..8eb4363f 100644 --- a/web/app/view/EventsController.js +++ b/web/app/view/EventsController.js @@ -46,7 +46,7 @@ Ext.define('Traccar.view.EventsController', { } }, - onRemoveClick: function (button) { + onRemoveClick: function () { var event, positionId; event = this.getView().getSelectionModel().getSelection()[0]; if (event) { @@ -58,12 +58,12 @@ Ext.define('Traccar.view.EventsController', { } }, - onClearClick: function (button) { + onClearClick: function () { Ext.getStore('Events').removeAll(); Ext.getStore('EventPositions').removeAll(); }, - onAddEvent: function (store, data) { + onAddEvent: function () { if (this.lookupReference('scrollToLastButton').pressed) { this.getView().scrollBy(0, Number.POSITIVE_INFINITY, true); } diff --git a/web/app/view/MainController.js b/web/app/view/MainController.js index 76645e43..126d9af5 100644 --- a/web/app/view/MainController.js +++ b/web/app/view/MainController.js @@ -20,7 +20,6 @@ Ext.define('Traccar.view.MainController', { alias: 'controller.mainController', init: function () { - this.lookupReference('reportView').setHidden( - Traccar.app.getAttributePreference('ui.disableReport', false).toString() === 'true'); + this.lookupReference('reportView').setHidden(Traccar.app.getBooleanAttributePreference('ui.disableReport')); } }); diff --git a/web/app/view/NotificationsController.js b/web/app/view/NotificationsController.js index f50e8d82..651f57fc 100644 --- a/web/app/view/NotificationsController.js +++ b/web/app/view/NotificationsController.js @@ -27,7 +27,7 @@ Ext.define('Traccar.view.NotificationsController', { }); }, - onCheckChange: function (column, rowIndex, checked, eOpts) { + onCheckChange: function (column, rowIndex) { var record = this.getView().getStore().getAt(rowIndex); Ext.Ajax.request({ scope: this, diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js index 58500860..f9dbc03c 100644 --- a/web/app/view/ReportController.js +++ b/web/app/view/ReportController.js @@ -79,6 +79,23 @@ Ext.define('Traccar.view.ReportController', { hidden: true }); } + if (Traccar.app.getVehicleFeaturesDisabled()) { + for (i = 0; i < this.summaryColumns.length; i++) { + if (this.summaryColumns[i].dataIndex.match('engineHours|spentFuel')) { + this.summaryColumns[i].hidden = true; + } + } + for (i = 0; i < this.tripsColumns.length; i++) { + if (this.tripsColumns[i].dataIndex.match('spentFuel|driverUniqueId')) { + this.tripsColumns[i].hidden = true; + } + } + for (i = 0; i < this.stopsColumns.length; i++) { + if (this.stopsColumns[i].dataIndex.match('engineHours|spentFuel')) { + this.stopsColumns[i].hidden = true; + } + } + } }, onConfigureClick: function () { @@ -117,7 +134,7 @@ Ext.define('Traccar.view.ReportController', { updateButtons: function () { var reportType, disabled, devices, time; reportType = this.lookupReference('reportTypeField').getValue(); - devices = (this.deviceId && this.deviceId.length !== 0) || (this.groupId && this.groupId.length !== 0); + devices = this.deviceId && this.deviceId.length !== 0 || this.groupId && this.groupId.length !== 0; time = this.fromDate && this.fromTime && this.toDate && this.toTime; disabled = !reportType || !devices || !time; this.lookupReference('showButton').setDisabled(disabled); @@ -204,7 +221,7 @@ Ext.define('Traccar.view.ReportController', { } }, - selectReport: function (object, center) { + selectReport: function (object) { var positionRelated, reportType = this.lookupReference('reportTypeField').getValue(); if (object instanceof Traccar.model.Position) { if (reportType === 'route') { @@ -281,15 +298,15 @@ Ext.define('Traccar.view.ReportController', { var i, deviceIds, chartSeries, deviceStore; if (this.lookupReference('reportTypeField').getValue() === 'chart') { this.getChart().getAxes()[0].setTitle( - Ext.getStore('ReportChartTypes').findRecord('key', this.chartType).get('name')); + Ext.getStore('ReportChartTypes').findRecord('key', this.chartType).get('name')); chartSeries = []; deviceIds = store.collect('deviceId'); for (i = 0; i < deviceIds.length; i++) { - deviceStore = new Ext.create('Ext.data.ChainedStore', { + deviceStore = Ext.create('Ext.data.ChainedStore', { source: 'ReportRoute', filters: [{ property: 'deviceId', - value : deviceIds[i] + value: deviceIds[i] }] }); chartSeries.push({ diff --git a/web/app/view/SettingsMenuController.js b/web/app/view/SettingsMenuController.js index 102120d8..7175260c 100644 --- a/web/app/view/SettingsMenuController.js +++ b/web/app/view/SettingsMenuController.js @@ -45,7 +45,7 @@ Ext.define('Traccar.view.SettingsMenuController', { if (admin) { this.lookupReference('settingsServerButton').setHidden(false); this.lookupReference('settingsStatisticsButton').setHidden(false); - this.lookupReference('settingsDeviceDistanceButton').setHidden(false); + this.lookupReference('settingsDeviceDistanceButton').setHidden(Traccar.app.getVehicleFeaturesDisabled()); } if (admin || manager) { this.lookupReference('settingsUsersButton').setHidden(false); @@ -55,12 +55,15 @@ Ext.define('Traccar.view.SettingsMenuController', { this.lookupReference('settingsGroupsButton').setHidden(false); this.lookupReference('settingsGeofencesButton').setHidden(false); this.lookupReference('settingsNotificationsButton').setHidden(false); - this.lookupReference('settingsCalendarsButton').setHidden(false); - this.lookupReference('settingsDriversButton').setHidden(false); + this.lookupReference('settingsCalendarsButton').setHidden( + Traccar.app.getBooleanAttributePreference('ui.disableCalendars')); + this.lookupReference('settingsDriversButton').setHidden( + Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableDrivers')); } - if (admin || (!deviceReadonly && !readonly)) { + if (admin || !deviceReadonly && !readonly) { this.lookupReference('settingsAttributeAliasesButton').setHidden(false); - this.lookupReference('settingsComputedAttributesButton').setHidden(false); + this.lookupReference('settingsComputedAttributesButton').setHidden( + Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes')); } }, diff --git a/web/app/view/StateController.js b/web/app/view/StateController.js index 23369b87..95f5f555 100644 --- a/web/app/view/StateController.js +++ b/web/app/view/StateController.js @@ -20,12 +20,11 @@ Ext.define('Traccar.view.StateController', { alias: 'controller.state', requires: [ - 'Traccar.AttributeFormatter', - 'Traccar.model.Attribute', - 'Traccar.model.AttributeAlias', - 'Traccar.model.Position', - 'Traccar.view.dialog.AttributeAlias' - + 'Traccar.AttributeFormatter', + 'Traccar.model.Attribute', + 'Traccar.model.AttributeAlias', + 'Traccar.model.Position', + 'Traccar.view.dialog.AttributeAlias' ], config: { @@ -73,7 +72,7 @@ Ext.define('Traccar.view.StateController', { }; } return result; - }()), + })(), updateLatest: function (store, data) { var i; @@ -89,7 +88,7 @@ Ext.define('Traccar.view.StateController', { }, formatValue: function (value) { - if (typeof (id) === 'number') { + if (typeof id === 'number') { return Number(value.toFixed(2)); } else { return value; @@ -169,7 +168,7 @@ Ext.define('Traccar.view.StateController', { Ext.getStore('Attributes').removeAll(); }, - clearReport: function (store) { + clearReport: function () { if (!this.deviceId) { this.position = null; Ext.getStore('Attributes').removeAll(); diff --git a/web/app/view/dialog/CalendarController.js b/web/app/view/dialog/CalendarController.js index 14d8294a..fb8cbff6 100644 --- a/web/app/view/dialog/CalendarController.js +++ b/web/app/view/dialog/CalendarController.js @@ -26,12 +26,12 @@ Ext.define('Traccar.view.dialog.CalendarController', { reader = new FileReader(); reader.onload = function (event) { fileField.up('window').lookupReference('dataField').setValue( - btoa(String.fromCharCode.apply(null, new Uint8Array(event.target.result)))); + event.target.result.substr(event.target.result.indexOf(',') + 1)); }; reader.onerror = function (event) { Traccar.app.showError(event.target.error); }; - reader.readAsArrayBuffer(fileField.fileInputEl.dom.files[0]); + reader.readAsDataURL(fileField.fileInputEl.dom.files[0]); } } }); diff --git a/web/app/view/dialog/CommandController.js b/web/app/view/dialog/CommandController.js index 485d994d..3fdc7b0c 100644 --- a/web/app/view/dialog/CommandController.js +++ b/web/app/view/dialog/CommandController.js @@ -97,6 +97,8 @@ Ext.define('Traccar.view.dialog.CommandController', { data: value }); break; + default: + break; } Ext.Ajax.request({ diff --git a/web/app/view/dialog/Geofence.js b/web/app/view/dialog/Geofence.js index 93f17de5..bed20d38 100644 --- a/web/app/view/dialog/Geofence.js +++ b/web/app/view/dialog/Geofence.js @@ -46,6 +46,7 @@ Ext.define('Traccar.view.dialog.Geofence', { fieldLabel: Strings.sharedDescription }, { xtype: 'combobox', + reference: 'calendarCombo', name: 'calendarId', store: 'Calendars', queryMode: 'local', diff --git a/web/app/view/dialog/GeofenceController.js b/web/app/view/dialog/GeofenceController.js index 9fdad61b..e4ac5a2e 100644 --- a/web/app/view/dialog/GeofenceController.js +++ b/web/app/view/dialog/GeofenceController.js @@ -34,6 +34,11 @@ Ext.define('Traccar.view.dialog.GeofenceController', { } }, + init: function () { + this.lookupReference('calendarCombo').setHidden( + Traccar.app.getBooleanAttributePreference('ui.disableCalendars')); + }, + saveArea: function (value) { this.lookupReference('areaField').setValue(value); }, diff --git a/web/app/view/dialog/LoginController.js b/web/app/view/dialog/LoginController.js index 1b5cd072..c25d9a83 100644 --- a/web/app/view/dialog/LoginController.js +++ b/web/app/view/dialog/LoginController.js @@ -86,14 +86,12 @@ Ext.define('Traccar.view.dialog.LoginController', { prefix = url.substring(0, url.indexOf(paramName)); suffix = url.substring(url.indexOf(paramName)); suffix = suffix.substring(suffix.indexOf('=') + 1); - suffix = (suffix.indexOf('&') >= 0) ? suffix.substring(suffix.indexOf('&')) : ''; + suffix = suffix.indexOf('&') >= 0 ? suffix.substring(suffix.indexOf('&')) : ''; url = prefix + paramName + '=' + paramValue + suffix; + } else if (url.indexOf('?') < 0) { + url += '?' + paramName + '=' + paramValue; } else { - if (url.indexOf('?') < 0) { - url += '?' + paramName + '=' + paramValue; - } else { - url += '&' + paramName + '=' + paramValue; - } + url += '&' + paramName + '=' + paramValue; } window.location.href = url; }, diff --git a/web/app/view/dialog/MapPickerController.js b/web/app/view/dialog/MapPickerController.js index 23f60ece..8641e377 100644 --- a/web/app/view/dialog/MapPickerController.js +++ b/web/app/view/dialog/MapPickerController.js @@ -30,7 +30,7 @@ Ext.define('Traccar.view.dialog.MapPickerController', { } }, - getMapState: function (button) { + getMapState: function () { this.fireEvent('mapstaterequest'); }, diff --git a/web/app/view/edit/AttributeAliasesController.js b/web/app/view/edit/AttributeAliasesController.js index d1beb135..8ac68bcb 100644 --- a/web/app/view/edit/AttributeAliasesController.js +++ b/web/app/view/edit/AttributeAliasesController.js @@ -61,13 +61,13 @@ Ext.define('Traccar.view.edit.AttributeAliasesController', { this.lookupReference('toolbarRemoveButton').setDisabled(disabled); }, - onDeviceChange: function (combobox, newValue, oldValue) { + onDeviceChange: function (combobox, value) { var manager = Traccar.app.getUser().get('admin') || Traccar.app.getUser().get('userLimit') > 0; this.onSelectionChange(); - if (newValue !== null) { - this.getView().getStore().filter('deviceId', newValue); + if (value !== null) { + this.getView().getStore().filter('deviceId', value); if (manager && this.getView().getStore().getCount() === 0) { - Ext.getStore('AttributeAliases').getProxy().setExtraParam('deviceId', newValue); + Ext.getStore('AttributeAliases').getProxy().setExtraParam('deviceId', value); Ext.getStore('AttributeAliases').load({ addRecords: true }); diff --git a/web/app/view/edit/Attributes.js b/web/app/view/edit/Attributes.js index 84cadea5..a76223b9 100644 --- a/web/app/view/edit/Attributes.js +++ b/web/app/view/edit/Attributes.js @@ -46,7 +46,7 @@ Ext.define('Traccar.view.edit.Attributes', { text: Strings.sharedName, dataIndex: 'name', filter: 'string', - renderer: function (value, metaData) { + renderer: function (value) { var attribute; if (this.attributesStore) { attribute = Ext.getStore(this.attributesStore).getById(value); diff --git a/web/app/view/edit/AttributesController.js b/web/app/view/edit/AttributesController.js index 8d159569..84ff6adf 100644 --- a/web/app/view/edit/AttributesController.js +++ b/web/app/view/edit/AttributesController.js @@ -94,6 +94,7 @@ Ext.define('Traccar.view.edit.AttributesController', { displayField: 'name', valueField: 'key', allowBlank: false, + queryMode: 'local', listeners: { change: 'onNameChange' } diff --git a/web/app/view/edit/Devices.js b/web/app/view/edit/Devices.js index c9538c8b..4fdcab00 100644 --- a/web/app/view/edit/Devices.js +++ b/web/app/view/edit/Devices.js @@ -111,6 +111,7 @@ Ext.define('Traccar.view.edit.Devices', { if (status) { return Ext.getStore('DeviceStatuses').getById(status).get('color'); } + return null; } }, @@ -165,7 +166,7 @@ Ext.define('Traccar.view.edit.Devices', { for (i = 0; i < value.length; i++) { name = Traccar.AttributeFormatter.geofenceIdFormatter(value[i]); if (name) { - result += name + ((i < value.length - 1) ? ', ' : ''); + result += name + (i < value.length - 1 ? ', ' : ''); } } } @@ -187,6 +188,7 @@ Ext.define('Traccar.view.edit.Devices', { return status.get('name'); } } + return null; } }, { text: Strings.deviceLastUpdate, diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js index ae65fbb1..df75b1d4 100644 --- a/web/app/view/edit/DevicesController.js +++ b/web/app/view/edit/DevicesController.js @@ -61,6 +61,10 @@ Ext.define('Traccar.view.edit.DevicesController', { deviceReadonly = Traccar.app.getPreference('deviceReadonly', false) && !Traccar.app.getUser().get('admin'); readonly = Traccar.app.getPreference('readonly', false) && !Traccar.app.getUser().get('admin'); this.lookupReference('toolbarAddButton').setDisabled(readonly || deviceReadonly); + this.lookupReference('toolbarDriversButton').setHidden( + Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableDrivers')); + this.lookupReference('toolbarAttributesButton').setHidden( + Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes')); setInterval(function () { self.getView().getView().refresh(); @@ -151,7 +155,7 @@ Ext.define('Traccar.view.edit.DevicesController', { } }, - selectDevice: function (device, center) { + selectDevice: function (device) { this.getView().getSelectionModel().select([device], false, true); this.updateButtons(this.getView().getSelectionModel()); this.getView().getView().focusRow(device); @@ -163,7 +167,7 @@ Ext.define('Traccar.view.edit.DevicesController', { } }, - onUpdateDevice: function (store, data) { + onUpdateDevice: function () { this.updateButtons(this.getView().getSelectionModel()); }, diff --git a/web/app/view/edit/GroupsController.js b/web/app/view/edit/GroupsController.js index 21f17ffa..be26cc93 100644 --- a/web/app/view/edit/GroupsController.js +++ b/web/app/view/edit/GroupsController.js @@ -32,6 +32,13 @@ Ext.define('Traccar.view.edit.GroupsController', { objectDialog: 'Traccar.view.dialog.Group', removeTitle: Strings.groupDialog, + init: function () { + this.lookupReference('toolbarDriversButton').setHidden( + Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableDrivers')); + this.lookupReference('toolbarAttributesButton').setHidden( + Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes')); + }, + onGeofencesClick: function () { var admin, group; admin = Traccar.app.getUser().get('admin'); diff --git a/web/app/view/edit/UsersController.js b/web/app/view/edit/UsersController.js index fb7a36e2..3bc7d1c4 100644 --- a/web/app/view/edit/UsersController.js +++ b/web/app/view/edit/UsersController.js @@ -41,6 +41,12 @@ Ext.define('Traccar.view.edit.UsersController', { init: function () { Ext.getStore('Users').load(); this.lookupReference('userUsersButton').setHidden(!Traccar.app.getUser().get('admin')); + this.lookupReference('userDriversButton').setHidden( + Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableDrivers')); + this.lookupReference('userAttributesButton').setHidden( + Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes')); + this.lookupReference('userCalendarsButton').setHidden( + Traccar.app.getBooleanAttributePreference('ui.disableCalendars')); }, onEditClick: function () { diff --git a/web/app/view/map/BaseMap.js b/web/app/view/map/BaseMap.js index c1873161..cac5a596 100644 --- a/web/app/view/map/BaseMap.js +++ b/web/app/view/map/BaseMap.js @@ -117,11 +117,45 @@ Ext.define('Traccar.view.map.BaseMap', { 262144, 131072, 65536, 32768, 16384, 8192, 4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 0.5 ] +<<<<<<< HEAD }), attributions: [ new ol.Attribution({ html: '© <a href="http://map.baidu.com/">Baidu</a>' }) +======= + }) + ] + }) + }); + } else if (type === 'baidu') { + layer = new ol.layer.Tile({ + source: new ol.source.XYZ({ + projection: 'BD-MC', + tileUrlFunction: function (tileCoord) { + var urlsLength = 5, z = tileCoord[0], x = tileCoord[1], y = tileCoord[2], hash, index; + + hash = (x << z) + y; + index = hash % urlsLength; + index = index < 0 ? index + urlsLength : index; + + if (x < 0) { + x = 'M' + -x; + } + if (y < 0) { + y = 'M' + -y; + } + return 'http://online{}.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles=pl' + .replace('{}', index).replace('{x}', x).replace('{y}', y).replace('{z}', z); + }, + tileGrid: new ol.tilegrid.TileGrid({ + extent: ol.proj.transformExtent([-180, -74, 180, 74], 'EPSG:4326', 'BD-MC'), + origin: [0, 0], + minZoom: 3, + resolutions: [ + 262144, 131072, 65536, 32768, 16384, 8192, 4096, 2048, + 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 0.5 +>>>>>>> e0bb9b92d07176677b3043530660af3bc30774d7 ] }) }); @@ -180,7 +214,7 @@ Ext.define('Traccar.view.map.BaseMap', { } this.map.on('pointermove', function (e) { - var hit = this.forEachFeatureAtPixel(e.pixel, function (feature, layer) { + var hit = this.forEachFeatureAtPixel(e.pixel, function () { return true; }); if (hit) { @@ -191,14 +225,15 @@ Ext.define('Traccar.view.map.BaseMap', { }); this.map.on('click', function (e) { - if (this.map.hasFeatureAtPixel(e.pixel, { + var i, features = this.map.getFeaturesAtPixel(e.pixel, { layerFilter: function (layer) { return !layer.get('name'); } - })) { - this.map.forEachFeatureAtPixel(e.pixel, function (feature, layer) { - this.fireEvent('selectfeature', feature); - }.bind(this)); + }); + if (features) { + for (i = 0; i < features.length; i++) { + this.fireEvent('selectfeature', features[i]); + } } else { this.fireEvent('deselectfeature'); } @@ -215,9 +250,7 @@ Ext.define('Traccar.view.map.BaseMap', { } } }, function () { - proj4.defs('BD-MC', '+proj=merc +lon_0=0 +units=m +ellps=clrk66 +no_defs'); proj4.defs('EPSG:3395', '+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs'); ol.proj.get('EPSG:3395').setExtent([-20037508.342789244, -20037508.342789244, 20037508.342789244, 20037508.342789244]); - }); diff --git a/web/app/view/map/MapController.js b/web/app/view/map/MapController.js index f2a561a3..75796f9b 100644 --- a/web/app/view/map/MapController.js +++ b/web/app/view/map/MapController.js @@ -44,8 +44,8 @@ Ext.define('Traccar.view.map.MapController', { init: function () { this.callParent(); - this.lookupReference('showReportsButton').setVisible(Traccar.app.isMobile() && - !Traccar.app.getAttributePreference('ui.disableReport', false)); + this.lookupReference('showReportsButton').setVisible( + Traccar.app.isMobile() && !Traccar.app.getBooleanAttributePreference('ui.disableReport')); this.lookupReference('showEventsButton').setVisible(Traccar.app.isMobile()); }, @@ -79,10 +79,10 @@ Ext.define('Traccar.view.map.MapController', { this.getView().getGeofencesSource().clear(); if (this.lookupReference('showGeofencesButton').pressed) { Ext.getStore('Geofences').each(function (geofence) { - var feature = new ol.Feature(Traccar.GeofenceConverter - .wktToGeometry(this.getView().getMapView(), geofence.get('area'))); - feature.setStyle(this.getAreaStyle(geofence.get('name'), - geofence.get('attributes') ? geofence.get('attributes').color : null)); + var feature = new ol.Feature( + Traccar.GeofenceConverter.wktToGeometry(this.getView().getMapView(), geofence.get('area'))); + feature.setStyle(this.getAreaStyle( + geofence.get('name'), geofence.get('attributes') ? geofence.get('attributes').color : null)); this.getView().getGeofencesSource().addFeature(feature); return true; }, this); diff --git a/web/app/view/map/MapMarkerController.js b/web/app/view/map/MapMarkerController.js index 09dd83dc..c46faac2 100644 --- a/web/app/view/map/MapMarkerController.js +++ b/web/app/view/map/MapMarkerController.js @@ -216,7 +216,7 @@ Ext.define('Traccar.view.map.MapMarkerController', { projection = mapView.getProjection(); center = ol.proj.fromLonLat([position.get('longitude'), position.get('latitude')]); pointResolution = ol.proj.getPointResolution(projection, mapView.getResolution(), center); - radius = (position.get('accuracy') / ol.proj.METERS_PER_UNIT.m) * mapView.getResolution() / pointResolution; + radius = position.get('accuracy') / ol.proj.METERS_PER_UNIT.m * mapView.getResolution() / pointResolution; if (feature) { feature.getGeometry().setCenter(center); @@ -257,8 +257,8 @@ Ext.define('Traccar.view.map.MapMarkerController', { marker.set('record', device); style = this.getLatestMarker(this.getDeviceColor(device), - position.get('course'), - device.get('category')); + position.get('course'), + device.get('category')); style.getText().setText(device.get('name')); marker.setStyle(style); marker.setId(device.get('id')); @@ -429,10 +429,8 @@ Ext.define('Traccar.view.map.MapMarkerController', { resizeMarker: function (style, zoom) { var image, text; - image = Traccar.DeviceImages.getImageIcon(style.getImage().fill, - zoom, - style.getImage().angle, - style.getImage().category); + image = Traccar.DeviceImages.getImageIcon( + style.getImage().fill, zoom, style.getImage().angle, style.getImage().category); text = style.getText(); text.setOffsetY(-image.getSize()[1] / 2 - Traccar.Style.mapTextOffset); style.setText(text); @@ -440,18 +438,14 @@ Ext.define('Traccar.view.map.MapMarkerController', { }, rotateMarker: function (style, angle) { - style.setImage(Traccar.DeviceImages.getImageIcon(style.getImage().fill, - style.getImage().zoom, - angle, - style.getImage().category)); + style.setImage(Traccar.DeviceImages.getImageIcon( + style.getImage().fill, style.getImage().zoom, angle, style.getImage().category)); }, updateDeviceMarker: function (style, color, category) { var image, text; - image = Traccar.DeviceImages.getImageIcon(color, - style.getImage().zoom, - style.getImage().angle, - category); + image = Traccar.DeviceImages.getImageIcon( + color, style.getImage().zoom, style.getImage().angle, category); text = style.getText(); text.setOffsetY(-image.getSize()[1] / 2 - Traccar.Style.mapTextOffset); style.setText(text); @@ -608,7 +602,7 @@ Ext.define('Traccar.view.map.MapMarkerController', { } }, - filterDevices: function (store) { + filterDevices: function () { Ext.getStore('Devices').each(this.updateDeviceVisibility, this, false); } }); diff --git a/web/app/view/permissions/BaseController.js b/web/app/view/permissions/BaseController.js index 860a29b3..5cb9c302 100644 --- a/web/app/view/permissions/BaseController.js +++ b/web/app/view/permissions/BaseController.js @@ -24,11 +24,11 @@ Ext.define('Traccar.view.permissions.BaseController', { params[this.getView().baseObjectName] = this.getView().baseObject; linkStoreName = this.getView().linkStoreName; storeName = this.getView().storeName; - linkStoreName = (typeof linkStoreName === 'undefined') ? storeName : linkStoreName; + linkStoreName = typeof linkStoreName === 'undefined' ? storeName : linkStoreName; this.getView().setStore(Ext.getStore(storeName)); this.getView().getStore().load({ scope: this, - callback: function (records, operation, success) { + callback: function () { var linkStore = Ext.create('Traccar.store.' + linkStoreName); linkStore.load({ params: params, @@ -47,7 +47,7 @@ Ext.define('Traccar.view.permissions.BaseController', { }); }, - onBeforeSelect: function (selection, record, index) { + onBeforeSelect: function (selection, record) { var data = {}; data[this.getView().baseObjectName] = this.getView().baseObject; data[this.getView().linkObjectName] = record.getId(); @@ -64,7 +64,7 @@ Ext.define('Traccar.view.permissions.BaseController', { }); }, - onBeforeDeselect: function (selection, record, index) { + onBeforeDeselect: function (selection, record) { var data = {}; data[this.getView().baseObjectName] = this.getView().baseObject; data[this.getView().linkObjectName] = record.getId(); |