import { Component, Directive, ElementRef, Renderer, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';
import { ConfigurationService } from './utils/configuration/configuration.service';
import {Observable} from 'rxjs/Observable';
import { EnvProperties } from './utils/properties/env-properties';
import {ActivatedRoute} from '@angular/router';
import{EnvironmentSpecificService} from './utils/properties/environment-specific.service';
import{MenuItem,RootMenuItem} from './sharedComponents/menu';
@Component({
//changeDetection: ChangeDetectionStrategy.Default,
//encapsulation: ViewEncapsulation.Emulated,
selector: 'app-root',
styles: [`
`],
template: `
Openaire Lib Component
`
})
export class AppComponent {
isClient:boolean = false;
public properties:EnvProperties = null;
constructor(private config: ConfigurationService, private route: ActivatedRoute, private propertiesService:EnvironmentSpecificService) {
}
userMenuItems:MenuItem[] = [ new MenuItem("","My profile","","",false,[],[],{}),
new MenuItem("","My claims","","/myclaims",false,[],["/myclaims"],{}),
new MenuItem("","Manage all claims","","/claims",true,[],["/claims"],{})]
menuItems:RootMenuItem [] = [
{rootItem: new MenuItem("search","Search","","/search/find",false,[],["/search/find"],{}),
items: [new MenuItem("","Publications","","/search/find/publications",false,["publication"],["/search/find/publications"],{}),
new MenuItem("","Research Data","","/search/find/datasets",false,["dataset"],["/search/find/datasets"],{}),
new MenuItem("","Software","","/search/find/software",false,["software"],["/search/find/software"],{}),
new MenuItem("","Projects","","/search/find/projects/",false,["project"],["/search/find/projects"],{}),
new MenuItem("","Content Providers","","/search/find/dataproviders",false,["datasource"],["/search/find/dataproviders"],{}),
new MenuItem("","Organizations","","/search/find/organizations/",false,["organization"],["/search/find/organizations"],{})
]},
{
rootItem: new MenuItem("share","Share","","",false,[],["/participate/deposit-publications","/participate/deposit-datasets"],{}),
items: [new MenuItem("","Publications","","/participate/deposit-publications",false,["publication"],["/participate/deposit-publications"],{}),
new MenuItem("","Research Data","","/participate/deposit-datasets",false,["dataset"],["/participate/deposit-datasets"],{})]
},
{
rootItem: new MenuItem("link","Link","","/participate/claim",false,[],["/participate/claim"],{}),
items: []
},
{
rootItem: new MenuItem("datasources","Content Providers","","",false,["datasource"],[],{}),
items: [new MenuItem("","Data Policies","https://beta.openaire.eu/oa-policies-mandates","",false,["datasource"],[],{}),
new MenuItem("","Repositories","","/search/content-providers",false,["datasource"],["/search/content-providers"],{}),
new MenuItem("","Journals","","/search/journals",false,["datasource"],["/search/journals"],{}),
new MenuItem("","Registries","","/search/entity-registries",false,["datasource"],["/search/entity-registries"],{}),
new MenuItem("","Browse all","","/search/find/dataproviders",false,["datasource"],["/search/find/dataproviders"],{})]
}
];
ngOnInit() {
this.propertiesService.loadEnvironment()
.then(es => {
this.propertiesService.setEnvProperties(es);
this.properties = this.propertiesService.envSpecific;
}, error => {
console.log("App couldn't fetch properties");
console.log(error);
});
if (typeof document !== 'undefined') {
try{
this.isClient = true;
}catch (e) {
}
}
}
}