2020-02-28 11:05:59 +01:00
|
|
|
import {Component} from '@angular/core';
|
|
|
|
import {ActivatedRoute, Router} from '@angular/router';
|
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'page-URL-resolver',
|
|
|
|
template: `
|
|
|
|
`
|
|
|
|
})
|
|
|
|
|
|
|
|
export class PageURLResolverComponent {
|
|
|
|
parameters= {};
|
|
|
|
constructor(private route: ActivatedRoute, private router : Router) {
|
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
this.route.queryParams.subscribe(params => {
|
|
|
|
console.log(params);
|
|
|
|
this.parameters = Object.assign({}, params);
|
|
|
|
this.navigateTO(this.router.url.split("?")[0])
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
navigateTO(url:string){
|
|
|
|
if( url == "/search/find/publications" ){
|
|
|
|
this.parameters["type"]="publications";
|
2020-03-30 10:45:08 +02:00
|
|
|
this.router.navigate(["/search/find/research-outcomes"],{queryParams:this.parameters})
|
2020-02-28 11:05:59 +01:00
|
|
|
}else if( url == "/search/find/datasets" ){
|
|
|
|
this.parameters["type"]="datasets";
|
2020-03-30 10:45:08 +02:00
|
|
|
this.router.navigate(["/search/find/research-outcomes"],{queryParams:this.parameters})
|
2020-02-28 11:05:59 +01:00
|
|
|
}else if( url == "/search/find/software" ){
|
|
|
|
this.parameters["type"]="software";
|
2020-03-30 10:45:08 +02:00
|
|
|
this.router.navigate(["/search/find/research-outcomes"],{queryParams:this.parameters})
|
2020-02-28 11:05:59 +01:00
|
|
|
}else if( url == "/search/find/other" ){
|
|
|
|
this.parameters["type"]="other";
|
2020-03-30 10:45:08 +02:00
|
|
|
this.router.navigate(["/search/find/research-outcomes"],{queryParams:this.parameters})
|
2020-02-28 11:05:59 +01:00
|
|
|
}else if( url == "/search/advanced/publications" ){
|
|
|
|
this.parameters["type"]="publications";
|
2020-03-30 10:45:08 +02:00
|
|
|
this.router.navigate(["/search/advanced/research-outcomes"],{queryParams:this.parameters})
|
2020-02-28 11:05:59 +01:00
|
|
|
}else if( url == "/search/advanced/datasets" ){
|
|
|
|
this.parameters["type"]="datasets";
|
2020-03-30 10:45:08 +02:00
|
|
|
this.router.navigate(["/search/advanced/research-outcomes"],{queryParams:this.parameters})
|
2020-02-28 11:05:59 +01:00
|
|
|
}else if( url == "/search/advanced/software" ){
|
|
|
|
this.parameters["type"]="software";
|
2020-03-30 10:45:08 +02:00
|
|
|
this.router.navigate(["/search/advanced/research-outcomes"],{queryParams:this.parameters})
|
2020-02-28 11:05:59 +01:00
|
|
|
}else if( url == "/search/advanced/other" ){
|
|
|
|
this.parameters["type"]="other";
|
2020-03-30 10:45:08 +02:00
|
|
|
this.router.navigate(["/search/advanced/research-outcomes"],{queryParams:this.parameters})
|
2020-02-28 11:05:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|