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'; import { TranslateService } from '@ngx-translate/core'; 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(); constructor(private tokenService : TokenService, private router: Router, private route: ActivatedRoute, private translate: TranslateService) { // 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'); } 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*/ }}); } }