From 10b0a39b04d69fe8d6449c8bbf841b3a46a4ad70 Mon Sep 17 00:00:00 2001 From: ilhangeoksu Date: Sun, 4 Feb 2018 16:53:47 +0100 Subject: [PATCH] bug fix map view, code refactoring --- .../views/components/place/place.component.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/web/angular/src/app/views/components/place/place.component.ts b/web/angular/src/app/views/components/place/place.component.ts index 196e57b..06cd973 100644 --- a/web/angular/src/app/views/components/place/place.component.ts +++ b/web/angular/src/app/views/components/place/place.component.ts @@ -100,9 +100,6 @@ export class PlaceComponent implements OnInit { }).addTo(this.markersLayer).bindPopup("
"+place.nickname+"
"+place.address).openPopup(); } this.map.fitBounds(this.markersLayer.getBounds()); - - console.log("------- place attibutes"); - console.log(this.places); } getVisits(){ @@ -112,12 +109,12 @@ export class PlaceComponent implements OnInit { var duration = (24*60*60*1000); // duration = milliseconds of one day this.apiClientService.getDeviceVisits(this.selectedDevice.id, startDate.getTime(), duration).subscribe(result => { - console.log("visits response"); - console.log(result.body); this.visits = this.groupVisitsOnPlaceId(result.body); - console.log("grouped visits response"); - console.log(this.visits); - this.getPlaces(); + if(this.visits.length == 0){ + this.toastService.showWarning("Warnung","Keine Standortdaten für den ausgewählten Tag/Gerät gefunden"); + }else{ + this.getPlaces(); + } }, error=>{ this.consoleService.log("Error during get visits."); this.helperService.handleError(error); @@ -128,11 +125,10 @@ export class PlaceComponent implements OnInit { Observable.forkJoin( this.visits.map(visit => this.apiClientService.getPlace(visit.place)) ).subscribe(responseList => { - console.log("response list: "); - console.log(responseList); for(let response of responseList){ this.places.push(response.body); } + if(responseList.length == 0) this.setMarkersForPlaces(); }, error => { this.consoleService.log("Error during get places."); @@ -162,6 +158,7 @@ export class PlaceComponent implements OnInit { this.places = []; this.visits = []; this.markersLayer.clearLayers(); + this.map.setZoom(0); } // user methods