argos/dmp-frontend/src/app/app.component.ts

76 lines
1.9 KiB
TypeScript

import { Component, OnInit, ViewEncapsulation} from '@angular/core';
import { ServerService } from './services/server.service';
import { JsonObjest } from '../app/entities/JsonObject.class';
import { TokenService, TokenProvider } from './services/login/token.service';
import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, ActivatedRoute, NavigationExtras } from '@angular/router';
import { MainSignInComponent } from './login/main-sign-in/main-sign-in.component';
import {BreadcrumbModule,MenuItem} from 'primeng/primeng';
import { BreadcrumbComponent } from './widgets/breadcrumb/breadcrumb.component';
declare const gapi: any;
declare var $ :any;
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
providers: [],
encapsulation: ViewEncapsulation.None
})
export class AppComponent implements OnInit {
fields: any[];
sliderExpanded : boolean = false;
breadcrumbHome: MenuItem = {icon: 'fa fa-home', routerLink: "/welcome"};
breadcrumbData: MenuItem[] = new Array<MenuItem>();
constructor(private tokenService : TokenService, private router: Router, private route: ActivatedRoute) {
}
ngOnInit() {
}
slideNav(){
$("#appSidebar").toggleClass("expanded");
$("#appBody").toggleClass("expanded");
}
//loggedInAs : string = null;
showLogin : boolean = false;
login(){
//redirect to login page
this.router.navigate(['/login'], { queryParams: { /*refresh : Math.random() ,returnUrl: this.state.url*/ }});
}
logout(){
this.tokenService.logout();
}
goToDMPs(){
this.router.navigate(['/dmps'], { queryParams: { /*refresh : Math.random() ,returnUrl: this.state.url*/ }});
}
goToProjects(){
this.router.navigate(['/projects'], { queryParams: { /*refresh : Math.random() ,returnUrl: this.state.url*/ }});
}
}