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

78 lines
2.0 KiB
TypeScript
Raw Normal View History

2017-11-02 15:19:12 +01:00
import { Component, OnInit} from '@angular/core';
import { ServerService } from './services/server.service';
import { FieldBase } from '../app/form/fields/field-base';
import { JsonObjest } from '../app/entities/JsonObject.class';
2017-11-01 18:18:27 +01:00
import { TokenService, TokenProvider } from './services/login/token.service';
2017-11-15 16:11:35 +01:00
import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, ActivatedRoute, NavigationExtras } from '@angular/router';
2017-11-01 18:18:27 +01:00
import { MainSignInComponent } from './login/main-sign-in/main-sign-in.component';
2017-11-14 15:06:00 +01:00
import {BreadcrumbModule,MenuItem} from 'primeng/primeng';
2017-11-15 16:11:35 +01:00
import { BreadcrumbComponent } from './widgets/breadcrumb/breadcrumb.component';
2017-11-08 14:33:14 +01:00
import { AutocompleteRemoteComponent } from './form/fields/autocomplete-remote/autocomplete-remote.component';
2017-11-03 18:57:06 +01:00
declare var $ :any;
@Component({
selector: 'app-root',
2017-11-01 18:18:27 +01:00
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
providers: []
})
2017-11-02 15:19:12 +01:00
export class AppComponent implements OnInit {
fields: any[];
2017-11-03 18:57:06 +01:00
sliderExpanded : boolean = false;
2017-11-01 18:18:27 +01:00
2017-11-14 15:06:00 +01:00
2017-11-14 23:51:39 +01:00
breadcrumbHome: MenuItem = {icon: 'fa fa-home', routerLink: "/welcome"};
2017-11-14 15:06:00 +01:00
breadcrumbData: MenuItem[] = new Array<MenuItem>();
2017-11-15 23:55:49 +01:00
constructor(private tokenService : TokenService, private router: Router, private route: ActivatedRoute) {
2017-11-01 18:18:27 +01:00
}
2017-11-02 15:19:12 +01:00
ngOnInit() {
2017-11-14 15:06:00 +01:00
}
2017-11-03 18:57:06 +01:00
slideNav(){
$("#appSidebar").toggleClass("expanded");
$("#appBody").toggleClass("expanded");
}
2017-11-01 18:18:27 +01:00
//loggedInAs : string = null;
showLogin : boolean = false;
login(){
//redirect to login page
2017-11-10 16:53:53 +01:00
this.router.navigate(['/login'], { queryParams: { /*refresh : Math.random() ,returnUrl: this.state.url*/ }});
2017-11-01 18:18:27 +01:00
}
logout(){
this.tokenService.logout();
}
2017-11-13 18:13:49 +01:00
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*/ }});
}
}
2017-11-01 18:18:27 +01:00