From 5e47e4c237bd5a9ec9a02540a5feaed455dd01c8 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 11 Jan 2024 16:04:38 +0200 Subject: [PATCH] [master | FIXED]: Fix glitch with styles and dubbed sidabar items. --- src/app/admin/admin.component.ts | 3 +- src/app/app.component.ts | 154 ++++++++++++++++--------------- 2 files changed, 81 insertions(+), 76 deletions(-) diff --git a/src/app/admin/admin.component.ts b/src/app/admin/admin.component.ts index dd6298e..491455f 100644 --- a/src/app/admin/admin.component.ts +++ b/src/app/admin/admin.component.ts @@ -58,12 +58,13 @@ export class AdminComponent extends SidebarBaseComponent implements OnInit { this.stakeholder = stakeholder; this.setProperties(this.stakeholder.alias, this.stakeholder.type); this.layoutService.setRootClass(this.stakeholder.type); + this.sideBarItems = []; this.sideBarItems.push(new MenuItem("general", "General", "", "/admin/" + this.stakeholder.alias, false, [], [], {}, {name: 'badge'})); this.sideBarItems.push(new MenuItem("indicators", "Indicators", "", "/admin/" + this.stakeholder.alias + '/indicators', false, [], [], {}, {name: 'bar_chart'}, null, "uk-visible@m")); if (this.stakeholder.defaultId) { this.sideBarItems.push(new MenuItem("users", "Users", "", "/admin/" + this.stakeholder.alias + '/users', false, [], [], {}, {name: 'group'}, null, "uk-visible@m", "/admin/" + this.stakeholder.alias + "/users")); } - if (this.isAdmin) { + if (this.isAdmin && this.stakeholder.defaultId) { this.sideBarItems.push(new MenuItem("admin-tools", "Pages & Entities", "", "/admin/" + this.stakeholder.alias + "/admin-tools/pages", false, [], [], {}, {name: 'description'}, null, "uk-visible@m", "/admin/" + this.stakeholder.alias + "/admin-tools")); } if (this.hasAdminMenu) { diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 9a01fc8..d1f1bd9 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,4 +1,4 @@ -import {ChangeDetectorRef, Component, OnInit} from '@angular/core'; +import {AfterViewInit, ChangeDetectorRef, Component, OnInit} from '@angular/core'; import {ActivatedRoute, Router} from "@angular/router"; import {MenuItem} from "./openaireLibrary/sharedComponents/menu"; import {Header} from "./openaireLibrary/sharedComponents/navigationBar.component"; @@ -20,13 +20,13 @@ import {ConnectHelper} from "./openaireLibrary/connect/connectHelper"; @Component({ selector: 'app-root', template: ` -
- -
-
+
-
+
+ +
+
@@ -44,49 +44,46 @@ import {ConnectHelper} from "./openaireLibrary/connect/connectHelper"; points="7 4 13 10 7 16"> --> -
-
-
-
- National Open Access Monitor Ireland -
- Platform in Pilot Phase - Final Release June 2024 +
+
+
+ National Open Access Monitor Ireland +
+ Platform in Pilot Phase - Final Release June 2024 +
+ +
+
+ Developed by OpenAIRE +
+
+ The National Open Access Monitor, Ireland is delivered as part of the National Open Access Monitor + Project, + managed by the Irish Research eLibrary (IReL) at + Maynooth University. + The project has received funding from Ireland's National + Open Research Forum (NORF) + under the Open Research Fund Call. +
+
+ + + + + +
- -
-
- Developed by OpenAIRE -
-
- The National Open Access Monitor, Ireland is delivered as part of the National Open Access Monitor Project, - managed by the Irish Research eLibrary (IReL) at Maynooth University. - The project has received funding from Ireland's National Open Research Forum (NORF) - under the Open Research Fund Call. -
-
- - - - - - -
- -
` }) -export class AppComponent extends ResearcherBaseComponent implements OnInit { +export class AppComponent extends ResearcherBaseComponent implements OnInit, AfterViewInit { loading: boolean = false; hasHeader: boolean = true; rootClass: string; @@ -113,7 +110,7 @@ export class AppComponent extends ResearcherBaseComponent implements OnInit { private configurationService: ConfigurationService, private customFilterService: CustomFilterService, private userManagementService: UserManagementService, - private userProfileService:UserProfileService, + private userProfileService: UserProfileService, protected _searchOrcidService: SearchOrcidService, protected _searchResearchResultsService: SearchResearchResultsService ) { @@ -123,7 +120,7 @@ export class AppComponent extends ResearcherBaseComponent implements OnInit { this.setProperties(this.properties.adminToolsCommunity, this.properties.adminToolsPortalType); this.userManagementService.fixRedirectURL = this.properties.afterLoginRedirectLink; this.userManagementService.allowDoubleRedirectToFixAndCurrentPage = true; - } + } ngOnDestroy() { super.ngOnDestroy(); @@ -135,7 +132,7 @@ export class AppComponent extends ResearcherBaseComponent implements OnInit { ngOnInit() { this.isClient = typeof document !== 'undefined'; - if(this.properties.environment == 'beta') { + if (this.properties.environment == 'beta') { this.header.environmentBadge = { asset: 'assets/badge/sandbox.svg' } @@ -147,18 +144,23 @@ export class AppComponent extends ResearcherBaseComponent implements OnInit { } this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { this.user = user; - if(user){ + if (user) { this.userProfileService.initUserProfile() - }else{ + } else { this.userProfileService.setUserProfile(null); } this.initialize(); })); + } + + ngAfterViewInit() { this.subscriptions.push(this.layoutService.rootClass.subscribe(rootClass => { - if(rootClass && this.isClient) { + this.loading = true; + this.cdr.detectChanges(); + if (rootClass && this.isClient) { let link = document.getElementById('theme'); let append = false; - if(!link) { + if (!link) { link = document.createElement('link'); link.rel = 'stylesheet'; link.id = 'theme'; @@ -166,14 +168,17 @@ export class AppComponent extends ResearcherBaseComponent implements OnInit { } link.href = rootClass + '.css'; link.onerror = (error) => console.log(error); - if(append) { + if (append) { document.head.appendChild(link); } } this.rootClass = rootClass; this.cdr.detectChanges(); + setTimeout(() => { + this.loading = false; + this.cdr.detectChanges(); + }, 500) })); - } initialize() { @@ -184,36 +189,35 @@ export class AppComponent extends ResearcherBaseComponent implements OnInit { new MenuItem("researcher", "Researcher Monitors", "", "/researcher", false, [], null, {}, null, null, null, "/researcher"), new MenuItem("repository", "Repository Monitors", "", "/repository", false, [], null, {}, null, null, null, "/repository") ]; - if(this.properties.environment != "beta"){ + if (this.properties.environment != "beta") { this.menuItems.push( - 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, "/how-it-works/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, "/how-it-works/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, "/methodology/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, "/stats-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"), - ] - ) + 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, "/how-it-works/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, "/how-it-works/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, "/methodology/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, "/stats-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"), + ] + ) ) } if (this.user) { this.userMenuItems = []; - // this.user.orcid = '0000-0003-4768-182X'; - if(this.user.orcid) { + if (this.user.orcid) { this.authorId = Identifier.getRawORCID(this.user.orcid); this.results = { success: (res: string | number) => { - if(+res > 0) { + if (+res > 0) { this.userMenuItems.push(new MenuItem("my-researcher", "My Researcher Monitor", "", "/researcher/" + this.authorId, false, [], null, {}, null, null, null, null)); this.staticUserItems(); - }else{ + } else { this.staticUserItems(); } } @@ -236,10 +240,10 @@ export class AppComponent extends ResearcherBaseComponent implements OnInit { this.userMenuItems.push(new MenuItem("stakeholders", "Manage profiles", "", "/admin", false, [], [], {}, {name: 'settings'})); } if (Session.isPortalAdministrator(this.user)) { - this.userMenuItems.push(new MenuItem("adminOptions", "Super Admin options", "", "/admin/admin-tools/portals", false, [], [], {},null, null, "uk-visible@m")); + this.userMenuItems.push(new MenuItem("adminOptions", "Super Admin options", "", "/admin/admin-tools/portals", false, [], [], {}, null, null, "uk-visible@m")); } - if(Session.isPortalAdministrator(this.user) || Session.isCurator('country', this.user)) { - this.userMenuItems.push(new MenuItem("irishOptions", "Irish options", "", "/admin/irish/admin-tools/pages", false, [], [], {},null, null, "uk-visible@m")); + if (Session.isPortalAdministrator(this.user) || Session.isCurator('country', this.user)) { + this.userMenuItems.push(new MenuItem("irishOptions", "Irish options", "", "/admin/irish/admin-tools/pages", false, [], [], {}, null, null, "uk-visible@m")); } }