2019-05-23 15:38:44 +02:00
|
|
|
import {Component} from '@angular/core';
|
|
|
|
import {ActivatedRoute, NavigationStart, Router} 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';
|
|
|
|
import {HelperFunctions} from "./openaireLibrary/utils/HelperFunctions.class";
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
//changeDetection: ChangeDetectionStrategy.Default,
|
|
|
|
//encapsulation: ViewEncapsulation.Emulated,
|
|
|
|
selector: 'app-root',
|
|
|
|
styles: [`
|
|
|
|
`],
|
|
|
|
template: `
|
|
|
|
|
|
|
|
<navbar *ngIf="properties" portal="aggregator" [environment]=properties.environment [onlyTop]=false
|
|
|
|
[communityId]="properties.adminToolsCommunity" [menuItems]=menuItems
|
|
|
|
[APIUrl]="properties.adminToolsAPIURL" [logInUrl]="properties.loginUrl"
|
2019-05-24 15:54:22 +02:00
|
|
|
[logOutUrl]="properties.logoutUrl" [cookieDomain]="properties.cookieDomain" [userMenu]="false" [community]="community" [showCommunityName]="true"></navbar>
|
2019-05-23 15:38:44 +02:00
|
|
|
<div class="custom-main-content">
|
|
|
|
<main>
|
|
|
|
<router-outlet></router-outlet>
|
|
|
|
</main>
|
|
|
|
</div>
|
2019-05-24 15:54:22 +02:00
|
|
|
<cookie-law *ngIf="isClient" position="bottom">
|
2019-05-23 15:38:44 +02:00
|
|
|
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 && properties" [environment]=properties.environment></bottom>
|
|
|
|
|
|
|
|
`
|
|
|
|
|
|
|
|
})
|
|
|
|
export class AppComponent {
|
|
|
|
isClient: boolean = false;
|
|
|
|
menuItems: RootMenuItem [] = [
|
|
|
|
{rootItem: new MenuItem("home", "Home", "", "/", false, [], null, {}), items: []},
|
|
|
|
{
|
|
|
|
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("", "Other Research Products", "", "/search/find/other", false, ["orp"], ["/search/find/other"], {}),
|
2019-05-24 15:54:22 +02:00
|
|
|
// new MenuItem("", "Projects", "", "/search/find/projects/", false, ["project"], ["/search/find/projects"], {}),
|
|
|
|
// new MenuItem("", "Content Providers", "", "/search/find/dataproviders", false, ["datasource"], ["/search/find/dataproviders"], {}),
|
2019-05-23 15:38:44 +02:00
|
|
|
new MenuItem("", "Organizations", "", "/search/find/organizations/", false, ["organization"], ["/search/find/organizations"], {})
|
|
|
|
]
|
|
|
|
}
|
|
|
|
];
|
2019-05-24 15:54:22 +02:00
|
|
|
community = {id: "CA", name: "Canada Aggregator", logoUrl:"assets/common-assets/logo-small-aggregator.png"};
|
2019-05-23 15:38:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
properties: EnvProperties;
|
|
|
|
|
|
|
|
constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService,
|
|
|
|
private router: Router) {
|
|
|
|
router.events.forEach((event) => {
|
|
|
|
if (event instanceof NavigationStart) {
|
|
|
|
HelperFunctions.scroll();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
|
|
|
if (typeof document !== 'undefined') {
|
|
|
|
try {
|
|
|
|
this.isClient = true;
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
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);
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|