add researcher monitor using a profile with alias "researcher"

This commit is contained in:
argirok 2024-01-11 18:19:44 +02:00
parent 0ef14ca586
commit 8b33b87d23
5 changed files with 88 additions and 91 deletions

View File

@ -1,39 +0,0 @@
import {Component, OnDestroy, OnInit} from "@angular/core";
import {Stakeholder} from "../../openaireLibrary/monitor/entities/stakeholder";
import {StakeholderService} from "../../openaireLibrary/monitor/services/stakeholder.service";
import {BaseComponent} from "../../openaireLibrary/sharedComponents/base/base.component";
import {ActivatedRoute, Router} from "@angular/router";
import {SEOService} from "../../openaireLibrary/sharedComponents/SEO/SEO.service";
import {PiwikService} from "../../openaireLibrary/utils/piwik/piwik.service";
import {Meta, Title} from "@angular/platform-browser";
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {SearchOrcidService} from "../../openaireLibrary/claims/claim-utils/service/searchOrcid.service";
import {properties} from "../../../environments/environment";
@Component({
selector: 'author',
template: `
<monitor-search-results ></monitor-search-results>
`
})
export class AuthorComponent extends BaseComponent implements OnInit {
constructor(private stakeholderService: StakeholderService,
private _searchOrcidService: SearchOrcidService,
protected _route: ActivatedRoute,
protected _router: Router,
protected seoService: SEOService,
protected _piwikService: PiwikService,
protected _title: Title,
protected _meta: Meta) {
super();
}
ngOnInit() {
}
}

View File

@ -1,18 +0,0 @@
import {NgModule} from "@angular/core";
import {CommonModule} from "@angular/common";
import {Route, RouterModule} from "@angular/router";
import {AuthorComponent} from "./author.component";
import {MonitorSearchResearchResultsModule} from "../../search/searchPages/simple/searchResearchResults.module";
const routes: Route[] = [
{
path: '', component: AuthorComponent
}
];
@NgModule({
imports: [CommonModule, RouterModule.forChild(routes), MonitorSearchResearchResultsModule],
declarations: [AuthorComponent],
exports: [AuthorComponent],
})
export class AuthorModule {
}

View File

@ -12,6 +12,9 @@ import {ResearcherBaseComponent} from "../shared/researcher-base.component";
import {LinksResolver} from "../search/links-resolver"; import {LinksResolver} from "../search/links-resolver";
import {SearchCustomFilter} from "../openaireLibrary/searchPages/searchUtils/searchUtils.class"; import {SearchCustomFilter} from "../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {properties} from "../../environments/environment"; import {properties} from "../../environments/environment";
import {StakeholderService} from "../openaireLibrary/monitor/services/stakeholder.service";
import {ConfigurationService} from "../openaireLibrary/utils/configuration/configuration.service";
import {OpenaireEntities} from "../openaireLibrary/utils/properties/searchFields";
@Component({ @Component({
selector: 'researcher', selector: 'researcher',
@ -56,6 +59,23 @@ import {properties} from "../../environments/environment";
<h1 *ngIf="!authorId" class="uk-h3 uk-margin-small-bottom">Researcher Monitors</h1> <h1 *ngIf="!authorId" class="uk-h3 uk-margin-small-bottom">Researcher Monitors</h1>
</div> </div>
</div> </div>
<div *ngIf="stakeholder" class="uk-banner-footer">
<div class="uk-container uk-container-large uk-flex uk-flex-between">
<ul class="uk-banner-tab uk-padding-small uk-padding-remove-vertical">
<li [class.uk-active]="!isSearch">
<a [routerLink]="['./', stakeholder.alias]" [relativeTo]="_route" (click)="isSearch = false">
{{entities.stakeholder}}
</a>
</li>
<li [class.uk-active]="isSearch">
<a [routerLink]="['./', stakeholder.alias, 'search']" [queryParams]="routerHelper.createQueryParams(['type','peerreviewed'], [quote('publications'), quote('true')])" [relativeTo]="_route">
Browse {{openaireEntities.RESULTS}}
</a>
</li>
</ul>
</div>
</div>
</div> </div>
<div class="uk-container uk-container-large uk-margin-medium-top uk-margin-medium-bottom"> <div class="uk-container uk-container-large uk-margin-medium-top uk-margin-medium-bottom">
<router-outlet></router-outlet> <router-outlet></router-outlet>
@ -67,7 +87,9 @@ export class ResearcherComponent extends ResearcherBaseComponent implements OnIn
totalResults: number; totalResults: number;
openResults: number; openResults: number;
loading: boolean = false; loading: boolean = false;
stakeholder;
isSearch: boolean = false;
openaireEntities = OpenaireEntities;
constructor(protected _router: Router, constructor(protected _router: Router,
protected _route: ActivatedRoute, protected _route: ActivatedRoute,
protected seoService: SEOService, protected seoService: SEOService,
@ -77,9 +99,13 @@ export class ResearcherComponent extends ResearcherBaseComponent implements OnIn
protected _searchOrcidService: SearchOrcidService, protected _searchOrcidService: SearchOrcidService,
protected _searchResearchResultsService: SearchResearchResultsService, protected _searchResearchResultsService: SearchResearchResultsService,
private _customFilterService: CustomFilterService, private _customFilterService: CustomFilterService,
private layoutService: LayoutService) { private layoutService: LayoutService,
private stakeholderService: StakeholderService,
private configurationService: ConfigurationService) {
super(); super();
super.initRouterParams(this._route); super.initRouterParams(this._route, event => {
this.isSearch = event.url.includes('/search');
});
} }
@ -87,18 +113,27 @@ export class ResearcherComponent extends ResearcherBaseComponent implements OnIn
this.layoutService.setRootClass('researcher'); this.layoutService.setRootClass('researcher');
this.params.subscribe(params => { this.params.subscribe(params => {
this.authorId = params['stakeholder']; this.authorId = params['stakeholder'];
if (this.authorId) {
if(this.stakeholder?.index_id !== this.authorId) {
this.loading = true;
this.author = null; this.author = null;
this._customFilterService.setCustomFilter([]); this._customFilterService.setCustomFilter([]);
if (this.authorId) {
this.loading = true;
LinksResolver.resetProperties();
LinksResolver.setSearchAndResultLanding("researcher/" + this.authorId);
this.orcid = { this.orcid = {
success: () => { success: () => {
let name = this.author.authorGivenName + " " + this.author.authorFamilyName?this.author.authorFamilyName:"";
this._customFilterService.setCustomFilter( this._customFilterService.setCustomFilter(
[new SearchCustomFilter("National", "country", "IE", "Irish National Monitor", false), [new SearchCustomFilter("National", "country", "IE", "Irish National Monitor", false),
new SearchCustomFilter("Orcid", "authorId", this.authorId, this.author.authorGivenName + " " + this.author.authorFamilyName) new SearchCustomFilter("Orcid", "authorId", this.authorId, name)
]); ]);
this.title = name;
this.description = name;
this.setProperties(this.orcid, "researcher", this.configurationService);
LinksResolver.resetProperties();
LinksResolver.setSearchAndResultLanding("researcher/" + this.authorId);
this.setMetadata();
}, },
error: () => { error: () => {
this._router.navigate([properties.errorLink]); this._router.navigate([properties.errorLink]);
@ -111,6 +146,10 @@ export class ResearcherComponent extends ResearcherBaseComponent implements OnIn
this._router.navigate([properties.errorLink]); this._router.navigate([properties.errorLink]);
}else{ }else{
this.loading = false; this.loading = false;
this.subscriptions.push(this.stakeholderService.getResearcherStakeholder(this.authorId,"",this.totalResults, true).subscribe(stakeholder => {
this.stakeholder = stakeholder;
}));
this.subscriptions.push(this._searchResearchResultsService.numOfResearchOutcomes(this.param + ' and (resultbestaccessright exact "Open Access") and (peerreviewed exact "true")', properties, null).subscribe(res => { this.subscriptions.push(this._searchResearchResultsService.numOfResearchOutcomes(this.param + ' and (resultbestaccessright exact "Open Access") and (peerreviewed exact "true")', properties, null).subscribe(res => {
this.openResults = +res; this.openResults = +res;
})); }));
@ -118,6 +157,19 @@ export class ResearcherComponent extends ResearcherBaseComponent implements OnIn
} }
} }
this.search(); this.search();
/* } else {
this._router.navigate([properties.errorLink]);
}
}));*/
}
} else {
this.stakeholder = null;
this.author = null;
this._customFilterService.setCustomFilter([]);
this.title = 'Researcher Monitors';
this.description = 'Researcher Monitors';
this.setMetadata();
} }
}); });
} }

View File

@ -8,13 +8,14 @@ import {LoadingModule} from "../openaireLibrary/utils/loading/loading.module";
import {IconsModule} from '../openaireLibrary/utils/icons/icons.module'; import {IconsModule} from '../openaireLibrary/utils/icons/icons.module';
import {IconsService} from '../openaireLibrary/utils/icons/icons.service'; import {IconsService} from '../openaireLibrary/utils/icons/icons.service';
import {open_access} from '../openaireLibrary/utils/icons/icons'; import {open_access} from '../openaireLibrary/utils/icons/icons';
import {SandboxGuard} from "../shared/sandbox.guard";
const routes: Route[] = [ const routes: Route[] = [
{ {
path: '', component: ResearcherComponent, children: [ path: '', component: ResearcherComponent, children: [
{path: '', loadChildren: () => import('./search-researcher/search-researcher.module').then(m => m.SearchResearcherModule)}, {path: '', loadChildren: () => import('./search-researcher/search-researcher.module').then(m => m.SearchResearcherModule)},
{path: ':stakeholder', loadChildren: () => import('./author/author.module').then(m => m.AuthorModule)}, {path: ':stakeholder/search', loadChildren: () => import('../search/resultLanding.module').then(m => m.ResultLandingModule)},
{path: ':stakeholder/search', loadChildren: () => import('../search/resultLanding.module').then(m => m.ResultLandingModule)} {path: ':stakeholder', loadChildren: () => import('../shared/monitor/monitor.module').then(m => m.MonitorModule), canActivateChild: [SandboxGuard]}
] ]
} }
]; ];

View File

@ -4,6 +4,7 @@ import {SearchOrcidService} from "../openaireLibrary/claims/claim-utils/service/
import {SearchResearchResultsService} from "../openaireLibrary/services/searchResearchResults.service"; import {SearchResearchResultsService} from "../openaireLibrary/services/searchResearchResults.service";
import {properties} from "../../environments/environment"; import {properties} from "../../environments/environment";
import {StringUtils} from "../openaireLibrary/utils/string-utils.class"; import {StringUtils} from "../openaireLibrary/utils/string-utils.class";
import {StakeholderBaseComponent} from "../openaireLibrary/monitor-admin/utils/stakeholder-base.component";
interface Resolver { interface Resolver {
success?: Function; success?: Function;
@ -11,7 +12,7 @@ interface Resolver {
} }
@Directive() @Directive()
export class ResearcherBaseComponent extends BaseComponent { export class ResearcherBaseComponent extends StakeholderBaseComponent {
author: any; author: any;
authorId: string; authorId: string;
orcid: Resolver; orcid: Resolver;