Commit 18e682f8 authored by Sebastian's avatar Sebastian

redirect bei dismiss/close von /login, kleiner bugfix beim abholen von geo-elementen

parent 8267d9e5
......@@ -16,6 +16,7 @@ export class AuthComponent implements OnInit {
@Input() asModal: boolean=false;
@Output('closeModal') closeModal:EventEmitter<boolean> = new EventEmitter<boolean>();
private navigated = false;
private username: string;
private password: string;
private message: string;
......@@ -68,16 +69,19 @@ export class AuthComponent implements OnInit {
case 'entryedit':{
this.logger.debug("Redirecting to entryEdit.");
this.router.navigate([this.routeParams['redirectTo'],{id:this.routeParams['id']}]);
this.navigated = true;
break;
}
case 'entrycreate':{
this.logger.debug("Redirecting to entryCreate.");
this.router.navigate([this.routeParams['redirectTo'],{id:this.routeParams['id'],type:this.routeParams['type']}]);
this.navigated = true;
break;
}
default:{
if(this.router.url == '/login'){
this.router.navigate(['home']);
this.navigated = true;
break;
}
}
......@@ -99,15 +103,31 @@ export class AuthComponent implements OnInit {
}
close(){
console.log("close clicked..");
this.modalService.close('Cross click')
if(this.router.url == '/login'){
if(this.router.url.startsWith('/login') && this.navigated == false){
this.router.navigate(['home']);
}
}
ngOnInit() {
console.log("asModal: "+this.asModal);
this.navigated = false;
this.modalService.onDismiss.subscribe(
(closed)=>{
this.router.navigate(['search']);
}
);
}
modalServiceSubscription : any;
ngOnDestroy(){
if(this.modalServiceSubscription != null){
this.modalServiceSubscription.unsubscribe();
}
}
}
......@@ -28,7 +28,8 @@ export class GeoportalApiService {
//private apiURL = 'http://10.0.8.29:8080/geoportal';
private apiURL = 'http://94.130.8.94:18080/geoportal';
private apiURL = 'http://entwicklungssystem.transformationsstadt.de:18080/geoportal';
//private apiURL = 'http://geoportal-api.transformationsstadt.de:8080/geoportal';
//private apiURL = 'http://127.0.0.1:8080/geoportal';
private endpoints: GeoportalApiEndpoint[];
......@@ -153,12 +154,14 @@ export class GeoportalApiService {
let osmType = "";
let osmId = -1;
if(node instanceof OsmNode){
if(node.osmType == "way"){
osmType = "ways";
}
if(node.osmType == "node"){
osmType = "nodes";
}
osmId = (node.osmId);
}else{
osmType = type;
osmId = node;
......
......@@ -21,6 +21,10 @@ export class ModalManagerService {
private currentComp :any;
reference:any;
viewContainerRef: any;
onDismiss = new Subject<boolean>();
onClose = new Subject<boolean>();
onOpen = new Subject<boolean>();
registerViewContainer(view:any){
console.log("registering view container ref.");
this.viewContainerRef = view;
......@@ -128,8 +132,9 @@ export class ModalManagerService {
this.modalConfig['backdrop']=true;
this.modalConfig['keyboard']=true;
this.modalConfig['beforeDismiss']=()=>this.onDismiss.next(true);
this.modalRef = this.modalService.open(comp,this.modalConfig);
this.modalRef.onDismiss
this.modalRef.componentInstance.asModal = true;
if(data){
for(let key in data){
......@@ -143,7 +148,7 @@ export class ModalManagerService {
}
)
}
this.onOpen.next(true);
}
subscription$:any;
......@@ -163,6 +168,7 @@ export class ModalManagerService {
this.removeComponent();
}
dismiss(reason?:any){
this.onDismiss.next(true);
this.resetModal();
if(this.modalRef){
this.modalRef.dismiss(reason);
......@@ -175,9 +181,9 @@ export class ModalManagerService {
this.subscription$=null;
}
}
close(reason?:any){
this.onClose.next(true);
this.resetModal();
if(this.modalRef){
this.modalRef.close(reason);
......@@ -188,6 +194,4 @@ export class ModalManagerService {
currentModal(){
return this.modalRef;
}
}
......@@ -11,8 +11,8 @@ import { Observable } from 'rxjs';
providedIn: 'root'
})
export class OverpassService {
private apiURL="http://overpass-api.de/api/interpreter";
private apiURL = "http://overpass-api.de/api/interpreter";
//private apiURL="http://geoportal-api.transformationsstadt.de:8888/api/interpreter";
constructor(private httpClient: HttpClient, private cache: CacheService, private logger: LogService) { }
debug(msg:string){
this.logger.debug("OverpassService: "+msg);
......
import { Component, OnInit, Input } from '@angular/core';
import { Component, OnInit, Input, OnDestroy } from '@angular/core';
import { MarkdownService } from 'ngx-markdown';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { ModalManagerService } from '../../../services/modal-manager.service';
import { AuthService } from '../../../services/auth.service';
import { Router } from '@angular/router';
@Component({
selector: 'app-login',
//templateUrl: './login.component.html',
......@@ -15,7 +16,8 @@ export class LoginComponent implements OnInit {
constructor(
private modalManager: ModalManagerService,
private authService: AuthService
private authService: AuthService,
private router : Router,
) { }
ngOnInit() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment