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";
|
|
|
|
import {StakeholderBaseComponent} from "./openaireLibrary/monitor-admin/utils/stakeholder-base.component";
|
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";
|
|
|
|
import {SearchOrcidService} from "./openaireLibrary/claims/claim-utils/service/searchOrcid.service";
|
|
|
|
import {SearchResearchResultsService} from "./openaireLibrary/services/searchResearchResults.service";
|
|
|
|
import {properties} from "../environments/environment";
|
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>-->
|
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',
|
2023-10-27 14:53:59 +02: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-12-08 14:35:51 +01:00
|
|
|
protected _searchOrcidService: SearchOrcidService,
|
|
|
|
protected _searchResearchResultsService: SearchResearchResultsService,
|
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-10-27 14:53:59 +02:00
|
|
|
super();
|
2023-11-09 13:34:34 +01:00
|
|
|
this.configurationService.initStaticPortal(this.irish.portal);
|
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-11-03 09:51:59 +01:00
|
|
|
}
|
2023-10-27 14:53:59 +02:00
|
|
|
|
|
|
|
ngOnInit() {
|
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;
|
|
|
|
this.initialize();
|
2023-11-24 09:55:49 +01:00
|
|
|
}));
|
|
|
|
this.subscriptions.push(this.layoutService.rootClass.subscribe(rootClass => {
|
|
|
|
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
|
|
|
if (typeof document !== 'undefined') {
|
|
|
|
this.isClient = true;
|
|
|
|
}
|
|
|
|
|
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"),
|
2023-12-13 16:41:38 +01:00
|
|
|
new MenuItem("resources", "Resources", "", "", false, [], null, {}, null, null, null,
|
2023-12-14 09:43:36 +01:00
|
|
|
"/resources","_blank", "internal", false, [new MenuItem("public-logs", "Public logs", "", "/public-logs", false, [], null, {}, null, null, null, "/public-logs")]),
|
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) {
|
|
|
|
this.authorId = this.user.orcid;
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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),
|
|
|
|
new MenuItem("myclaims", "My claims", "", "/participate/myclaims", false, [], null, {}, null, null, null, null),
|
|
|
|
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
|
|
|
}
|