Revision 60773
Added by Konstantinos Triantafyllou about 3 years ago
app.component.ts | ||
---|---|---|
19 | 19 |
//encapsulation: ViewEncapsulation.Emulated, |
20 | 20 |
selector: 'app-root', |
21 | 21 |
template: ` |
22 |
<navbar *ngIf="properties && header" [header]="header" [portal]="properties.dashboard" [properties]=properties [onlyTop]=false [user]="user" |
|
22 |
<navbar *ngIf="properties && header" [header]="header" [portal]="properties.dashboard" [properties]=properties |
|
23 |
[onlyTop]=false [user]="user" |
|
23 | 24 |
[communityId]="properties.adminToolsCommunity" [userMenuItems]=userMenuItems [menuItems]=menuItems></navbar> |
24 |
<schema2jsonld *ngIf="properties" [URL]="properties.domain+properties.baseLink" |
|
25 |
[logoURL]="properties.domain+properties.baseLink+'/assets/common-assets/logo-small-explore.png'" type="home" |
|
26 |
name="OpenAIRE | Find and Share research" description="OpenAIRE Explore: Over 100M of research deduplicated, 170K research software, 11M research data. One of the largest open scholarly records collection worldwide."></schema2jsonld> |
|
25 |
<schema2jsonld *ngIf="properties" [URL]="properties.domain+properties.baseLink" |
|
26 |
[logoURL]="properties.domain+properties.baseLink+'/assets/common-assets/logo-small-explore.png'" |
|
27 |
type="home" |
|
28 |
name="OpenAIRE | Find and Share research" |
|
29 |
description="OpenAIRE Explore: Over 100M of research deduplicated, 170K research software, 11M research data. One of the largest open scholarly records collection worldwide."></schema2jsonld> |
|
27 | 30 |
<div class="custom-main-content"> |
28 | 31 |
<main> |
29 | 32 |
<router-outlet></router-outlet> |
... | ... | |
34 | 37 |
Cookies are small pieces of data that websites store in your browser to allow us to give you the best browsing |
35 | 38 |
experience possible. |
36 | 39 |
By using the OpenAIRE portal you accept our use of cookies. <a |
37 |
href="//ec.europa.eu/ipg/basics/legal/cookies/index_en.htm" target="_blank"> Read more <span class="uk-icon"> |
|
40 |
href="//ec.europa.eu/ipg/basics/legal/cookies/index_en.htm" target="_blank"> Read more <span class="uk-icon">
|
|
38 | 41 |
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right" |
39 | 42 |
ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg> |
40 | 43 |
</span></a> |
41 | 44 |
</cookie-law> |
42 | 45 |
<bottom *ngIf="isClient && properties" [properties]="properties"></bottom> |
43 |
|
|
46 |
|
|
44 | 47 |
` |
45 |
|
|
48 |
|
|
46 | 49 |
}) |
47 | 50 |
export class AppComponent { |
48 | 51 |
isClient: boolean = false; |
49 |
clientLoad = 0; |
|
50 |
|
|
51 | 52 |
userMenuItems: MenuItem[] = []; |
52 |
|
|
53 |
// userMenuItems: MenuItem[] = [new MenuItem("", "My profile", "", "", false, [], [], {}), |
|
54 |
// new MenuItem("", "My links", "", "/myclaims", false, [], ["/myclaims"], {})] |
|
55 |
|
|
56 | 53 |
menuItems: RootMenuItem [] = []; |
57 |
|
|
58 | 54 |
feedbackmail: string; |
59 |
properties: EnvProperties; |
|
55 |
properties: EnvProperties = properties;
|
|
60 | 56 |
user: User; |
61 | 57 |
header: Header; |
62 | 58 |
logoPath: string = 'assets/common-assets/'; |
63 | 59 |
subscriptions = []; |
64 |
|
|
60 |
|
|
65 | 61 |
constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService, |
66 | 62 |
private router: Router, private userManagementService: UserManagementService, |
67 |
private configurationService: ConfigurationService, private _meta: Meta) {
|
|
63 |
private configurationService: ConfigurationService, private _meta: Meta) { |
|
68 | 64 |
this.userMenuItems.push(new MenuItem("", "My profile", "", "", false, [], [], {})); |
69 | 65 |
this.userMenuItems.push(new MenuItem("", "My ORCID links", "", "/my-orcid-links", false, [], [""], {})); |
70 | 66 |
this.userMenuItems.push(new MenuItem("", "My links", "", "/myclaims", false, [], ["/myclaims"], {})); |
71 |
|
|
67 |
|
|
72 | 68 |
this.subscriptions.push(router.events.forEach((event) => { |
73 | 69 |
if (event instanceof NavigationStart) { |
74 |
// console.log(event.url); |
|
75 | 70 |
HelperFunctions.scroll(); |
76 | 71 |
} |
77 | 72 |
})); |
78 | 73 |
} |
79 |
|
|
74 |
|
|
80 | 75 |
ngOnInit() { |
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 | 76 |
if (typeof document !== 'undefined') { |
86 |
try { |
|
87 |
this.isClient = true; |
|
88 |
|
|
89 |
} catch (e) { |
|
90 |
} |
|
91 |
|
|
77 |
this.isClient = true; |
|
92 | 78 |
} |
93 |
this.subscriptions.push(this.propertiesService.loadEnvironment() |
|
94 |
.then(es => { |
|
95 |
this.propertiesService.setEnvProperties(es); |
|
96 |
this.properties = this.propertiesService.envSpecific; |
|
97 |
this.configurationService.initCommunityInformation(this.properties, this.properties.adminToolsCommunity); |
|
98 |
this.feedbackmail = this.properties.feedbackmail; |
|
99 |
if(this.properties.environment == "production" || this.properties.environment == "development") { |
|
100 |
this.subscriptions.push(this.route.queryParams.subscribe(data => { |
|
101 |
this._meta.updateTag({content: 'all', name: 'robots'}); |
|
102 |
})); |
|
103 |
} |
|
104 |
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { |
|
105 |
this.user = user; |
|
106 |
this.buildMenu(); |
|
107 |
this.header = { |
|
108 |
route: "/", |
|
109 |
url: null, |
|
110 |
title: 'explore', |
|
111 |
logoUrl: this.logoPath + 'logo-large-explore.png', |
|
112 |
logoSmallUrl:this.logoPath + 'logo-small-explore.png', |
|
113 |
position:'left', |
|
114 |
badge:true |
|
115 |
}; |
|
116 |
})); |
|
117 |
//console.log(this.properties.loginUrl); |
|
118 |
}, error => { |
|
119 |
console.log("App couldn't fetch properties"); |
|
120 |
console.log(error); |
|
121 |
|
|
79 |
this.configurationService.initCommunityInformation(this.properties, this.properties.adminToolsCommunity); |
|
80 |
this.feedbackmail = this.properties.feedbackmail; |
|
81 |
if (this.properties.environment == "production" || this.properties.environment == "development") { |
|
82 |
this.subscriptions.push(this.route.queryParams.subscribe(data => { |
|
83 |
this._meta.updateTag({content: 'all', name: 'robots'}); |
|
122 | 84 |
})); |
85 |
} |
|
86 |
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { |
|
87 |
this.user = user; |
|
88 |
this.buildMenu(); |
|
89 |
this.header = { |
|
90 |
route: "/", |
|
91 |
url: null, |
|
92 |
title: 'explore', |
|
93 |
logoUrl: this.logoPath + 'logo-large-explore.png', |
|
94 |
logoSmallUrl: this.logoPath + 'logo-small-explore.png', |
|
95 |
position: 'left', |
|
96 |
badge: true |
|
97 |
}; |
|
98 |
})); |
|
123 | 99 |
} |
100 |
|
|
124 | 101 |
ngOnDestroy() { |
125 | 102 |
this.subscriptions.forEach(subscription => { |
126 | 103 |
if (subscription instanceof Subscriber) { |
... | ... | |
130 | 107 |
this.configurationService.clearSubscriptions(); |
131 | 108 |
this.userManagementService.clearSubscriptions(); |
132 | 109 |
} |
110 |
|
|
133 | 111 |
buildMenu() { |
134 |
//TODO add check for research results route
|
|
112 |
//TODO add check for research results route |
|
135 | 113 |
this.menuItems = [ |
136 | 114 |
{ |
137 |
rootItem: new MenuItem("search", "Search", "", "/search/find", false, [], ["/search/find"], {qf:true}), |
|
115 |
rootItem: new MenuItem("search", "Search", "", "/search/find", false, [], ["/search/find"], {qf: true}),
|
|
138 | 116 |
items: [ |
139 |
new MenuItem("", "Research Outcomes", "", "/search/find/research-outcomes", false, [], ["/search/find/research-outcomes"], {qf:true}), |
|
117 |
new MenuItem("", "Research Outcomes", "", "/search/find/research-outcomes", false, [], ["/search/find/research-outcomes"], {qf: true}),
|
|
140 | 118 |
new MenuItem("", "Projects", "", "/search/find/projects/", false, ["project"], ["/search/find/projects"], {}), |
141 | 119 |
new MenuItem("", "Content Providers", "", "/search/find/dataproviders", false, ["datasource"], ["/search/find/dataproviders"], {}), |
142 | 120 |
new MenuItem("", "Organizations", "", "/search/find/organizations/", false, ["organization"], ["/search/find/organizations"], {}) |
... | ... | |
168 | 146 |
this.userMenuItems.push(new MenuItem("", "Manage all links", "", "/claims", false, [], ["/claims"], {})); |
169 | 147 |
this.userMenuItems.push(new MenuItem("", "Manage helptexts", |
170 | 148 |
((this.properties.environment == "beta") ? "https://beta.admin.connect.openaire.eu" : "https://admin.explore.openaire.eu") + "/dashboard?communityId=openaire", "", true, [], [], {})) |
171 |
|
|
149 |
|
|
172 | 150 |
} else if (Session.isClaimsCurator(this.user)) { |
173 | 151 |
this.userMenuItems.push(new MenuItem("", "Manage all links", "", "/claims", false, [], ["/claims"], {})); |
174 |
|
|
152 |
|
|
175 | 153 |
} |
176 |
if(this.user) { |
|
154 |
if (this.user) {
|
|
177 | 155 |
this.userMenuItems.push(new MenuItem("", "User information", "", "/user-info", false, [], [], {})); |
178 | 156 |
} |
179 | 157 |
} |
Also available in: Unified diff
[Explore | Trunk]: Remove properties resolver and load environment