From a7bfd5431b73b5d634b769e64483e81815364bca Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Fri, 28 Jul 2017 08:58:54 +0500 Subject: Do not show geofenceId if it is unknown --- web/app/AttributeFormatter.js | 2 +- web/app/view/dialog/SelectDeviceController.js | 2 +- web/app/view/edit/Devices.js | 6 +++--- web/app/view/map/MapMarkerController.js | 7 ++++--- 4 files changed, 9 insertions(+), 8 deletions(-) (limited to 'web') diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js index 47a924a..2d394f5 100644 --- a/web/app/AttributeFormatter.js +++ b/web/app/AttributeFormatter.js @@ -82,7 +82,7 @@ Ext.define('Traccar.AttributeFormatter', { store = Ext.getStore('Geofences'); } geofence = store.getById(value); - return geofence ? geofence.get('name') : value; + return geofence ? geofence.get('name') : ''; } }, diff --git a/web/app/view/dialog/SelectDeviceController.js b/web/app/view/dialog/SelectDeviceController.js index 9ed5e21..9437991 100644 --- a/web/app/view/dialog/SelectDeviceController.js +++ b/web/app/view/dialog/SelectDeviceController.js @@ -25,7 +25,7 @@ Ext.define('Traccar.view.dialog.SelectDeviceController', { deviceId = this.lookupReference('deviceField').getValue(); record = this.getView().record.data; Ext.Ajax.request({ - url: 'api/attributes/computed?deviceId=' + deviceId, + url: 'api/attributes/computed/test?deviceId=' + deviceId, method: 'POST', jsonData: Ext.util.JSON.encode(record), callback: function (options, success, response) { diff --git a/web/app/view/edit/Devices.js b/web/app/view/edit/Devices.js index d5e6d5f..eda8bbd 100644 --- a/web/app/view/edit/Devices.js +++ b/web/app/view/edit/Devices.js @@ -160,11 +160,11 @@ Ext.define('Traccar.view.edit.Devices', { store: 'Geofences' }, renderer: function (value) { - var i, result = ''; + var i, name, result = ''; if (Ext.isArray(value)) { for (i = 0; i < value.length; i++) { - result += Traccar.AttributeFormatter.geofenceIdFormatter(value[i]); - result += (i < value.length - 1) ? ', ' : ''; + name = Traccar.AttributeFormatter.geofenceIdFormatter(value[i]); + result += name ? name + ((i < value.length - 1) ? ', ' : '') : ''; } } return result; diff --git a/web/app/view/map/MapMarkerController.js b/web/app/view/map/MapMarkerController.js index 2f1d91e..df4029d 100644 --- a/web/app/view/map/MapMarkerController.js +++ b/web/app/view/map/MapMarkerController.js @@ -495,11 +495,12 @@ Ext.define('Traccar.view.map.MapMarkerController', { }, selectEvent: function (position) { + var marker; this.fireEvent('deselectfeature'); if (position) { - var maker = this.addReportMarker(position); - maker.set('event', true); - this.selectMarker(maker, true); + marker = this.addReportMarker(position); + marker.set('event', true); + this.selectMarker(marker, true); } else if (this.selectedMarker && this.selectedMarker.get('event')) { this.selectMarker(null, false); } -- cgit v1.2.3 From d15a49e82481381a571c0c2285edd2fc77ccb5ca Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Fri, 28 Jul 2017 09:29:46 +0500 Subject: Unwrap ternary operator --- web/app/view/edit/Devices.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'web') diff --git a/web/app/view/edit/Devices.js b/web/app/view/edit/Devices.js index eda8bbd..c9538c8 100644 --- a/web/app/view/edit/Devices.js +++ b/web/app/view/edit/Devices.js @@ -164,7 +164,9 @@ Ext.define('Traccar.view.edit.Devices', { if (Ext.isArray(value)) { for (i = 0; i < value.length; i++) { name = Traccar.AttributeFormatter.geofenceIdFormatter(value[i]); - result += name ? name + ((i < value.length - 1) ? ', ' : '') : ''; + if (name) { + result += name + ((i < value.length - 1) ? ', ' : ''); + } } } return result; -- cgit v1.2.3