1 |
60847
|
k.triantaf
|
import {Component, OnDestroy, OnInit} from '@angular/core';
|
2 |
59507
|
konstantin
|
import {MenuItem, RootMenuItem} from './openaireLibrary/sharedComponents/menu';
|
3 |
|
|
import {EnvProperties} from './openaireLibrary/utils/properties/env-properties';
|
4 |
|
|
import {User} from './openaireLibrary/login/utils/helper.class';
|
5 |
|
|
import {properties} from '../environments/environment';
|
6 |
|
|
import {LayoutService} from './services/layout.service';
|
7 |
59594
|
k.triantaf
|
import {Header} from './openaireLibrary/sharedComponents/navigationBar.component';
|
8 |
60847
|
k.triantaf
|
import {SmoothScroll} from './openaireLibrary/utils/smooth-scroll';
|
9 |
59507
|
konstantin
|
|
10 |
|
|
@Component({
|
11 |
|
|
selector: 'app',
|
12 |
|
|
templateUrl: './app.component.html',
|
13 |
|
|
})
|
14 |
|
|
|
15 |
60847
|
k.triantaf
|
export class AppComponent implements OnInit, OnDestroy {
|
16 |
59551
|
k.triantaf
|
title = 'OpenAIRE - Research Graph';
|
17 |
59507
|
konstantin
|
userMenuItems: MenuItem[] = [];
|
18 |
|
|
menuItems: RootMenuItem [] = [];
|
19 |
|
|
logInUrl = null;
|
20 |
|
|
logOutUrl = null;
|
21 |
|
|
properties: EnvProperties = properties;
|
22 |
|
|
showMenu: boolean = false;
|
23 |
|
|
user: User;
|
24 |
59594
|
k.triantaf
|
header: Header;
|
25 |
|
|
logoPath: string = 'assets/common-assets/';
|
26 |
59507
|
konstantin
|
|
27 |
60847
|
k.triantaf
|
constructor(private layoutService: LayoutService,
|
28 |
|
|
private smoothScroll: SmoothScroll) {}
|
29 |
59507
|
konstantin
|
|
30 |
|
|
ngOnInit() {
|
31 |
|
|
this.logInUrl = this.properties.loginUrl;
|
32 |
|
|
this.logOutUrl = this.properties.logoutUrl;
|
33 |
|
|
this.showMenu = true;
|
34 |
59594
|
k.triantaf
|
this.header = {
|
35 |
|
|
route: "/",
|
36 |
|
|
url: null,
|
37 |
|
|
title: 'graph',
|
38 |
|
|
logoUrl: this.logoPath + 'logo-large-graph.png',
|
39 |
|
|
logoSmallUrl:this.logoPath + 'logo-small-graph.png',
|
40 |
|
|
position:'left',
|
41 |
|
|
badge:true
|
42 |
|
|
};
|
43 |
59507
|
konstantin
|
this.layoutService.isHome.subscribe(isHome => {
|
44 |
|
|
this.buildMenu(isHome);
|
45 |
|
|
});
|
46 |
|
|
}
|
47 |
|
|
|
48 |
60847
|
k.triantaf
|
ngOnDestroy() {
|
49 |
|
|
this.smoothScroll.clearSubscriptions();
|
50 |
|
|
}
|
51 |
|
|
|
52 |
59507
|
konstantin
|
buildMenu(isHome) {
|
53 |
|
|
this.menuItems = [
|
54 |
|
|
{
|
55 |
|
|
rootItem: new MenuItem("about", "About", "", "/about", false, [], null, {}),
|
56 |
|
|
items: [
|
57 |
59534
|
konstantin
|
new MenuItem("overview", "Overview", "", "/about", false, [], null, {}),
|
58 |
|
|
new MenuItem("architecture", "Architecture", "", "/about", false, [], null, {}, null, 'architecture'),
|
59 |
|
|
new MenuItem("metrics", "Data and Metrics", "", "/about", false, [], null, {}, null, 'metrics'),
|
60 |
|
|
new MenuItem("infrastructure", "Infrastructure", "", "/about", false, [], null, {}, null, 'infrastructure'),
|
61 |
|
|
new MenuItem("team", "Team", "", "/about", false, [], null, {}, null, 'team')
|
62 |
59507
|
konstantin
|
]
|
63 |
|
|
},
|
64 |
|
|
{
|
65 |
|
|
rootItem: new MenuItem("resources", "Resources", "", "/resources", false, [], null, {}),
|
66 |
|
|
items: [
|
67 |
60866
|
k.triantaf
|
new MenuItem("api", "API", "", "/resources", false, [], null, {}),
|
68 |
|
|
new MenuItem("references", "References", "", "/resources/references", false, [], null, {})
|
69 |
59507
|
konstantin
|
]
|
70 |
|
|
},
|
71 |
|
|
{
|
72 |
|
|
rootItem: new MenuItem("contact", "Support", "", "/support", false, [], null, {}),
|
73 |
60866
|
k.triantaf
|
items: []
|
74 |
59507
|
konstantin
|
}
|
75 |
|
|
];
|
76 |
|
|
if(!isHome) {
|
77 |
|
|
this.menuItems = [{
|
78 |
|
|
rootItem: new MenuItem("home", "Home", "", "/", false, [], null, {}),
|
79 |
|
|
items: []
|
80 |
|
|
}].concat(this.menuItems);
|
81 |
|
|
}
|
82 |
|
|
}
|
83 |
|
|
}
|