diff --git a/src/app/admin/users/users.component.ts b/src/app/admin/users/users.component.ts index 67fcee3..24d0f6f 100644 --- a/src/app/admin/users/users.component.ts +++ b/src/app/admin/users/users.component.ts @@ -9,6 +9,7 @@ import {UserManagementService} from "../../openaireLibrary/services/user-managem import {ActivatedRoute} from "@angular/router"; import {Title} from "@angular/platform-browser"; import {StringUtils} from "../../openaireLibrary/utils/string-utils.class"; +import {ConfigurationService} from "../../openaireLibrary/utils/configuration/configuration.service"; type Tab = 'member' | 'manager'; @@ -30,7 +31,8 @@ export class UsersComponent extends StakeholderBaseComponent { constructor(private stakeholderService: StakeholderService, private userManagementService: UserManagementService, protected _route: ActivatedRoute, - protected _title: Title) { + protected _title: Title, + private configurationService: ConfigurationService) { super(); } @@ -50,6 +52,7 @@ export class UsersComponent extends StakeholderBaseComponent { this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => { if (stakeholder) { this.stakeholder = stakeholder; + this.setProperties(this.stakeholder.alias, this.stakeholder.type, this.configurationService); this.title = this.stakeholder.name + " | " + this.users; this.setMetadata(); this.link = this.getURL(this.stakeholder.alias); diff --git a/src/app/app.component.ts b/src/app/app.component.ts index e549104..14c0c42 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -15,6 +15,7 @@ import {UserProfileService} from "./openaireLibrary/services/userProfile.service 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"; +import {ConnectHelper} from "./openaireLibrary/connect/connectHelper"; @Component({ selector: 'app-root', @@ -103,7 +104,9 @@ export class AppComponent extends ResearcherBaseComponent implements OnInit { protected _searchResearchResultsService: SearchResearchResultsService ) { super(); - this.configurationService.initStaticPortal(this.irish.portal); + // this.configurationService.initStaticPortal(this.irish.portal); + // this.configurationService.initPortal(this.properties, this.properties.adminToolsCommunity); + this.setProperties(this.properties.adminToolsCommunity, this.properties.adminToolsPortalType); this.userManagementService.fixRedirectURL = this.properties.afterLoginRedirectLink; this.userManagementService.allowDoubleRedirectToFixAndCurrentPage = true; } @@ -216,6 +219,16 @@ export class AppComponent extends ResearcherBaseComponent implements OnInit { } } + setProperties(id, type = null) { + this.properties.adminToolsCommunity = id; + if (type) { + this.properties.adminToolsPortalType = type; + } else { + ConnectHelper.setPortalTypeFromPid(id); + } + this.configurationService.initPortal(this.properties, this.properties.adminToolsCommunity); + } + public get isAdmin() { return Session.isPortalAdministrator(this.user) || Session.isMonitorCurator(this.user); } diff --git a/src/app/national/national.component.ts b/src/app/national/national.component.ts index 2f7b293..de0d01f 100644 --- a/src/app/national/national.component.ts +++ b/src/app/national/national.component.ts @@ -13,6 +13,7 @@ import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sideb import {OpenaireEntities} from "../openaireLibrary/utils/properties/searchFields"; import {RouterHelper} from "../openaireLibrary/utils/routerHelper.class"; import {StringUtils} from "../openaireLibrary/utils/string-utils.class"; +import {ConfigurationService} from "../openaireLibrary/utils/configuration/configuration.service"; @Component({ selector: 'national', @@ -69,7 +70,8 @@ export class NationalComponent extends StakeholderBaseComponent implements OnIni protected _piwikService: PiwikService, protected _title: Title, protected _meta: Meta, - private _customFilterService:CustomFilterService) { + private _customFilterService:CustomFilterService, + private configurationService: ConfigurationService) { super(); super.initRouterParams(this._route, event => { this.isSearch = event.url.includes('search'); @@ -81,6 +83,7 @@ export class NationalComponent extends StakeholderBaseComponent implements OnIni this.stakeholderService.getStakeholder(this._route.snapshot.data.stakeholder).subscribe(stakeholder => { this.stakeholder = stakeholder; if(this.stakeholder) { + this.setProperties(this.stakeholder.alias, this.stakeholder.type, this.configurationService); this._customFilterService.setCustomFilter([new SearchCustomFilter("National", "country", "IE", "Irish National Monitor")]); LinksResolver.resetProperties(); this.loading = false; diff --git a/src/app/repository/repository.component.ts b/src/app/repository/repository.component.ts index 0335a73..442a926 100644 --- a/src/app/repository/repository.component.ts +++ b/src/app/repository/repository.component.ts @@ -13,6 +13,7 @@ import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sideb import {OpenaireEntities} from "../openaireLibrary/utils/properties/searchFields"; import {SearchDataprovidersService} from "../openaireLibrary/services/searchDataproviders.service"; import {UserManagementService} from "../openaireLibrary/services/user-management.service"; +import {ConfigurationService} from "../openaireLibrary/utils/configuration/configuration.service"; @Component({ selector: 'repository', @@ -115,7 +116,8 @@ export class RepositoryComponent extends StakeholderBaseComponent implements OnI protected seoService: SEOService, protected _piwikService: PiwikService, protected _title: Title, - protected _meta: Meta) { + protected _meta: Meta, + private configurationService: ConfigurationService) { super(); super.initRouterParams(this._route, event => { this.isSearch = event.url.includes('search'); @@ -135,6 +137,7 @@ export class RepositoryComponent extends StakeholderBaseComponent implements OnI this.subscriptions.push(this.stakeholderService.getStakeholder(this.alias, true).subscribe(stakeholder => { this.stakeholder = stakeholder; if (this.stakeholder && this.stakeholder.type === 'datasource') { + this.setProperties(this.stakeholder.alias, this.stakeholder.type, this.configurationService); LinksResolver.resetProperties(); LinksResolver.setSearchAndResultLanding("repository/" + this.stakeholder.alias); this._customFilterService.setCustomFilter( diff --git a/src/app/rfo/rfo.component.ts b/src/app/rfo/rfo.component.ts index 2824620..27d3840 100644 --- a/src/app/rfo/rfo.component.ts +++ b/src/app/rfo/rfo.component.ts @@ -11,6 +11,7 @@ import {CustomFilterService} from "../openaireLibrary/shared/customFilter.servic import {StakeholderBaseComponent} from "../openaireLibrary/monitor-admin/utils/stakeholder-base.component"; import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service"; import {OpenaireEntities} from "../openaireLibrary/utils/properties/searchFields"; +import {ConfigurationService} from "../openaireLibrary/utils/configuration/configuration.service"; @Component({ selector: 'rfo', @@ -79,7 +80,8 @@ export class RfoComponent extends StakeholderBaseComponent implements OnInit { protected seoService: SEOService, protected _piwikService: PiwikService, protected _title: Title, - protected _meta: Meta) { + protected _meta: Meta, + private configurationService: ConfigurationService) { super(); super.initRouterParams(this._route, event => { this.isSearch = event.url.includes('search'); @@ -100,6 +102,7 @@ export class RfoComponent extends StakeholderBaseComponent implements OnInit { this.subscriptions.push(this.stakeholderService.getStakeholder(this.alias, true).subscribe(stakeholder => { this.stakeholder = stakeholder; if (this.stakeholder && this.stakeholder.type === 'funder') { + this.setProperties(this.stakeholder.alias, this.stakeholder.type, this.configurationService); LinksResolver.resetProperties(); LinksResolver.setSearchAndResultLanding("rfo/" + this.stakeholder.alias); let value = this.stakeholder.index_id + "||" + this.stakeholder.index_name + "||" + this.stakeholder.index_shortName; diff --git a/src/app/rpo/rpo.component.ts b/src/app/rpo/rpo.component.ts index 22fd4f8..60557c8 100644 --- a/src/app/rpo/rpo.component.ts +++ b/src/app/rpo/rpo.component.ts @@ -13,6 +13,7 @@ import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sideb import {OpenaireEntities} from "../openaireLibrary/utils/properties/searchFields"; import {RouterHelper} from "../openaireLibrary/utils/routerHelper.class"; import {StringUtils} from "../openaireLibrary/utils/string-utils.class"; +import {ConfigurationService} from "../openaireLibrary/utils/configuration/configuration.service"; @Component({ selector: 'rpo', @@ -81,7 +82,8 @@ export class RpoComponent extends StakeholderBaseComponent implements OnInit { protected seoService: SEOService, protected _piwikService: PiwikService, protected _title: Title, - protected _meta: Meta) { + protected _meta: Meta, + private configurationService: ConfigurationService) { super(); super.initRouterParams(this._route, event => { this.isSearch = event.url.includes('search'); @@ -102,6 +104,7 @@ export class RpoComponent extends StakeholderBaseComponent implements OnInit { this.subscriptions.push(this.stakeholderService.getStakeholder(this.alias, true).subscribe(stakeholder => { this.stakeholder = stakeholder; if (this.stakeholder && this.stakeholder.type === 'organization') { + this.setProperties(this.stakeholder.alias, this.stakeholder.type, this.configurationService); LinksResolver.resetProperties(); LinksResolver.setSearchAndResultLanding("rpo/" + this.stakeholder.alias); let value = this.stakeholder.index_id + "||" + this.stakeholder.index_name + "||" + this.stakeholder.index_shortName;