117 lines
6.0 KiB
TypeScript
117 lines
6.0 KiB
TypeScript
import { Component, Directive, ElementRef, Renderer, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';
|
|
import {Observable} from 'rxjs/Observable';
|
|
import {ActivatedRoute} from '@angular/router';
|
|
|
|
import { EnvProperties} from './openaireLibrary/utils/properties/env-properties';
|
|
import{MenuItem, RootMenuItem} from './openaireLibrary/sharedComponents/menu';
|
|
import { EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service';
|
|
|
|
|
|
@Component({
|
|
//changeDetection: ChangeDetectionStrategy.Default,
|
|
//encapsulation: ViewEncapsulation.Emulated,
|
|
selector: 'app-root',
|
|
styles: [`
|
|
`],
|
|
template: `
|
|
|
|
<navbar *ngIf= "properties" portal="connect" onlyTop=false [(communityId)]="properties.adminToolsCommunity" [userMenuItems]=userMenuItems [menuItems]=menuItems
|
|
[(APIUrl)]="properties.adminToolsAPIURL" [(logInUrl)]="properties.loginUrl" [(logOutUrl)]="properties.logoutUrl" [(cookieDomain)]="properties.cookieDomain" [(community)]=community></navbar>
|
|
<div class="custom-main-content" >
|
|
<main>
|
|
<router-outlet></router-outlet>
|
|
</main>
|
|
</div>
|
|
<feedback *ngIf= "isClient" portalName="Connect" [feedbackmail]=feedbackmail></feedback>
|
|
<cookie-law *ngIf= "isClient" position="bottom">
|
|
OpenAIRE uses cookies in order to function properly.<br>
|
|
Cookies are small pieces of data that websites store in your browser to allow us to give you the best browsing experience possible.
|
|
By using the OpenAIRE portal you accept our use of cookies. <a href="//ec.europa.eu/ipg/basics/legal/cookies/index_en.htm" target="_blank"> Read more <span class="uk-icon">
|
|
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg>
|
|
</span></a>
|
|
</cookie-law>
|
|
<bottom *ngIf= "isClient"></bottom>
|
|
|
|
`
|
|
|
|
})
|
|
export class AppComponent {
|
|
isClient:boolean = false;
|
|
|
|
|
|
userMenuItems:MenuItem[] =[];
|
|
|
|
|
|
menuItems:RootMenuItem []=[];
|
|
|
|
feedbackmail:string
|
|
properties:EnvProperties;
|
|
community: {id:string, name:string, logoUrl:string};
|
|
constructor( private route: ActivatedRoute, private propertiesService:EnvironmentSpecificService) {
|
|
}
|
|
|
|
ngOnInit() {
|
|
this.route.queryParams.subscribe(data => {
|
|
|
|
if(data['community'] && data['community']!=""){
|
|
this.community = {id: data['community'], name: "Egi Federation", logoUrl:"https:\/\/egi.eu/wp-content/uploads/2016/05/cropped-logo_site-1-300x300.png"};
|
|
|
|
this.userMenuItems = [ new MenuItem("","My profile","","",false,[],[],{}),
|
|
new MenuItem("","My claims","","/myclaims",false,[],["/myclaims"],{}),
|
|
new MenuItem("","Manage all claims","","/claims",true,[],["/claims"],{}),]
|
|
|
|
this.menuItems= [{
|
|
rootItem: new MenuItem("dashboard","Dashboard","","/community",false,[],[],{community:"egi||EGI Federation"}),
|
|
items: []
|
|
},
|
|
{rootItem: new MenuItem("search","Search","","",false,[],[],{}),
|
|
items: [new MenuItem("","Publications","","/search/find/publications",false,["publication"],["/search/find/publications"],{community: "%22egi%7C%7CEGI%20Federation%22"}),
|
|
new MenuItem("","Research Data","","/search/find/datasets",false,["dataset"],["/search/find/datasets"],{community: "%22egi%7C%7CEGI%20Federation%22"}),
|
|
new MenuItem("","Software","","/search/find/software",false,["software"],["/search/find/software"],{community: "%22egi%7C%7CEGI%20Federation%22"}),
|
|
new MenuItem("","Projects","","/search/find/projects/",false,["project"],["/search/find/projects"],{community: "%22egi%7C%7CEGI%20Federation%22"}),
|
|
new MenuItem("","Content Providers","","/search/find/dataproviders",false,["datasource"],["/search/find/dataproviders"],{community: "%22egi%7C%7CEGI%20Federation%22"}),
|
|
new MenuItem("","Organizations","","/search/find/organizations/",false,["organization"],["/search/find/organizations"],{community: "%22egi%7C%7CEGI%20Federation%22"}),
|
|
]},
|
|
{
|
|
rootItem: new MenuItem("share","Share","","",false,[],["/participate/deposit-publications","/participate/deposit-datasets"],{community:"egi||EGI Federation"}),
|
|
items: [new MenuItem("","Publications","","/participate/deposit-publications",false,["publication"],["/participate/deposit-publications"],{community:"egi||EGI Federation"}),
|
|
new MenuItem("","Research Data","","/participate/deposit-datasets",false,["dataset"],["/participate/deposit-datasets"],{community:"egi||EGI Federation"})]
|
|
},
|
|
{
|
|
rootItem: new MenuItem("link","Link","","/participate/claim",false,[],["/participate/claim"],{community:"egi||EGI Federation"}),
|
|
items: []
|
|
}
|
|
];
|
|
}else{
|
|
this.community = null;
|
|
this.userMenuItems = [ new MenuItem("","My profile","","",false,[],[],{}),
|
|
new MenuItem("","My claims","","/myclaims",false,[],["/myclaims"],{}),
|
|
new MenuItem("","Manage all claims","","/claims",true,[],["/claims"],{}),];
|
|
this.menuItems= [
|
|
{
|
|
rootItem: new MenuItem("communities","Communities","","/",false,[],[],{}),
|
|
items: []
|
|
}
|
|
];
|
|
}
|
|
|
|
});
|
|
if (typeof document !== 'undefined') {
|
|
try{
|
|
this.isClient = true;
|
|
}catch (e) {
|
|
}
|
|
}
|
|
this.propertiesService.loadEnvironment()
|
|
.then(es => {
|
|
this.propertiesService.setEnvProperties(es);
|
|
this.properties = this.propertiesService.envSpecific;
|
|
this.feedbackmail = this.properties.feedbackmail;
|
|
}, error => {
|
|
console.log("App couldn't fetch properties");
|
|
console.log(error);
|
|
|
|
});
|
|
}
|
|
}
|