2017-12-19 18:34:00 +01:00
|
|
|
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
2017-11-15 16:11:35 +01:00
|
|
|
import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, ActivatedRoute, NavigationExtras } from '@angular/router';
|
2017-12-14 11:41:26 +01:00
|
|
|
import { TranslateService } from '@ngx-translate/core';
|
2018-03-28 15:24:47 +02:00
|
|
|
import { LanguageResolverService } from './services/language-resolver/language-resolver.service';
|
2018-06-27 12:29:21 +02:00
|
|
|
import { BreadCrumbResolverService } from './services/breadcrumb/breadcrumb-resolver.service';
|
2017-09-14 12:37:36 +02:00
|
|
|
|
2017-11-08 14:33:14 +01:00
|
|
|
|
2017-11-27 11:52:52 +01:00
|
|
|
declare const gapi: any;
|
2017-11-08 14:33:14 +01:00
|
|
|
|
2017-12-19 18:34:00 +01:00
|
|
|
declare var $: any;
|
2017-09-14 12:37:36 +02:00
|
|
|
@Component({
|
|
|
|
selector: 'app-root',
|
2017-11-01 18:18:27 +01:00
|
|
|
templateUrl: './app.component.html',
|
2017-12-19 18:34:00 +01:00
|
|
|
styleUrls: ['./app.component.scss'],
|
|
|
|
providers: [],
|
2017-12-11 09:10:54 +01:00
|
|
|
encapsulation: ViewEncapsulation.None
|
2017-09-14 12:37:36 +02:00
|
|
|
})
|
2017-11-02 15:19:12 +01:00
|
|
|
export class AppComponent implements OnInit {
|
2017-11-14 15:06:00 +01:00
|
|
|
|
2018-06-27 12:29:21 +02:00
|
|
|
constructor(
|
|
|
|
private router: Router,
|
|
|
|
private route: ActivatedRoute,
|
|
|
|
private translate: TranslateService,
|
|
|
|
private languageService: LanguageResolverService,
|
|
|
|
private breadCrumbResolverService: BreadCrumbResolverService
|
|
|
|
) {
|
2017-12-19 18:34:00 +01:00
|
|
|
// this language will be used as a fallback when a translation isn't found in the current language
|
|
|
|
translate.setDefaultLang('en');
|
|
|
|
// the lang to use, if the lang isn't available, it will use the current loader to get them
|
|
|
|
translate.use('en');
|
2017-11-01 18:18:27 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-06-27 12:29:21 +02:00
|
|
|
onActivate(event: any) {
|
|
|
|
this.breadCrumbResolverService.push(event)
|
|
|
|
}
|
|
|
|
|
|
|
|
onDeactivate(event: any) {
|
|
|
|
//this.breadCrumbResolverService.clear()
|
|
|
|
}
|
|
|
|
|
2017-11-02 15:19:12 +01:00
|
|
|
ngOnInit() {
|
2017-11-27 11:52:52 +01:00
|
|
|
}
|
|
|
|
|
2017-12-19 18:34:00 +01:00
|
|
|
login() {
|
2017-11-01 18:18:27 +01:00
|
|
|
//redirect to login page
|
2017-12-19 18:34:00 +01:00
|
|
|
this.router.navigate(['/login'], { queryParams: { /*refresh : Math.random() ,returnUrl: this.state.url*/ } });
|
2017-11-01 18:18:27 +01:00
|
|
|
}
|
|
|
|
|
2017-12-19 18:34:00 +01:00
|
|
|
logout() {
|
2017-11-01 18:18:27 +01:00
|
|
|
|
2017-11-13 18:13:49 +01:00
|
|
|
}
|
|
|
|
|
2017-12-19 18:34:00 +01:00
|
|
|
goToDMPs() {
|
|
|
|
this.router.navigate(['/dmps'], { queryParams: { /*refresh : Math.random() ,returnUrl: this.state.url*/ } });
|
2017-11-13 18:13:49 +01:00
|
|
|
}
|
|
|
|
|
2017-12-19 18:34:00 +01:00
|
|
|
goToProjects() {
|
|
|
|
this.router.navigate(['/projects'], { queryParams: { /*refresh : Math.random() ,returnUrl: this.state.url*/ } });
|
|
|
|
}
|
2017-09-14 12:37:36 +02:00
|
|
|
}
|
2017-11-01 18:18:27 +01:00
|
|
|
|