diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/app/store/ReportEvents.js | 5 | ||||
-rw-r--r-- | web/app/store/ReportRoute.js | 5 | ||||
-rw-r--r-- | web/app/store/ReportStops.js | 5 | ||||
-rw-r--r-- | web/app/store/ReportSummary.js | 5 | ||||
-rw-r--r-- | web/app/store/ReportTrips.js | 5 | ||||
-rw-r--r-- | web/app/view/map/MapMarkerController.js | 35 |
6 files changed, 43 insertions, 17 deletions
diff --git a/web/app/store/ReportEvents.js b/web/app/store/ReportEvents.js index e0251be6..ca90693d 100644 --- a/web/app/store/ReportEvents.js +++ b/web/app/store/ReportEvents.js @@ -24,6 +24,11 @@ Ext.define('Traccar.store.ReportEvents', { url: 'api/reports/events', headers: { 'Accept': 'application/json' + }, + listeners: { + exception: function (proxy, exception) { + Traccar.app.showError(exception); + } } } }); diff --git a/web/app/store/ReportRoute.js b/web/app/store/ReportRoute.js index 5432bef3..6ee4bbcd 100644 --- a/web/app/store/ReportRoute.js +++ b/web/app/store/ReportRoute.js @@ -24,6 +24,11 @@ Ext.define('Traccar.store.ReportRoute', { url: 'api/reports/route', headers: { 'Accept': 'application/json' + }, + listeners: { + exception: function (proxy, exception) { + Traccar.app.showError(exception); + } } } }); diff --git a/web/app/store/ReportStops.js b/web/app/store/ReportStops.js index 60826b76..9e9ba13e 100644 --- a/web/app/store/ReportStops.js +++ b/web/app/store/ReportStops.js @@ -25,6 +25,11 @@ Ext.define('Traccar.store.ReportStops', { url: 'api/reports/stops', headers: { 'Accept': 'application/json' + }, + listeners: { + exception: function (proxy, exception) { + Traccar.app.showError(exception); + } } } }); diff --git a/web/app/store/ReportSummary.js b/web/app/store/ReportSummary.js index ad30a5f3..4e53d948 100644 --- a/web/app/store/ReportSummary.js +++ b/web/app/store/ReportSummary.js @@ -25,6 +25,11 @@ Ext.define('Traccar.store.ReportSummary', { url: 'api/reports/summary', headers: { 'Accept': 'application/json' + }, + listeners: { + exception: function (proxy, exception) { + Traccar.app.showError(exception); + } } } }); diff --git a/web/app/store/ReportTrips.js b/web/app/store/ReportTrips.js index b369ab2b..d8aa9226 100644 --- a/web/app/store/ReportTrips.js +++ b/web/app/store/ReportTrips.js @@ -25,6 +25,11 @@ Ext.define('Traccar.store.ReportTrips', { url: 'api/reports/trips', headers: { 'Accept': 'application/json' + }, + listeners: { + exception: function (proxy, exception) { + Traccar.app.showError(exception); + } } } }); diff --git a/web/app/view/map/MapMarkerController.js b/web/app/view/map/MapMarkerController.js index df4029d2..24742ff9 100644 --- a/web/app/view/map/MapMarkerController.js +++ b/web/app/view/map/MapMarkerController.js @@ -304,24 +304,25 @@ Ext.define('Traccar.view.map.MapMarkerController', { loadReport: function (store, data) { var i, position, point; - - this.addReportMarkers(store, data); - - this.reportRoute = []; - for (i = 0; i < data.length; i++) { - position = data[i]; - point = ol.proj.fromLonLat([ - position.get('longitude'), - position.get('latitude') - ]); - if (i === 0 || data[i].get('deviceId') !== data[i - 1].get('deviceId')) { - this.reportRoute.push(new ol.Feature({ - geometry: new ol.geom.LineString([]) - })); - this.reportRoute[this.reportRoute.length - 1].setStyle(this.getRouteStyle(data[i].get('deviceId'))); - this.getView().getRouteSource().addFeature(this.reportRoute[this.reportRoute.length - 1]); + if (data) { + this.addReportMarkers(store, data); + + this.reportRoute = []; + for (i = 0; i < data.length; i++) { + position = data[i]; + point = ol.proj.fromLonLat([ + position.get('longitude'), + position.get('latitude') + ]); + if (i === 0 || data[i].get('deviceId') !== data[i - 1].get('deviceId')) { + this.reportRoute.push(new ol.Feature({ + geometry: new ol.geom.LineString([]) + })); + this.reportRoute[this.reportRoute.length - 1].setStyle(this.getRouteStyle(data[i].get('deviceId'))); + this.getView().getRouteSource().addFeature(this.reportRoute[this.reportRoute.length - 1]); + } + this.reportRoute[this.reportRoute.length - 1].getGeometry().appendCoordinate(point); } - this.reportRoute[this.reportRoute.length - 1].getGeometry().appendCoordinate(point); } }, |