[master | DONE | CHANGED]: app.component.ts: Added method "setProperties()" to init portal | rpo.component.ts & rfo.component.ts & repository.component.ts & national.component.ts & users.component.ts: Call setProperties() method to init portal.

This commit is contained in:
Konstantina Galouni 2024-01-09 11:57:40 +02:00
parent 4e97275aa5
commit 6858fcb72c
6 changed files with 34 additions and 6 deletions

View File

@ -9,6 +9,7 @@ import {UserManagementService} from "../../openaireLibrary/services/user-managem
import {ActivatedRoute} from "@angular/router"; import {ActivatedRoute} from "@angular/router";
import {Title} from "@angular/platform-browser"; import {Title} from "@angular/platform-browser";
import {StringUtils} from "../../openaireLibrary/utils/string-utils.class"; import {StringUtils} from "../../openaireLibrary/utils/string-utils.class";
import {ConfigurationService} from "../../openaireLibrary/utils/configuration/configuration.service";
type Tab = 'member' | 'manager'; type Tab = 'member' | 'manager';
@ -30,7 +31,8 @@ export class UsersComponent extends StakeholderBaseComponent {
constructor(private stakeholderService: StakeholderService, constructor(private stakeholderService: StakeholderService,
private userManagementService: UserManagementService, private userManagementService: UserManagementService,
protected _route: ActivatedRoute, protected _route: ActivatedRoute,
protected _title: Title) { protected _title: Title,
private configurationService: ConfigurationService) {
super(); super();
} }
@ -50,6 +52,7 @@ export class UsersComponent extends StakeholderBaseComponent {
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => { this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
if (stakeholder) { if (stakeholder) {
this.stakeholder = stakeholder; this.stakeholder = stakeholder;
this.setProperties(this.stakeholder.alias, this.stakeholder.type, this.configurationService);
this.title = this.stakeholder.name + " | " + this.users; this.title = this.stakeholder.name + " | " + this.users;
this.setMetadata(); this.setMetadata();
this.link = this.getURL(this.stakeholder.alias); this.link = this.getURL(this.stakeholder.alias);

View File

@ -15,6 +15,7 @@ import {UserProfileService} from "./openaireLibrary/services/userProfile.service
import {SearchOrcidService} from "./openaireLibrary/claims/claim-utils/service/searchOrcid.service"; import {SearchOrcidService} from "./openaireLibrary/claims/claim-utils/service/searchOrcid.service";
import {SearchResearchResultsService} from "./openaireLibrary/services/searchResearchResults.service"; import {SearchResearchResultsService} from "./openaireLibrary/services/searchResearchResults.service";
import {Identifier} from "./openaireLibrary/utils/string-utils.class"; import {Identifier} from "./openaireLibrary/utils/string-utils.class";
import {ConnectHelper} from "./openaireLibrary/connect/connectHelper";
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
@ -103,7 +104,9 @@ export class AppComponent extends ResearcherBaseComponent implements OnInit {
protected _searchResearchResultsService: SearchResearchResultsService protected _searchResearchResultsService: SearchResearchResultsService
) { ) {
super(); 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.fixRedirectURL = this.properties.afterLoginRedirectLink;
this.userManagementService.allowDoubleRedirectToFixAndCurrentPage = true; 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() { public get isAdmin() {
return Session.isPortalAdministrator(this.user) || Session.isMonitorCurator(this.user); return Session.isPortalAdministrator(this.user) || Session.isMonitorCurator(this.user);
} }

View File

@ -13,6 +13,7 @@ import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sideb
import {OpenaireEntities} from "../openaireLibrary/utils/properties/searchFields"; import {OpenaireEntities} from "../openaireLibrary/utils/properties/searchFields";
import {RouterHelper} from "../openaireLibrary/utils/routerHelper.class"; import {RouterHelper} from "../openaireLibrary/utils/routerHelper.class";
import {StringUtils} from "../openaireLibrary/utils/string-utils.class"; import {StringUtils} from "../openaireLibrary/utils/string-utils.class";
import {ConfigurationService} from "../openaireLibrary/utils/configuration/configuration.service";
@Component({ @Component({
selector: 'national', selector: 'national',
@ -69,7 +70,8 @@ export class NationalComponent extends StakeholderBaseComponent implements OnIni
protected _piwikService: PiwikService, protected _piwikService: PiwikService,
protected _title: Title, protected _title: Title,
protected _meta: Meta, protected _meta: Meta,
private _customFilterService:CustomFilterService) { private _customFilterService:CustomFilterService,
private configurationService: ConfigurationService) {
super(); super();
super.initRouterParams(this._route, event => { super.initRouterParams(this._route, event => {
this.isSearch = event.url.includes('search'); 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.stakeholderService.getStakeholder(this._route.snapshot.data.stakeholder).subscribe(stakeholder => {
this.stakeholder = stakeholder; this.stakeholder = stakeholder;
if(this.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")]); this._customFilterService.setCustomFilter([new SearchCustomFilter("National", "country", "IE", "Irish National Monitor")]);
LinksResolver.resetProperties(); LinksResolver.resetProperties();
this.loading = false; this.loading = false;

View File

@ -13,6 +13,7 @@ import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sideb
import {OpenaireEntities} from "../openaireLibrary/utils/properties/searchFields"; import {OpenaireEntities} from "../openaireLibrary/utils/properties/searchFields";
import {SearchDataprovidersService} from "../openaireLibrary/services/searchDataproviders.service"; import {SearchDataprovidersService} from "../openaireLibrary/services/searchDataproviders.service";
import {UserManagementService} from "../openaireLibrary/services/user-management.service"; import {UserManagementService} from "../openaireLibrary/services/user-management.service";
import {ConfigurationService} from "../openaireLibrary/utils/configuration/configuration.service";
@Component({ @Component({
selector: 'repository', selector: 'repository',
@ -115,7 +116,8 @@ export class RepositoryComponent extends StakeholderBaseComponent implements OnI
protected seoService: SEOService, protected seoService: SEOService,
protected _piwikService: PiwikService, protected _piwikService: PiwikService,
protected _title: Title, protected _title: Title,
protected _meta: Meta) { protected _meta: Meta,
private configurationService: ConfigurationService) {
super(); super();
super.initRouterParams(this._route, event => { super.initRouterParams(this._route, event => {
this.isSearch = event.url.includes('search'); 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.subscriptions.push(this.stakeholderService.getStakeholder(this.alias, true).subscribe(stakeholder => {
this.stakeholder = stakeholder; this.stakeholder = stakeholder;
if (this.stakeholder && this.stakeholder.type === 'datasource') { if (this.stakeholder && this.stakeholder.type === 'datasource') {
this.setProperties(this.stakeholder.alias, this.stakeholder.type, this.configurationService);
LinksResolver.resetProperties(); LinksResolver.resetProperties();
LinksResolver.setSearchAndResultLanding("repository/" + this.stakeholder.alias); LinksResolver.setSearchAndResultLanding("repository/" + this.stakeholder.alias);
this._customFilterService.setCustomFilter( this._customFilterService.setCustomFilter(

View File

@ -11,6 +11,7 @@ import {CustomFilterService} from "../openaireLibrary/shared/customFilter.servic
import {StakeholderBaseComponent} from "../openaireLibrary/monitor-admin/utils/stakeholder-base.component"; import {StakeholderBaseComponent} from "../openaireLibrary/monitor-admin/utils/stakeholder-base.component";
import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service"; import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service";
import {OpenaireEntities} from "../openaireLibrary/utils/properties/searchFields"; import {OpenaireEntities} from "../openaireLibrary/utils/properties/searchFields";
import {ConfigurationService} from "../openaireLibrary/utils/configuration/configuration.service";
@Component({ @Component({
selector: 'rfo', selector: 'rfo',
@ -79,7 +80,8 @@ export class RfoComponent extends StakeholderBaseComponent implements OnInit {
protected seoService: SEOService, protected seoService: SEOService,
protected _piwikService: PiwikService, protected _piwikService: PiwikService,
protected _title: Title, protected _title: Title,
protected _meta: Meta) { protected _meta: Meta,
private configurationService: ConfigurationService) {
super(); super();
super.initRouterParams(this._route, event => { super.initRouterParams(this._route, event => {
this.isSearch = event.url.includes('search'); 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.subscriptions.push(this.stakeholderService.getStakeholder(this.alias, true).subscribe(stakeholder => {
this.stakeholder = stakeholder; this.stakeholder = stakeholder;
if (this.stakeholder && this.stakeholder.type === 'funder') { if (this.stakeholder && this.stakeholder.type === 'funder') {
this.setProperties(this.stakeholder.alias, this.stakeholder.type, this.configurationService);
LinksResolver.resetProperties(); LinksResolver.resetProperties();
LinksResolver.setSearchAndResultLanding("rfo/" + this.stakeholder.alias); LinksResolver.setSearchAndResultLanding("rfo/" + this.stakeholder.alias);
let value = this.stakeholder.index_id + "||" + this.stakeholder.index_name + "||" + this.stakeholder.index_shortName; let value = this.stakeholder.index_id + "||" + this.stakeholder.index_name + "||" + this.stakeholder.index_shortName;

View File

@ -13,6 +13,7 @@ import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sideb
import {OpenaireEntities} from "../openaireLibrary/utils/properties/searchFields"; import {OpenaireEntities} from "../openaireLibrary/utils/properties/searchFields";
import {RouterHelper} from "../openaireLibrary/utils/routerHelper.class"; import {RouterHelper} from "../openaireLibrary/utils/routerHelper.class";
import {StringUtils} from "../openaireLibrary/utils/string-utils.class"; import {StringUtils} from "../openaireLibrary/utils/string-utils.class";
import {ConfigurationService} from "../openaireLibrary/utils/configuration/configuration.service";
@Component({ @Component({
selector: 'rpo', selector: 'rpo',
@ -81,7 +82,8 @@ export class RpoComponent extends StakeholderBaseComponent implements OnInit {
protected seoService: SEOService, protected seoService: SEOService,
protected _piwikService: PiwikService, protected _piwikService: PiwikService,
protected _title: Title, protected _title: Title,
protected _meta: Meta) { protected _meta: Meta,
private configurationService: ConfigurationService) {
super(); super();
super.initRouterParams(this._route, event => { super.initRouterParams(this._route, event => {
this.isSearch = event.url.includes('search'); 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.subscriptions.push(this.stakeholderService.getStakeholder(this.alias, true).subscribe(stakeholder => {
this.stakeholder = stakeholder; this.stakeholder = stakeholder;
if (this.stakeholder && this.stakeholder.type === 'organization') { if (this.stakeholder && this.stakeholder.type === 'organization') {
this.setProperties(this.stakeholder.alias, this.stakeholder.type, this.configurationService);
LinksResolver.resetProperties(); LinksResolver.resetProperties();
LinksResolver.setSearchAndResultLanding("rpo/" + this.stakeholder.alias); LinksResolver.setSearchAndResultLanding("rpo/" + this.stakeholder.alias);
let value = this.stakeholder.index_id + "||" + this.stakeholder.index_name + "||" + this.stakeholder.index_shortName; let value = this.stakeholder.index_id + "||" + this.stakeholder.index_name + "||" + this.stakeholder.index_shortName;