2023-12-06 14:33:14 +01:00
|
|
|
import {ChangeDetectorRef, Component, OnInit} from '@angular/core';
|
2023-10-23 15:46:00 +02:00
|
|
|
import {ActivatedRoute, Router} from "@angular/router";
|
2023-10-24 14:29:36 +02:00
|
|
|
import {MenuItem} from "./openaireLibrary/sharedComponents/menu";
|
2023-10-27 14:53:59 +02:00
|
|
|
import {Header} from "./openaireLibrary/sharedComponents/navigationBar.component";
|
2023-11-02 13:56:35 +01:00
|
|
|
import {ConfigurationService} from "./openaireLibrary/utils/configuration/configuration.service";
|
2023-11-02 15:39:57 +01:00
|
|
|
import {Irish} from "./shared/irish";
|
2023-12-18 12:27:40 +01:00
|
|
|
import {CustomFilterService} from "./openaireLibrary/shared/customFilter.service";
|
2023-11-09 13:34:34 +01:00
|
|
|
import {UserManagementService} from "./openaireLibrary/services/user-management.service";
|
2023-11-14 15:13:09 +01:00
|
|
|
import {Session, User} from "./openaireLibrary/login/utils/helper.class";
|
2023-11-13 14:00:45 +01:00
|
|
|
import {SmoothScroll} from "./openaireLibrary/utils/smooth-scroll";
|
2023-11-24 09:55:49 +01:00
|
|
|
import {LayoutService} from "./openaireLibrary/dashboard/sharedComponents/sidebar/layout.service";
|
2023-12-08 14:35:51 +01:00
|
|
|
import {StakeholderUtils} from "./openaireLibrary/monitor-admin/utils/indicator-utils";
|
|
|
|
import {ResearcherBaseComponent} from "./shared/researcher-base.component";
|
2023-12-19 16:23:59 +01:00
|
|
|
import {UserProfileService} from "./openaireLibrary/services/userProfile.service";
|
2023-12-22 10:21:14 +01:00
|
|
|
import {SearchOrcidService} from "./openaireLibrary/claims/claim-utils/service/searchOrcid.service";
|
|
|
|
import {SearchResearchResultsService} from "./openaireLibrary/services/searchResearchResults.service";
|
|
|
|
import {Identifier} from "./openaireLibrary/utils/string-utils.class";
|
2023-10-23 14:26:21 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-root',
|
|
|
|
template: `
|
2023-10-23 15:46:00 +02:00
|
|
|
<div *ngIf="loading">
|
|
|
|
<loading [full]="true"></loading>
|
|
|
|
</div>
|
2023-11-24 09:55:49 +01:00
|
|
|
<div *ngIf="!loading" class="uk-background-default">
|
|
|
|
<navbar *ngIf="hasHeader" portal="irish_monitor" [menuItems]="menuItems" [showMenu]="true"
|
|
|
|
[header]="header" [user]="user" [userMenuItems]="userMenuItems"></navbar>
|
|
|
|
<div [ngClass]="rootClass">
|
2023-10-23 15:46:00 +02:00
|
|
|
<div id="modal-container"></div>
|
2023-11-13 14:00:45 +01:00
|
|
|
<main>
|
|
|
|
<router-outlet></router-outlet>
|
|
|
|
</main>
|
2023-10-23 15:46:00 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-12-06 14:14:43 +01:00
|
|
|
<cookie-law *ngIf="isClient" position="bottom" cookieName="cookieLawSeen-NOAMIreland">
|
2023-12-08 14:35:51 +01:00
|
|
|
National Open Access Monitor - Ireland, 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 National Open Access Monitor - Ireland portal you accept our use of cookies. <!--<a
|
2023-12-06 14:14:43 +01:00
|
|
|
href="https://www.openaire.eu/privacy-policy#cookies" 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>
|
2023-12-15 10:37:20 +01:00
|
|
|
<!--<cookie-law *ngIf="isClient" position="top" cookieName="logActions-NOAMIreland">
|
|
|
|
National Open Access Monitor - Ireland, creates public logs for user actions.<br>
|
|
|
|
By using the National Open Access Monitor - Ireland portal you consent to log your actions <a
|
|
|
|
routerLink="/public-logs"> View Public logs <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>-->
|
2024-01-08 13:37:02 +01:00
|
|
|
<footer class="uk-text-center uk-text-small">
|
|
|
|
<div class="uk-tile-default">
|
|
|
|
<div class="uk-section uk-container uk-container-small">
|
|
|
|
<div class="uk-flex uk-flex-middle uk-flex-center uk-margin-medium-bottom">
|
|
|
|
<img src="assets/logo/small.svg" alt="National Open Access Monitor Ireland" style="width: 40px;"/>
|
|
|
|
<div class="uk-margin-small-left">
|
|
|
|
Platform in <span class="uk-text-bold">Pilot</span> Phase - Final Release June 2024
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
Developed by <a href="https://www.openaire.eu/" target="_blank">OpenAIRE</a>,
|
|
|
|
in collaboration with Irish Research eLibrary (IReL) and Education Procurement Services. Your feedback is welcome as we refine our services for final launch.
|
|
|
|
<a routerLink="/contact-us">Contact us</a>.
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</footer>
|
2023-11-13 14:00:45 +01:00
|
|
|
`
|
2023-10-23 14:26:21 +02:00
|
|
|
})
|
2023-12-08 14:35:51 +01:00
|
|
|
export class AppComponent extends ResearcherBaseComponent implements OnInit {
|
2023-10-23 15:46:00 +02:00
|
|
|
loading: boolean = false;
|
2023-10-24 14:29:36 +02:00
|
|
|
hasHeader: boolean = true;
|
2023-11-24 09:55:49 +01:00
|
|
|
rootClass: string;
|
2023-10-27 14:53:59 +02:00
|
|
|
header: Header = {
|
2023-10-24 14:29:36 +02:00
|
|
|
route: "/",
|
|
|
|
title: "Noami",
|
2023-12-11 11:16:29 +01:00
|
|
|
logoUrl: 'assets/logo/main.svg',
|
2023-12-13 10:13:30 +01:00
|
|
|
logoSmallUrl: 'assets/logo/small.svg',
|
2023-10-24 14:29:36 +02:00
|
|
|
position: 'left',
|
2024-01-08 16:12:04 +01:00
|
|
|
badge: true
|
2023-10-24 14:29:36 +02:00
|
|
|
};
|
2023-12-08 14:35:51 +01:00
|
|
|
menuItems: MenuItem[] = [];
|
2023-11-14 15:13:09 +01:00
|
|
|
userMenuItems: MenuItem[] = [];
|
2023-11-02 15:39:57 +01:00
|
|
|
irish: Irish = new Irish();
|
2023-11-09 13:34:34 +01:00
|
|
|
user: User;
|
2023-12-08 14:35:51 +01:00
|
|
|
isClient: boolean = false;
|
|
|
|
stakeholderUtils: StakeholderUtils = new StakeholderUtils();
|
2023-10-27 14:53:59 +02:00
|
|
|
|
2023-11-09 13:34:34 +01:00
|
|
|
constructor(protected _route: ActivatedRoute,
|
|
|
|
protected _router: Router,
|
2023-12-06 14:33:14 +01:00
|
|
|
protected cdr: ChangeDetectorRef,
|
2023-11-24 09:55:49 +01:00
|
|
|
private layoutService: LayoutService,
|
2023-11-13 14:00:45 +01:00
|
|
|
private smoothScroll: SmoothScroll,
|
2023-11-24 09:55:49 +01:00
|
|
|
private configurationService: ConfigurationService,
|
2023-12-08 14:35:51 +01:00
|
|
|
private customFilterService: CustomFilterService,
|
|
|
|
private userManagementService: UserManagementService,
|
2023-12-22 10:21:14 +01:00
|
|
|
private userProfileService:UserProfileService,
|
|
|
|
protected _searchOrcidService: SearchOrcidService,
|
|
|
|
protected _searchResearchResultsService: SearchResearchResultsService
|
2023-12-08 14:35:51 +01:00
|
|
|
) {
|
2023-10-27 14:53:59 +02:00
|
|
|
super();
|
2023-11-09 13:34:34 +01:00
|
|
|
this.configurationService.initStaticPortal(this.irish.portal);
|
2023-12-19 16:30:39 +01:00
|
|
|
this.userManagementService.fixRedirectURL = this.properties.afterLoginRedirectLink;
|
2023-11-27 13:03:18 +01:00
|
|
|
}
|
2023-11-09 13:34:34 +01:00
|
|
|
|
2023-11-03 09:51:59 +01:00
|
|
|
ngOnDestroy() {
|
|
|
|
super.ngOnDestroy();
|
|
|
|
this.customFilterService.clearSubscriptions();
|
2023-11-13 14:00:45 +01:00
|
|
|
this.configurationService.clearSubscriptions();
|
|
|
|
this.smoothScroll.clearSubscriptions();
|
2023-12-19 16:23:59 +01:00
|
|
|
this.userProfileService.clearSubscriptions();
|
2023-11-03 09:51:59 +01:00
|
|
|
}
|
2023-10-27 14:53:59 +02:00
|
|
|
|
|
|
|
ngOnInit() {
|
2023-12-21 10:49:32 +01:00
|
|
|
this.isClient = typeof document !== 'undefined';
|
2024-01-08 16:12:04 +01:00
|
|
|
if(this.properties.environment == 'beta') {
|
|
|
|
this.header.environmentBadge = {
|
|
|
|
asset: 'assets/badge/sandbox.svg',
|
|
|
|
routerLink: '/about'
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
this.header.environmentBadge = {
|
|
|
|
asset: 'assets/badge/pilot.svg',
|
|
|
|
}
|
|
|
|
}
|
2023-11-24 09:55:49 +01:00
|
|
|
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
2023-11-09 13:34:34 +01:00
|
|
|
this.user = user;
|
2023-12-19 16:23:59 +01:00
|
|
|
if(user){
|
|
|
|
this.userProfileService.initUserProfile()
|
|
|
|
}else{
|
|
|
|
this.userProfileService.setUserProfile(null);
|
|
|
|
}
|
2023-11-09 13:34:34 +01:00
|
|
|
this.initialize();
|
2023-11-24 09:55:49 +01:00
|
|
|
}));
|
|
|
|
this.subscriptions.push(this.layoutService.rootClass.subscribe(rootClass => {
|
2023-12-21 10:49:32 +01:00
|
|
|
if(rootClass && this.isClient) {
|
|
|
|
let link = <HTMLLinkElement>document.getElementById('theme');
|
|
|
|
let append = false;
|
|
|
|
if(!link) {
|
|
|
|
link = document.createElement('link');
|
|
|
|
link.rel = 'stylesheet';
|
|
|
|
link.id = 'theme';
|
|
|
|
append = true;
|
|
|
|
}
|
|
|
|
link.href = rootClass + '.css';
|
|
|
|
link.onerror = (error) => console.log(error);
|
|
|
|
if(append) {
|
|
|
|
document.head.appendChild(link);
|
|
|
|
}
|
|
|
|
}
|
2023-11-24 09:55:49 +01:00
|
|
|
this.rootClass = rootClass;
|
2023-12-06 14:33:14 +01:00
|
|
|
this.cdr.detectChanges();
|
2023-11-24 09:55:49 +01:00
|
|
|
}));
|
2023-12-06 14:14:43 +01:00
|
|
|
|
2023-10-27 14:53:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
initialize() {
|
|
|
|
this.menuItems = [
|
2023-11-16 13:38:27 +01:00
|
|
|
new MenuItem("national", this.stakeholderUtils.entities.country + ' ' + this.stakeholderUtils.entities.stakeholder, "", "/", false, [], null, {}, null, null, null),
|
2023-11-15 16:40:20 +01:00
|
|
|
new MenuItem("rpo", this.stakeholderUtils.entities.organization + ' ' + this.stakeholderUtils.entities.stakeholders, "", "/rpo", false, [], null, {}, null, null, null, "/rpo"),
|
|
|
|
new MenuItem("rfo", this.stakeholderUtils.entities.funder + ' ' + this.stakeholderUtils.entities.stakeholders, "", "/rfo", false, [], null, {}, null, null, null, "/rfo"),
|
|
|
|
new MenuItem("researcher", "Researcher Monitors", "", "/researcher", false, [], null, {}, null, null, null, "/researcher"),
|
2023-11-27 13:03:18 +01:00
|
|
|
new MenuItem("repository", "Repository Monitors", "", "/repository", false, [], null, {}, null, null, null, "/repository"),
|
2024-01-08 15:57:55 +01:00
|
|
|
new MenuItem("resources", "Resources & Help", "", "", false, [], null, {}, null, null, null, "/resources","_blank", "internal", false,
|
|
|
|
[
|
|
|
|
new MenuItem("how-it-works", "How it works?", "", "", false, [], null, {}, null, null, null, null, "_self"),
|
|
|
|
new MenuItem("about", "About", "", "/how-it-works/about", false, [], null, {}, null, null, null, "/about"),
|
|
|
|
new MenuItem("the-5-monitors", "The 5 Monitors", "", "/how-it-works/the-5-monitors", false, [], null, {}, null, null, null, "/the-5-monitors"),
|
|
|
|
new MenuItem("user-actions", "User Actions", "", "/how-it-works/user-actions", false, [], null, {}, null, null, null, "/user-actions"),
|
|
|
|
new MenuItem("methodology", "Methodology", "", "", false, [], null, {}, null, null, null, null, "_self"),
|
|
|
|
new MenuItem("methodological-approach", "Methodological Approach", "", "/methodology/methodological-approach", false, [], null, {}, null, null, null, "/methodological-approach"),
|
|
|
|
new MenuItem("terminology-construction", "Terminology & Construction", "", "/methodology/terminology", false, [], null, {}, null, null, null, "/terminology"),
|
|
|
|
new MenuItem("", "", "", "", false, [], null, {}, null, null, null, null, "_self"),
|
|
|
|
new MenuItem("stats-logs", "Web Statistics & Activity Logs", "", "/stats-logs", false, [], null, {}, null, null, null, "/public-logs"),
|
|
|
|
new MenuItem("engagement-training", "Engagement & Training", "", "/engagement-training", false, [], null, {}, null, null, null, "/engagement-training"),
|
|
|
|
new MenuItem("support", "Support", "", "/support", false, [], null, {}, null, null, null, "/support"),
|
|
|
|
]
|
|
|
|
),
|
2023-10-27 14:53:59 +02:00
|
|
|
];
|
2023-12-08 14:35:51 +01:00
|
|
|
if (this.user) {
|
|
|
|
this.userMenuItems = [];
|
2023-12-13 10:13:30 +01:00
|
|
|
// this.user.orcid = '0000-0003-4768-182X';
|
2023-12-08 14:35:51 +01:00
|
|
|
if(this.user.orcid) {
|
2023-12-22 10:21:14 +01:00
|
|
|
this.authorId = Identifier.getRawORCID(this.user.orcid);
|
2023-12-08 14:35:51 +01:00
|
|
|
this.results = {
|
|
|
|
success: (res: string | number) => {
|
|
|
|
if(+res > 0) {
|
|
|
|
this.userMenuItems.push(new MenuItem("my-researcher", "My Researcher Monitor", "", "/researcher/" + this.authorId, false, [], null, {}, null, null, null, null));
|
|
|
|
this.staticUserItems();
|
2023-12-22 10:21:14 +01:00
|
|
|
}else{
|
|
|
|
this.staticUserItems();
|
2023-12-08 14:35:51 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.search();
|
|
|
|
} else {
|
|
|
|
this.staticUserItems();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-11-14 15:13:09 +01:00
|
|
|
|
2023-12-08 14:35:51 +01:00
|
|
|
staticUserItems() {
|
|
|
|
this.userMenuItems.push(
|
2023-11-14 16:25:08 +01:00
|
|
|
new MenuItem("myorcidlinks", "My Orcid links", "", "/my-orcid-links", false, [], null, {}, null, null, null, null),
|
2024-01-08 09:16:20 +01:00
|
|
|
new MenuItem("myclaims", "My links", "", "/participate/myclaims", false, [], null, {}, null, null, null, null),
|
2023-11-14 16:25:08 +01:00
|
|
|
new MenuItem("claims", "Link", "", "/participate/claim", false, [], null, {}, null, null, null, null),
|
|
|
|
new MenuItem("upload-dois", "Upload DOIs", "", "/upload-dois", false, [], null, {}, null, null, null, null)
|
2023-12-08 14:35:51 +01:00
|
|
|
);
|
|
|
|
if (this.isAdmin) {
|
|
|
|
this.userMenuItems.push(new MenuItem("stakeholders", "Manage profiles", "", "/admin", false, [], [], {}, {name: 'settings'}));
|
2023-11-14 15:13:09 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public get isAdmin() {
|
|
|
|
return Session.isPortalAdministrator(this.user) || Session.isMonitorCurator(this.user);
|
2023-10-23 15:46:00 +02:00
|
|
|
}
|
2023-10-23 14:26:21 +02:00
|
|
|
}
|