From a2b7e07df1cc4548e27c51e1545cf210b0ef0ab7 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Fri, 11 Aug 2017 15:03:39 +0500 Subject: Implement attribute to disable vehicle related UI features --- web/app/view/MainController.js | 3 +-- web/app/view/ReportController.js | 17 +++++++++++++++++ web/app/view/SettingsMenuController.js | 4 ++-- web/app/view/edit/DevicesController.js | 1 + web/app/view/edit/GroupsController.js | 4 ++++ web/app/view/map/MapController.js | 2 +- 6 files changed, 26 insertions(+), 5 deletions(-) (limited to 'web/app/view') 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/ReportController.js b/web/app/view/ReportController.js index 58500860..85af559a 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.isVehicleFeaturesDisabled()) { + 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 () { diff --git a/web/app/view/SettingsMenuController.js b/web/app/view/SettingsMenuController.js index 102120d8..11bfb538 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.isVehicleFeaturesDisabled()); } if (admin || manager) { this.lookupReference('settingsUsersButton').setHidden(false); @@ -56,7 +56,7 @@ Ext.define('Traccar.view.SettingsMenuController', { this.lookupReference('settingsGeofencesButton').setHidden(false); this.lookupReference('settingsNotificationsButton').setHidden(false); this.lookupReference('settingsCalendarsButton').setHidden(false); - this.lookupReference('settingsDriversButton').setHidden(false); + this.lookupReference('settingsDriversButton').setHidden(Traccar.app.isVehicleFeaturesDisabled()); } if (admin || (!deviceReadonly && !readonly)) { this.lookupReference('settingsAttributeAliasesButton').setHidden(false); diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js index ae65fbb1..b98a8d4f 100644 --- a/web/app/view/edit/DevicesController.js +++ b/web/app/view/edit/DevicesController.js @@ -61,6 +61,7 @@ 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.isVehicleFeaturesDisabled()); setInterval(function () { self.getView().getView().refresh(); diff --git a/web/app/view/edit/GroupsController.js b/web/app/view/edit/GroupsController.js index 21f17ffa..941f5f18 100644 --- a/web/app/view/edit/GroupsController.js +++ b/web/app/view/edit/GroupsController.js @@ -32,6 +32,10 @@ Ext.define('Traccar.view.edit.GroupsController', { objectDialog: 'Traccar.view.dialog.Group', removeTitle: Strings.groupDialog, + init: function () { + this.lookupReference('toolbarDriversButton').setHidden(Traccar.app.isVehicleFeaturesDisabled()); + }, + onGeofencesClick: function () { var admin, group; admin = Traccar.app.getUser().get('admin'); diff --git a/web/app/view/map/MapController.js b/web/app/view/map/MapController.js index f2a561a3..651bd9f0 100644 --- a/web/app/view/map/MapController.js +++ b/web/app/view/map/MapController.js @@ -45,7 +45,7 @@ Ext.define('Traccar.view.map.MapController', { init: function () { this.callParent(); this.lookupReference('showReportsButton').setVisible(Traccar.app.isMobile() && - !Traccar.app.getAttributePreference('ui.disableReport', false)); + !Traccar.app.getBooleanAttributePreference('ui.disableReport')); this.lookupReference('showEventsButton').setVisible(Traccar.app.isMobile()); }, -- cgit v1.2.3 From c52d923d60815fcc6c1e9592edbcd578caf1147c Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Fri, 11 Aug 2017 17:41:42 +0500 Subject: Implement disable Drivers and Computed Attributes separately --- web/app/store/ServerAttributes.js | 8 ++++++++ web/app/store/UserAttributes.js | 8 ++++++++ web/app/view/SettingsMenuController.js | 6 ++++-- web/app/view/edit/DevicesController.js | 5 ++++- web/app/view/edit/GroupsController.js | 5 ++++- web/app/view/edit/UsersController.js | 4 ++++ web/l10n/en.json | 2 ++ 7 files changed, 34 insertions(+), 4 deletions(-) (limited to 'web/app/view') diff --git a/web/app/store/ServerAttributes.js b/web/app/store/ServerAttributes.js index 438ca3e1..f4e2a848 100644 --- a/web/app/store/ServerAttributes.js +++ b/web/app/store/ServerAttributes.js @@ -55,5 +55,13 @@ Ext.define('Traccar.store.ServerAttributes', { key: 'ui.disableVehicleFetures', name: Strings.attributeUiDisableVehicleFetures, valueType: 'boolean' + }, { + key: 'ui.disableDrivers', + name: Strings.attributeUiDisableDrivers, + valueType: 'boolean' + }, { + key: 'ui.disableComputedAttributes', + name: Strings.attributeUiDisableComputedAttributes, + valueType: 'boolean' }] }); diff --git a/web/app/store/UserAttributes.js b/web/app/store/UserAttributes.js index 8e1acfb1..dbee1ed8 100644 --- a/web/app/store/UserAttributes.js +++ b/web/app/store/UserAttributes.js @@ -87,5 +87,13 @@ Ext.define('Traccar.store.UserAttributes', { key: 'ui.disableVehicleFetures', name: Strings.attributeUiDisableVehicleFetures, valueType: 'boolean' + }, { + key: 'ui.disableDrivers', + name: Strings.attributeUiDisableDrivers, + valueType: 'boolean' + }, { + key: 'ui.disableComputedAttributes', + name: Strings.attributeUiDisableComputedAttributes, + valueType: 'boolean' }] }); diff --git a/web/app/view/SettingsMenuController.js b/web/app/view/SettingsMenuController.js index 11bfb538..cc17ca3a 100644 --- a/web/app/view/SettingsMenuController.js +++ b/web/app/view/SettingsMenuController.js @@ -56,11 +56,13 @@ Ext.define('Traccar.view.SettingsMenuController', { this.lookupReference('settingsGeofencesButton').setHidden(false); this.lookupReference('settingsNotificationsButton').setHidden(false); this.lookupReference('settingsCalendarsButton').setHidden(false); - this.lookupReference('settingsDriversButton').setHidden(Traccar.app.isVehicleFeaturesDisabled()); + this.lookupReference('settingsDriversButton').setHidden(Traccar.app.isVehicleFeaturesDisabled() || + Traccar.app.getBooleanAttributePreference('ui.disableDrivers')); } 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/edit/DevicesController.js b/web/app/view/edit/DevicesController.js index b98a8d4f..59a10bb3 100644 --- a/web/app/view/edit/DevicesController.js +++ b/web/app/view/edit/DevicesController.js @@ -61,7 +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.isVehicleFeaturesDisabled()); + this.lookupReference('toolbarDriversButton').setHidden(Traccar.app.isVehicleFeaturesDisabled() || + Traccar.app.getBooleanAttributePreference('ui.disableDrivers')); + this.lookupReference('toolbarAttributesButton').setHidden( + Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes')); setInterval(function () { self.getView().getView().refresh(); diff --git a/web/app/view/edit/GroupsController.js b/web/app/view/edit/GroupsController.js index 941f5f18..f1da19ce 100644 --- a/web/app/view/edit/GroupsController.js +++ b/web/app/view/edit/GroupsController.js @@ -33,7 +33,10 @@ Ext.define('Traccar.view.edit.GroupsController', { removeTitle: Strings.groupDialog, init: function () { - this.lookupReference('toolbarDriversButton').setHidden(Traccar.app.isVehicleFeaturesDisabled()); + this.lookupReference('toolbarDriversButton').setHidden(Traccar.app.isVehicleFeaturesDisabled() || + Traccar.app.getBooleanAttributePreference('ui.disableDrivers')); + this.lookupReference('toolbarAttributesButton').setHidden( + Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes')); }, onGeofencesClick: function () { diff --git a/web/app/view/edit/UsersController.js b/web/app/view/edit/UsersController.js index fb7a36e2..1e7238a9 100644 --- a/web/app/view/edit/UsersController.js +++ b/web/app/view/edit/UsersController.js @@ -41,6 +41,10 @@ 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.isVehicleFeaturesDisabled() || + Traccar.app.getBooleanAttributePreference('ui.disableDrivers')); + this.lookupReference('userAttributesButton').setHidden( + Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes')); }, onEditClick: function () { diff --git a/web/l10n/en.json b/web/l10n/en.json index 6ea54105..8eba834c 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -90,6 +90,8 @@ "attributeMailSmtpPassword": "Mail: SMTP Password", "attributeUiDisableReport": "UI: Disable Report", "attributeUiDisableVehicleFetures": "UI: Disable Vehicle Fetures", + "attributeUiDisableDrivers": "UI: Disable Drivers", + "attributeUiDisableComputedAttributes": "UI: Disable Computed Attributes", "errorTitle": "Error", "errorGeneral": "Invalid parameters or constraints violation", "errorConnection": "Connection error", -- cgit v1.2.3 From 01af5f520e24a33d7e22523d8ed11e9f14a19516 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Mon, 14 Aug 2017 12:26:02 +0500 Subject: Implement disable Calendars --- web/app/store/ServerAttributes.js | 4 ++++ web/app/store/UserAttributes.js | 4 ++++ web/app/view/SettingsMenuController.js | 3 ++- web/app/view/dialog/Geofence.js | 1 + web/app/view/dialog/GeofenceController.js | 5 +++++ web/app/view/edit/UsersController.js | 2 ++ web/l10n/en.json | 1 + 7 files changed, 19 insertions(+), 1 deletion(-) (limited to 'web/app/view') diff --git a/web/app/store/ServerAttributes.js b/web/app/store/ServerAttributes.js index f4e2a848..109b09e0 100644 --- a/web/app/store/ServerAttributes.js +++ b/web/app/store/ServerAttributes.js @@ -63,5 +63,9 @@ Ext.define('Traccar.store.ServerAttributes', { key: 'ui.disableComputedAttributes', name: Strings.attributeUiDisableComputedAttributes, valueType: 'boolean' + }, { + key: 'ui.disableCalendars', + name: Strings.attributeUiDisableCalendars, + valueType: 'boolean' }] }); diff --git a/web/app/store/UserAttributes.js b/web/app/store/UserAttributes.js index dbee1ed8..a004a54d 100644 --- a/web/app/store/UserAttributes.js +++ b/web/app/store/UserAttributes.js @@ -95,5 +95,9 @@ Ext.define('Traccar.store.UserAttributes', { key: 'ui.disableComputedAttributes', name: Strings.attributeUiDisableComputedAttributes, valueType: 'boolean' + }, { + key: 'ui.disableCalendars', + name: Strings.attributeUiDisableCalendars, + valueType: 'boolean' }] }); diff --git a/web/app/view/SettingsMenuController.js b/web/app/view/SettingsMenuController.js index cc17ca3a..f459da7a 100644 --- a/web/app/view/SettingsMenuController.js +++ b/web/app/view/SettingsMenuController.js @@ -55,7 +55,8 @@ 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('settingsCalendarsButton').setHidden( + Traccar.app.getBooleanAttributePreference('ui.disableCalendars')); this.lookupReference('settingsDriversButton').setHidden(Traccar.app.isVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableDrivers')); } 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..2f96987d 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/edit/UsersController.js b/web/app/view/edit/UsersController.js index 1e7238a9..42fc0cd9 100644 --- a/web/app/view/edit/UsersController.js +++ b/web/app/view/edit/UsersController.js @@ -45,6 +45,8 @@ Ext.define('Traccar.view.edit.UsersController', { 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/l10n/en.json b/web/l10n/en.json index 8eba834c..69df1563 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -92,6 +92,7 @@ "attributeUiDisableVehicleFetures": "UI: Disable Vehicle Fetures", "attributeUiDisableDrivers": "UI: Disable Drivers", "attributeUiDisableComputedAttributes": "UI: Disable Computed Attributes", + "attributeUiDisableCalendars": "UI: Disable Calendars", "errorTitle": "Error", "errorGeneral": "Invalid parameters or constraints violation", "errorConnection": "Connection error", -- cgit v1.2.3 From 3c2a5c249d2a0cec1d5c371efcd1dfcf7e8c7f2e Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 18 Aug 2017 11:22:48 +1200 Subject: Fix various style issues --- web/.eslintignore | 3 +- web/app/AttributeFormatter.js | 62 ++++++++++++------------- web/app/DeviceImages.js | 4 +- web/app/GeofenceConverter.js | 14 +++--- web/app/controller/Root.js | 8 +++- web/app/model/Event.js | 6 +-- web/app/store/AllNotifications.js | 5 +- web/app/store/AllTimezones.js | 2 +- web/app/store/CommandTypes.js | 2 +- web/app/store/Notifications.js | 5 +- web/app/store/PositionAttributes.js | 12 ++--- web/app/view/ArrayListFilter.js | 6 +-- web/app/view/CustomNumberField.js | 2 +- web/app/view/EventsController.js | 6 +-- web/app/view/MainController.js | 2 +- web/app/view/NotificationsController.js | 2 +- web/app/view/ReportController.js | 10 ++-- web/app/view/SettingsMenuController.js | 2 +- web/app/view/StateController.js | 17 ++++--- web/app/view/dialog/CalendarController.js | 2 +- web/app/view/dialog/CommandController.js | 2 + web/app/view/dialog/LoginController.js | 10 ++-- web/app/view/dialog/MapPickerController.js | 2 +- web/app/view/edit/AttributeAliasesController.js | 8 ++-- web/app/view/edit/Attributes.js | 2 +- web/app/view/edit/Devices.js | 4 +- web/app/view/edit/DevicesController.js | 4 +- web/app/view/map/BaseMap.js | 10 ++-- web/app/view/map/MapController.js | 8 ++-- web/app/view/map/MapMarkerController.js | 28 +++++------ web/app/view/permissions/BaseController.js | 8 ++-- 31 files changed, 129 insertions(+), 129 deletions(-) (limited to 'web/app/view') diff --git a/web/.eslintignore b/web/.eslintignore index 3e0fc5c5..d40ab12b 100644 --- a/web/.eslintignore +++ b/web/.eslintignore @@ -1 +1,2 @@ -simple/app.js \ No newline at end of file +simple/app.js +load.js diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js index 2d394f57..87689a28 100644 --- a/web/app/AttributeFormatter.js +++ b/web/app/AttributeFormatter.js @@ -23,6 +23,7 @@ Ext.define('Traccar.AttributeFormatter', { if (value !== undefined) { return Number(value.toFixed(precision)) + ' ' + suffix; } + return null; }; }, @@ -54,8 +55,8 @@ Ext.define('Traccar.AttributeFormatter', { durationFormatter: function (value) { var hours, minutes; hours = Math.floor(value / 3600000); - minutes = Math.round((value % 3600000) / 60000); - return (hours + ' ' + Strings.sharedHourAbbreviation + ' ' + minutes + ' ' + Strings.sharedMinuteAbbreviation); + minutes = Math.round(value % 3600000 / 60000); + return hours + ' ' + Strings.sharedHourAbbreviation + ' ' + minutes + ' ' + Strings.sharedMinuteAbbreviation; }, deviceIdFormatter: function (value) { @@ -72,6 +73,7 @@ Ext.define('Traccar.AttributeFormatter', { group = store.getById(value); return group ? group.get('name') : value; } + return null; }, geofenceIdFormatter: function (value) { @@ -84,6 +86,7 @@ Ext.define('Traccar.AttributeFormatter', { geofence = store.getById(value); return geofence ? geofence.get('name') : ''; } + return null; }, driverUniqueIdFormatter: function (value) { @@ -96,11 +99,11 @@ Ext.define('Traccar.AttributeFormatter', { driver = store.findRecord('uniqueId', value, 0, false, true, true); return driver ? value + ' (' + driver.get('name') + ')' : value; } + return null; }, lastUpdateFormatter: function (value) { var seconds, interval; - if (value) { seconds = Math.floor((new Date() - value) / 1000); if (seconds < 0) { @@ -116,6 +119,7 @@ Ext.define('Traccar.AttributeFormatter', { } return Math.floor(seconds / 60) + ' ' + Strings.sharedMinutes; } + return null; }, defaultFormatter: function (value) { @@ -180,26 +184,24 @@ Ext.define('Traccar.AttributeFormatter', { var dataType = Ext.getStore('PositionAttributes').getAttributeDataType(key); if (!dataType) { return this.defaultFormatter; + } else if (dataType === 'distance') { + return this.distanceFormatter; + } else if (dataType === 'speed') { + return this.speedFormatter; + } else if (dataType === 'driverUniqueId') { + return this.driverUniqueIdFormatter; + } else if (dataType === 'voltage') { + return this.numberFormatterFactory(Traccar.Style.numberPrecision, Strings.sharedVoltAbbreviation); + } else if (dataType === 'percentage') { + return this.numberFormatterFactory(Traccar.Style.numberPrecision, '%'); + } else if (dataType === 'temperature') { + return this.numberFormatterFactory(Traccar.Style.numberPrecision, '°C'); + } else if (dataType === 'volume') { + return this.numberFormatterFactory(Traccar.Style.numberPrecision, Strings.sharedLiterAbbreviation); + } else if (dataType === 'consumption') { + return this.numberFormatterFactory(Traccar.Style.numberPrecision, Strings.sharedLiterPerHourAbbreviation); } else { - if (dataType === 'distance') { - return this.distanceFormatter; - } else if (dataType === 'speed') { - return this.speedFormatter; - } else if (dataType === 'driverUniqueId') { - return this.driverUniqueIdFormatter; - } else if (dataType === 'voltage') { - return this.numberFormatterFactory(Traccar.Style.numberPrecision, Strings.sharedVoltAbbreviation); - } else if (dataType === 'percentage') { - return this.numberFormatterFactory(Traccar.Style.numberPrecision, '%'); - } else if (dataType === 'temperature') { - return this.numberFormatterFactory(Traccar.Style.numberPrecision, '°C'); - } else if (dataType === 'volume') { - return this.numberFormatterFactory(Traccar.Style.numberPrecision, Strings.sharedLiterAbbreviation); - } else if (dataType === 'consumption') { - return this.numberFormatterFactory(Traccar.Style.numberPrecision, Strings.sharedLiterPerHourAbbreviation); - } else { - return this.defaultFormatter; - } + return this.defaultFormatter; } }, @@ -209,16 +211,14 @@ Ext.define('Traccar.AttributeFormatter', { return function (value) { return value; }; + } else if (dataType === 'distance') { + return this.distanceConverter; + } else if (dataType === 'speed') { + return this.speedConverter; } else { - if (dataType === 'distance') { - return this.distanceConverter; - } else if (dataType === 'speed') { - return this.speedConverter; - } else { - return function (value) { - return value; - }; - } + return function (value) { + return value; + }; } } }); diff --git a/web/app/DeviceImages.js b/web/app/DeviceImages.js index e58c4f60..af45ce90 100644 --- a/web/app/DeviceImages.js +++ b/web/app/DeviceImages.js @@ -39,7 +39,7 @@ Ext.define('Traccar.DeviceImages', { svg.getElementById(fill[i]).style.fill = color; } - rotateTransform = 'rotate(' + angle + ' ' + (width / 2) + ' ' + (height / 2) + ')'; + rotateTransform = 'rotate(' + angle + ' ' + width / 2 + ' ' + height / 2 + ')'; svg.getElementById(info.get('rotateId')).setAttribute('transform', rotateTransform); if (zoom) { @@ -85,7 +85,7 @@ Ext.define('Traccar.DeviceImages', { width = parseFloat(svg.documentElement.getAttribute('width')); height = parseFloat(svg.documentElement.getAttribute('height')); - image = new ol.style.Icon({ + image = new ol.style.Icon({ imgSize: [width, height], src: this.formatSrc(svg) }); diff --git a/web/app/GeofenceConverter.js b/web/app/GeofenceConverter.js index 0abefbce..4891e7b1 100644 --- a/web/app/GeofenceConverter.js +++ b/web/app/GeofenceConverter.js @@ -19,10 +19,10 @@ Ext.define('Traccar.GeofenceConverter', { singleton: true, wktToGeometry: function (mapView, wkt) { - var geometry, projection, resolutionAtEquator, pointResolution, resolutionFactor, points = [], center, radius, - content, i, lat, lon, coordinates; + var geometry, projection, resolutionAtEquator, pointResolution, resolutionFactor, + points = [], center, radius, content, i, lat, lon, coordinates; if (wkt.lastIndexOf('POLYGON', 0) === 0) { - content = wkt.match(/\([^\(\)]+\)/); + content = wkt.match(/\([^()]+\)/); if (content !== null) { coordinates = content[0].match(/-?\d+\.?\d*/g); if (coordinates !== null) { @@ -36,7 +36,7 @@ Ext.define('Traccar.GeofenceConverter', { } } } else if (wkt.lastIndexOf('CIRCLE', 0) === 0) { - content = wkt.match(/\([^\(\)]+\)/); + content = wkt.match(/\([^()]+\)/); if (content !== null) { coordinates = content[0].match(/-?\d+\.?\d*/g); if (coordinates !== null) { @@ -45,12 +45,12 @@ Ext.define('Traccar.GeofenceConverter', { resolutionAtEquator = mapView.getResolution(); pointResolution = ol.proj.getPointResolution(projection, resolutionAtEquator, center); resolutionFactor = resolutionAtEquator / pointResolution; - radius = (Number(coordinates[2]) / ol.proj.METERS_PER_UNIT.m) * resolutionFactor; + radius = Number(coordinates[2]) / ol.proj.METERS_PER_UNIT.m * resolutionFactor; geometry = new ol.geom.Circle(center, radius); } } } else if (wkt.lastIndexOf('LINESTRING', 0) === 0) { - content = wkt.match(/\([^\(\)]+\)/); + content = wkt.match(/\([^()]+\)/); if (content !== null) { coordinates = content[0].match(/-?\d+\.?\d*/g); if (coordinates !== null) { @@ -79,7 +79,7 @@ Ext.define('Traccar.GeofenceConverter', { ol.proj.transform(edgeCoordinate, projection, 'EPSG:4326')); result = 'CIRCLE ('; result += center[1] + ' ' + center[0] + ', '; - result += Number((groundRadius).toFixed(1)) + ')'; + result += groundRadius.toFixed(1) + ')'; } else if (geometry instanceof ol.geom.Polygon) { geometry.transform(projection, 'EPSG:4326'); points = geometry.getCoordinates(); diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js index baba68a1..92620115 100644 --- a/web/app/controller/Root.js +++ b/web/app/controller/Root.js @@ -52,6 +52,7 @@ Ext.define('Traccar.controller.Root', { if (value !== undefined) { return Traccar.AttributeFormatter.getAttributeConverter(this.attributeKey)(value); } + return null; }, onLaunch: function () { @@ -162,7 +163,7 @@ Ext.define('Traccar.controller.Root', { pathname = window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/') + 1); socket = new WebSocket(protocol + '//' + window.location.host + pathname + 'api/socket'); - socket.onclose = function (event) { + socket.onclose = function () { Traccar.app.showToast(Strings.errorSocket, Strings.errorTitle); Ext.Ajax.request({ @@ -291,7 +292,10 @@ Ext.define('Traccar.controller.Root', { if (success) { for (i = 0; i < records.length; i++) { value = records[i].get('type'); - store.add({type: value, name: Traccar.app.getEventString(value)}); + store.add({ + type: value, + name: Traccar.app.getEventString(value) + }); } } } diff --git a/web/app/model/Event.js b/web/app/model/Event.js index 9455b0dd..966cd607 100644 --- a/web/app/model/Event.js +++ b/web/app/model/Event.js @@ -52,15 +52,15 @@ Ext.define('Traccar.model.Event', { } else if (rec.get('type') === 'textMessage') { text = Strings.eventTextMessage + ': ' + rec.get('attributes')['message']; } else if (rec.get('type') === 'driverChanged') { - text = Strings.eventDriverChanged + ': ' + Traccar.AttributeFormatter.driverUniqueIdFormatter( - rec.get('attributes')['driverUniqueId']); + text = Strings.eventDriverChanged + ': ' + + Traccar.AttributeFormatter.driverUniqueIdFormatter(rec.get('attributes')['driverUniqueId']); } else { text = Traccar.app.getEventString(rec.get('type')); } if (rec.get('geofenceId')) { geofence = Ext.getStore('Geofences').getById(rec.get('geofenceId')); if (geofence) { - text += ' \"' + geofence.get('name') + '"'; + text += ' "' + geofence.get('name') + '"'; } } return text; diff --git a/web/app/store/AllNotifications.js b/web/app/store/AllNotifications.js index f25aebc4..61aa75ab 100644 --- a/web/app/store/AllNotifications.js +++ b/web/app/store/AllNotifications.js @@ -27,5 +27,8 @@ Ext.define('Traccar.store.AllNotifications', { } }, sortOnLoad: true, - sorters: { property: 'type', direction : 'ASC' } + sorters: { + property: 'type', + direction: 'ASC' + } }); diff --git a/web/app/store/AllTimezones.js b/web/app/store/AllTimezones.js index e5a861b6..2a7fa371 100644 --- a/web/app/store/AllTimezones.js +++ b/web/app/store/AllTimezones.js @@ -21,7 +21,7 @@ Ext.define('Traccar.store.AllTimezones', { sorters: { property: 'key', - direction : 'ASC' + direction: 'ASC' }, data: [{ diff --git a/web/app/store/CommandTypes.js b/web/app/store/CommandTypes.js index 445f937d..a14dd58e 100644 --- a/web/app/store/CommandTypes.js +++ b/web/app/store/CommandTypes.js @@ -41,7 +41,7 @@ Ext.define('Traccar.store.CommandTypes', { } }, listeners: { - 'exception' : function (proxy, response) { + 'exception': function (proxy, response) { Traccar.app.showError(response); } } diff --git a/web/app/store/Notifications.js b/web/app/store/Notifications.js index d79702fc..a672fd43 100644 --- a/web/app/store/Notifications.js +++ b/web/app/store/Notifications.js @@ -24,5 +24,8 @@ Ext.define('Traccar.store.Notifications', { url: 'api/users/notifications' }, sortOnLoad: true, - sorters: { property: 'type', direction : 'ASC' } + sorters: { + property: 'type', + direction: 'ASC' + } }); diff --git a/web/app/store/PositionAttributes.js b/web/app/store/PositionAttributes.js index c3d6d180..e457dafc 100644 --- a/web/app/store/PositionAttributes.js +++ b/web/app/store/PositionAttributes.js @@ -240,14 +240,12 @@ Ext.define('Traccar.store.PositionAttributes', { var model = this.getById(key); if (model) { return model.get('name'); + } else if (capitalize) { + return key.replace(/^./, function (match) { + return match.toUpperCase(); + }); } else { - if (capitalize) { - return key.replace(/^./, function (match) { - return match.toUpperCase(); - }); - } else { - return key; - } + return key; } }, 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') + ''; + config.afterSubTpl = this.unitEl + Ext.getStore('DistanceUnits').findRecord('key', unit).get('name') + ''; 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..1a2fe914 100644 --- a/web/app/view/MainController.js +++ b/web/app/view/MainController.js @@ -21,6 +21,6 @@ Ext.define('Traccar.view.MainController', { init: function () { this.lookupReference('reportView').setHidden( - Traccar.app.getAttributePreference('ui.disableReport', false).toString() === 'true'); + Traccar.app.getAttributePreference('ui.disableReport', false).toString() === 'true'); } }); 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..4d2c9b3d 100644 --- a/web/app/view/ReportController.js +++ b/web/app/view/ReportController.js @@ -117,7 +117,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 +204,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 +281,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..d435e35b 100644 --- a/web/app/view/SettingsMenuController.js +++ b/web/app/view/SettingsMenuController.js @@ -58,7 +58,7 @@ Ext.define('Traccar.view.SettingsMenuController', { this.lookupReference('settingsCalendarsButton').setHidden(false); this.lookupReference('settingsDriversButton').setHidden(false); } - if (admin || (!deviceReadonly && !readonly)) { + if (admin || !deviceReadonly && !readonly) { this.lookupReference('settingsAttributeAliasesButton').setHidden(false); this.lookupReference('settingsComputedAttributesButton').setHidden(false); } 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..54dc7a3b 100644 --- a/web/app/view/dialog/CalendarController.js +++ b/web/app/view/dialog/CalendarController.js @@ -26,7 +26,7 @@ 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)))); + btoa(String.fromCharCode.apply(null, new Uint8Array(event.target.result)))); }; reader.onerror = function (event) { Traccar.app.showError(event.target.error); 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/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/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..6de24983 100644 --- a/web/app/view/edit/DevicesController.js +++ b/web/app/view/edit/DevicesController.js @@ -151,7 +151,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 +163,7 @@ Ext.define('Traccar.view.edit.DevicesController', { } }, - onUpdateDevice: function (store, data) { + onUpdateDevice: function () { this.updateButtons(this.getView().getSelectionModel()); }, diff --git a/web/app/view/map/BaseMap.js b/web/app/view/map/BaseMap.js index c4297f68..5829cac9 100644 --- a/web/app/view/map/BaseMap.js +++ b/web/app/view/map/BaseMap.js @@ -95,10 +95,10 @@ Ext.define('Traccar.view.map.BaseMap', { index = index < 0 ? index + urlsLength : index; if (x < 0) { - x = 'M' + (-x); + x = 'M' + -x; } if (y < 0) { - y = 'M' + (-y); + 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); @@ -171,7 +171,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) { @@ -187,7 +187,7 @@ Ext.define('Traccar.view.map.BaseMap', { return !layer.get('name'); } })) { - this.map.forEachFeatureAtPixel(e.pixel, function (feature, layer) { + this.map.forEachFeatureAtPixel(e.pixel, function (feature) { this.fireEvent('selectfeature', feature); }.bind(this)); } else { @@ -206,9 +206,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..d8d2f045 100644 --- a/web/app/view/map/MapController.js +++ b/web/app/view/map/MapController.js @@ -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 24742ff9..d3b813b2 100644 --- a/web/app/view/map/MapMarkerController.js +++ b/web/app/view/map/MapMarkerController.js @@ -211,7 +211,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); @@ -252,8 +252,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')); @@ -405,7 +405,7 @@ Ext.define('Traccar.view.map.MapMarkerController', { width: Traccar.Style.mapTextStrokeWidth }), offsetY: -image.getSize()[1] / 2 - Traccar.Style.mapTextOffset, - font : Traccar.Style.mapTextFont + font: Traccar.Style.mapTextFont }) }); }, @@ -420,10 +420,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); @@ -431,18 +429,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); @@ -599,7 +593,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(); -- cgit v1.2.3 From 7f290bf996e6a91b1c5d2b5d74318f9c7a246d75 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Fri, 18 Aug 2017 09:08:25 +0500 Subject: Optimize calendar load --- web/app/view/dialog/CalendarController.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/dialog/CalendarController.js b/web/app/view/dialog/CalendarController.js index 54dc7a3b..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]); } } }); -- cgit v1.2.3 From a2f24e445ef4c4c06a754b4538d51aec38e1dcbf Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Fri, 18 Aug 2017 13:53:13 +0500 Subject: Update openlayers to 4.3.1 --- web/app/view/map/BaseMap.js | 11 ++++++----- web/load.js | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/map/BaseMap.js b/web/app/view/map/BaseMap.js index 5829cac9..91f37841 100644 --- a/web/app/view/map/BaseMap.js +++ b/web/app/view/map/BaseMap.js @@ -182,14 +182,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) { - this.fireEvent('selectfeature', feature); - }.bind(this)); + }); + if (features) { + for (i = 0; i < features.length; i++) { + this.fireEvent('selectfeature', features[i]); + } } else { this.fireEvent('deselectfeature'); } diff --git a/web/load.js b/web/load.js index 1845cd13..85772805 100644 --- a/web/load.js +++ b/web/load.js @@ -136,7 +136,7 @@ extjsVersion = '6.2.0'; fontAwesomeVersion = '4.7.0'; - olVersion = '4.2.0'; + olVersion = '4.3.1'; proj4jsVersion = '2.4.3'; if (debugMode) { -- cgit v1.2.3 From d1d7d230a0262d9f6ae05f1c4c6718699edb8de3 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Fri, 18 Aug 2017 13:56:46 +0500 Subject: Fix style --- web/app/view/SettingsMenuController.js | 4 ++-- web/app/view/dialog/GeofenceController.js | 2 +- web/app/view/edit/DevicesController.js | 2 +- web/app/view/edit/GroupsController.js | 2 +- web/app/view/edit/UsersController.js | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/SettingsMenuController.js b/web/app/view/SettingsMenuController.js index 54543358..7985700a 100644 --- a/web/app/view/SettingsMenuController.js +++ b/web/app/view/SettingsMenuController.js @@ -56,14 +56,14 @@ Ext.define('Traccar.view.SettingsMenuController', { this.lookupReference('settingsGeofencesButton').setHidden(false); this.lookupReference('settingsNotificationsButton').setHidden(false); this.lookupReference('settingsCalendarsButton').setHidden( - Traccar.app.getBooleanAttributePreference('ui.disableCalendars')); + Traccar.app.getBooleanAttributePreference('ui.disableCalendars')); this.lookupReference('settingsDriversButton').setHidden(Traccar.app.isVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableDrivers')); } if (admin || !deviceReadonly && !readonly) { this.lookupReference('settingsAttributeAliasesButton').setHidden(false); this.lookupReference('settingsComputedAttributesButton').setHidden( - Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes')); + Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes')); } }, diff --git a/web/app/view/dialog/GeofenceController.js b/web/app/view/dialog/GeofenceController.js index 2f96987d..e4ac5a2e 100644 --- a/web/app/view/dialog/GeofenceController.js +++ b/web/app/view/dialog/GeofenceController.js @@ -36,7 +36,7 @@ Ext.define('Traccar.view.dialog.GeofenceController', { init: function () { this.lookupReference('calendarCombo').setHidden( - Traccar.app.getBooleanAttributePreference('ui.disableCalendars')); + Traccar.app.getBooleanAttributePreference('ui.disableCalendars')); }, saveArea: function (value) { diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js index ffe9c9af..9616dbd2 100644 --- a/web/app/view/edit/DevicesController.js +++ b/web/app/view/edit/DevicesController.js @@ -64,7 +64,7 @@ Ext.define('Traccar.view.edit.DevicesController', { this.lookupReference('toolbarDriversButton').setHidden(Traccar.app.isVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableDrivers')); this.lookupReference('toolbarAttributesButton').setHidden( - Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes')); + Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes')); setInterval(function () { self.getView().getView().refresh(); diff --git a/web/app/view/edit/GroupsController.js b/web/app/view/edit/GroupsController.js index f1da19ce..d40c1e69 100644 --- a/web/app/view/edit/GroupsController.js +++ b/web/app/view/edit/GroupsController.js @@ -36,7 +36,7 @@ Ext.define('Traccar.view.edit.GroupsController', { this.lookupReference('toolbarDriversButton').setHidden(Traccar.app.isVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableDrivers')); this.lookupReference('toolbarAttributesButton').setHidden( - Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes')); + Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes')); }, onGeofencesClick: function () { diff --git a/web/app/view/edit/UsersController.js b/web/app/view/edit/UsersController.js index 42fc0cd9..8da5caa9 100644 --- a/web/app/view/edit/UsersController.js +++ b/web/app/view/edit/UsersController.js @@ -44,9 +44,9 @@ Ext.define('Traccar.view.edit.UsersController', { this.lookupReference('userDriversButton').setHidden(Traccar.app.isVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableDrivers')); this.lookupReference('userAttributesButton').setHidden( - Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes')); + Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes')); this.lookupReference('userCalendarsButton').setHidden( - Traccar.app.getBooleanAttributePreference('ui.disableCalendars')); + Traccar.app.getBooleanAttributePreference('ui.disableCalendars')); }, onEditClick: function () { -- cgit v1.2.3 From f26159a40b3b23fbd63de312f121b1fe1bf64bd1 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Fri, 18 Aug 2017 15:40:39 +0500 Subject: - Detach common known attributes - Rename function --- web/app/Application.js | 4 ++- web/app/controller/Root.js | 7 ++++ web/app/store/CommonDeviceAttributes.js | 42 +++++++++++++++++++++++ web/app/store/CommonUserAttributes.js | 55 +++++++++++++++++++++++++++++++ web/app/store/DeviceAttributes.js | 20 ----------- web/app/store/GroupAttributes.js | 20 ----------- web/app/store/ServerAttributes.js | 50 +--------------------------- web/app/store/UserAttributes.js | 33 ------------------- web/app/view/ReportController.js | 2 +- web/app/view/SettingsMenuController.js | 6 ++-- web/app/view/edit/AttributesController.js | 1 + web/app/view/edit/DevicesController.js | 4 +-- web/app/view/edit/GroupsController.js | 4 +-- web/app/view/edit/UsersController.js | 4 +-- web/app/view/map/MapController.js | 4 +-- 15 files changed, 121 insertions(+), 135 deletions(-) create mode 100644 web/app/store/CommonDeviceAttributes.js create mode 100644 web/app/store/CommonUserAttributes.js (limited to 'web/app/view') diff --git a/web/app/Application.js b/web/app/Application.js index 3cee7b78..e0f0aa45 100644 --- a/web/app/Application.js +++ b/web/app/Application.js @@ -83,10 +83,12 @@ Ext.define('Traccar.Application', { 'AllTimezones', 'VisibleDevices', 'DeviceStatuses', + 'CommonDeviceAttributes', 'DeviceAttributes', 'GeofenceAttributes', 'GroupAttributes', 'ServerAttributes', + 'CommonUserAttributes', 'UserAttributes', 'ComputedAttributes', 'AllComputedAttributes', @@ -104,7 +106,7 @@ Ext.define('Traccar.Application', { return window.matchMedia && window.matchMedia('(max-width: 768px)').matches; }, - isVehicleFeaturesDisabled: function () { + getVehicleFeaturesDisabled: function () { return this.getBooleanAttributePreference('ui.disableVehicleFetures'); }, diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js index 92620115..1c70dd03 100644 --- a/web/app/controller/Root.js +++ b/web/app/controller/Root.js @@ -113,6 +113,13 @@ Ext.define('Traccar.controller.Root', { Ext.getStore('AttributeAliases').load(); Ext.getStore('ComputedAttributes').load(); this.initReportEventTypesStore(); + + Ext.getStore('ServerAttributes').loadData(Ext.getStore('CommonDeviceAttributes').getData().items, true); + Ext.getStore('ServerAttributes').loadData(Ext.getStore('CommonUserAttributes').getData().items, true); + Ext.getStore('UserAttributes').loadData(Ext.getStore('CommonUserAttributes').getData().items, true); + Ext.getStore('DeviceAttributes').loadData(Ext.getStore('CommonDeviceAttributes').getData().items, true); + Ext.getStore('GroupAttributes').loadData(Ext.getStore('CommonDeviceAttributes').getData().items, true); + Ext.getStore('Devices').load({ scope: this, callback: function () { diff --git a/web/app/store/CommonDeviceAttributes.js b/web/app/store/CommonDeviceAttributes.js new file mode 100644 index 00000000..83dd4114 --- /dev/null +++ b/web/app/store/CommonDeviceAttributes.js @@ -0,0 +1,42 @@ +/* + * Copyright 2017 Anton Tananaev (anton@traccar.org) + * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +Ext.define('Traccar.store.CommonDeviceAttributes', { + extend: 'Ext.data.Store', + model: 'Traccar.model.KnownAttribute', + + data: [{ + key: 'speedLimit', + name: Strings.attributeSpeedLimit, + valueType: 'number', + dataType: 'speed' + }, { + key: 'report.ignoreOdometer', + name: Strings.attributeReportIgnoreOdometer, + valueType: 'boolean' + }, { + key: 'maintenance.start', + name: Strings.attributeMaintenanceStart, + valueType: 'number', + dataType: 'distance' + }, { + key: 'maintenance.interval', + name: Strings.attributeMaintenanceInterval, + valueType: 'number', + dataType: 'distance' + }] +}); diff --git a/web/app/store/CommonUserAttributes.js b/web/app/store/CommonUserAttributes.js new file mode 100644 index 00000000..85d652df --- /dev/null +++ b/web/app/store/CommonUserAttributes.js @@ -0,0 +1,55 @@ +/* + * Copyright 2017 Anton Tananaev (anton@traccar.org) + * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +Ext.define('Traccar.store.CommonUserAttributes', { + extend: 'Ext.data.Store', + model: 'Traccar.model.KnownAttribute', + + data: [{ + key: 'web.liveRouteLength', + name: Strings.attributeWebLiveRouteLength, + valueType: 'number', + allowDecimals: false + }, { + key: 'web.selectZoom', + name: Strings.attributeWebSelectZoom, + valueType: 'number', + allowDecimals: false, + minValue: Traccar.Style.mapDefaultZoom, + maxValue: Traccar.Style.mapMaxZoom + }, { + key: 'ui.disableReport', + name: Strings.attributeUiDisableReport, + valueType: 'boolean' + }, { + key: 'ui.disableVehicleFetures', + name: Strings.attributeUiDisableVehicleFetures, + valueType: 'boolean' + }, { + key: 'ui.disableDrivers', + name: Strings.attributeUiDisableDrivers, + valueType: 'boolean' + }, { + key: 'ui.disableComputedAttributes', + name: Strings.attributeUiDisableComputedAttributes, + valueType: 'boolean' + }, { + key: 'ui.disableCalendars', + name: Strings.attributeUiDisableCalendars, + valueType: 'boolean' + }] +}); diff --git a/web/app/store/DeviceAttributes.js b/web/app/store/DeviceAttributes.js index 220f9a5b..4b1d9204 100644 --- a/web/app/store/DeviceAttributes.js +++ b/web/app/store/DeviceAttributes.js @@ -18,28 +18,8 @@ Ext.define('Traccar.store.DeviceAttributes', { extend: 'Ext.data.Store', model: 'Traccar.model.KnownAttribute', - proxy: 'memory', data: [{ - key: 'speedLimit', - name: Strings.attributeSpeedLimit, - valueType: 'number', - dataType: 'speed' - }, { - key: 'report.ignoreOdometer', - name: Strings.attributeReportIgnoreOdometer, - valueType: 'boolean' - }, { - key: 'maintenance.start', - name: Strings.attributeMaintenanceStart, - valueType: 'number', - dataType: 'distance' - }, { - key: 'maintenance.interval', - name: Strings.attributeMaintenanceInterval, - valueType: 'number', - dataType: 'distance' - }, { key: 'web.reportColor', name: Strings.attributeWebReportColor, valueType: 'color' diff --git a/web/app/store/GroupAttributes.js b/web/app/store/GroupAttributes.js index 2a2765f5..9389db1c 100644 --- a/web/app/store/GroupAttributes.js +++ b/web/app/store/GroupAttributes.js @@ -18,28 +18,8 @@ Ext.define('Traccar.store.GroupAttributes', { extend: 'Ext.data.Store', model: 'Traccar.model.KnownAttribute', - proxy: 'memory', data: [{ - key: 'speedLimit', - name: Strings.attributeSpeedLimit, - valueType: 'number', - dataType: 'speed' - }, { - key: 'report.ignoreOdometer', - name: Strings.attributeReportIgnoreOdometer, - valueType: 'boolean' - }, { - key: 'maintenance.start', - name: Strings.attributeMaintenanceStart, - valueType: 'number', - dataType: 'distance' - }, { - key: 'maintenance.interval', - name: Strings.attributeMaintenanceInterval, - valueType: 'number', - dataType: 'distance' - }, { key: 'processing.copyAttributes', name: Strings.attributeProcessingCopyAttributes, valueType: 'string' diff --git a/web/app/store/ServerAttributes.js b/web/app/store/ServerAttributes.js index 109b09e0..204f885b 100644 --- a/web/app/store/ServerAttributes.js +++ b/web/app/store/ServerAttributes.js @@ -18,54 +18,6 @@ Ext.define('Traccar.store.ServerAttributes', { extend: 'Ext.data.Store', model: 'Traccar.model.KnownAttribute', - proxy: 'memory', - data: [{ - key: 'speedLimit', - name: Strings.attributeSpeedLimit, - valueType: 'number', - dataType: 'speed' - }, { - key: 'maintenance.start', - name: Strings.attributeMaintenanceStart, - valueType: 'number', - dataType: 'distance' - }, { - key: 'maintenance.interval', - name: Strings.attributeMaintenanceInterval, - valueType: 'number', - dataType: 'distance' - }, { - key: 'web.liveRouteLength', - name: Strings.attributeWebLiveRouteLength, - valueType: 'number', - allowDecimals: false - }, { - key: 'web.selectZoom', - name: Strings.attributeWebSelectZoom, - valueType: 'number', - allowDecimals: false, - minValue: Traccar.Style.mapDefaultZoom, - maxValue: Traccar.Style.mapMaxZoom - }, { - key: 'ui.disableReport', - name: Strings.attributeUiDisableReport, - valueType: 'boolean' - }, { - key: 'ui.disableVehicleFetures', - name: Strings.attributeUiDisableVehicleFetures, - valueType: 'boolean' - }, { - key: 'ui.disableDrivers', - name: Strings.attributeUiDisableDrivers, - valueType: 'boolean' - }, { - key: 'ui.disableComputedAttributes', - name: Strings.attributeUiDisableComputedAttributes, - valueType: 'boolean' - }, { - key: 'ui.disableCalendars', - name: Strings.attributeUiDisableCalendars, - valueType: 'boolean' - }] + data: [] }); diff --git a/web/app/store/UserAttributes.js b/web/app/store/UserAttributes.js index a004a54d..dfe69421 100644 --- a/web/app/store/UserAttributes.js +++ b/web/app/store/UserAttributes.js @@ -18,7 +18,6 @@ Ext.define('Traccar.store.UserAttributes', { extend: 'Ext.data.Store', model: 'Traccar.model.KnownAttribute', - proxy: 'memory', data: [{ key: 'mail.smtp.host', @@ -67,37 +66,5 @@ Ext.define('Traccar.store.UserAttributes', { key: 'mail.smtp.password', name: Strings.attributeMailSmtpPassword, valueType: 'string' - }, { - key: 'web.liveRouteLength', - name: Strings.attributeWebLiveRouteLength, - valueType: 'number', - allowDecimals: false - }, { - key: 'web.selectZoom', - name: Strings.attributeWebSelectZoom, - valueType: 'number', - allowDecimals: false, - minValue: Traccar.Style.mapDefaultZoom, - maxValue: Traccar.Style.mapMaxZoom - }, { - key: 'ui.disableReport', - name: Strings.attributeUiDisableReport, - valueType: 'boolean' - }, { - key: 'ui.disableVehicleFetures', - name: Strings.attributeUiDisableVehicleFetures, - valueType: 'boolean' - }, { - key: 'ui.disableDrivers', - name: Strings.attributeUiDisableDrivers, - valueType: 'boolean' - }, { - key: 'ui.disableComputedAttributes', - name: Strings.attributeUiDisableComputedAttributes, - valueType: 'boolean' - }, { - key: 'ui.disableCalendars', - name: Strings.attributeUiDisableCalendars, - valueType: 'boolean' }] }); diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js index 5c052b50..f9dbc03c 100644 --- a/web/app/view/ReportController.js +++ b/web/app/view/ReportController.js @@ -79,7 +79,7 @@ Ext.define('Traccar.view.ReportController', { hidden: true }); } - if (Traccar.app.isVehicleFeaturesDisabled()) { + 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; diff --git a/web/app/view/SettingsMenuController.js b/web/app/view/SettingsMenuController.js index 7985700a..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(Traccar.app.isVehicleFeaturesDisabled()); + this.lookupReference('settingsDeviceDistanceButton').setHidden(Traccar.app.getVehicleFeaturesDisabled()); } if (admin || manager) { this.lookupReference('settingsUsersButton').setHidden(false); @@ -57,8 +57,8 @@ Ext.define('Traccar.view.SettingsMenuController', { this.lookupReference('settingsNotificationsButton').setHidden(false); this.lookupReference('settingsCalendarsButton').setHidden( Traccar.app.getBooleanAttributePreference('ui.disableCalendars')); - this.lookupReference('settingsDriversButton').setHidden(Traccar.app.isVehicleFeaturesDisabled() || - Traccar.app.getBooleanAttributePreference('ui.disableDrivers')); + this.lookupReference('settingsDriversButton').setHidden( + Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableDrivers')); } if (admin || !deviceReadonly && !readonly) { this.lookupReference('settingsAttributeAliasesButton').setHidden(false); diff --git a/web/app/view/edit/AttributesController.js b/web/app/view/edit/AttributesController.js index 235f2c5b..c12c1968 100644 --- a/web/app/view/edit/AttributesController.js +++ b/web/app/view/edit/AttributesController.js @@ -90,6 +90,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/DevicesController.js b/web/app/view/edit/DevicesController.js index 9616dbd2..df75b1d4 100644 --- a/web/app/view/edit/DevicesController.js +++ b/web/app/view/edit/DevicesController.js @@ -61,8 +61,8 @@ 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.isVehicleFeaturesDisabled() || - Traccar.app.getBooleanAttributePreference('ui.disableDrivers')); + this.lookupReference('toolbarDriversButton').setHidden( + Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableDrivers')); this.lookupReference('toolbarAttributesButton').setHidden( Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes')); diff --git a/web/app/view/edit/GroupsController.js b/web/app/view/edit/GroupsController.js index d40c1e69..be26cc93 100644 --- a/web/app/view/edit/GroupsController.js +++ b/web/app/view/edit/GroupsController.js @@ -33,8 +33,8 @@ Ext.define('Traccar.view.edit.GroupsController', { removeTitle: Strings.groupDialog, init: function () { - this.lookupReference('toolbarDriversButton').setHidden(Traccar.app.isVehicleFeaturesDisabled() || - Traccar.app.getBooleanAttributePreference('ui.disableDrivers')); + this.lookupReference('toolbarDriversButton').setHidden( + Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableDrivers')); this.lookupReference('toolbarAttributesButton').setHidden( Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes')); }, diff --git a/web/app/view/edit/UsersController.js b/web/app/view/edit/UsersController.js index 8da5caa9..d67f5a70 100644 --- a/web/app/view/edit/UsersController.js +++ b/web/app/view/edit/UsersController.js @@ -41,8 +41,8 @@ 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.isVehicleFeaturesDisabled() || - Traccar.app.getBooleanAttributePreference('ui.disableDrivers')); + this.lookupReference('userDriversButton').setHidden( + Traccar.app.isVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableDrivers')); this.lookupReference('userAttributesButton').setHidden( Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes')); this.lookupReference('userCalendarsButton').setHidden( diff --git a/web/app/view/map/MapController.js b/web/app/view/map/MapController.js index d8d2249d..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.getBooleanAttributePreference('ui.disableReport')); + this.lookupReference('showReportsButton').setVisible( + Traccar.app.isMobile() && !Traccar.app.getBooleanAttributePreference('ui.disableReport')); this.lookupReference('showEventsButton').setVisible(Traccar.app.isMobile()); }, -- cgit v1.2.3 From a0bd864d667bdc655a3d01e2ab9f4ec076346319 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 20 Aug 2017 10:28:48 +1200 Subject: Fix method typo --- web/app/view/edit/UsersController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'web/app/view') diff --git a/web/app/view/edit/UsersController.js b/web/app/view/edit/UsersController.js index d67f5a70..3bc7d1c4 100644 --- a/web/app/view/edit/UsersController.js +++ b/web/app/view/edit/UsersController.js @@ -42,7 +42,7 @@ Ext.define('Traccar.view.edit.UsersController', { Ext.getStore('Users').load(); this.lookupReference('userUsersButton').setHidden(!Traccar.app.getUser().get('admin')); this.lookupReference('userDriversButton').setHidden( - Traccar.app.isVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableDrivers')); + Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableDrivers')); this.lookupReference('userAttributesButton').setHidden( Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes')); this.lookupReference('userCalendarsButton').setHidden( -- cgit v1.2.3