add researcher monitor using a profile with alias "researcher"
This commit is contained in:
parent
0ef14ca586
commit
8b33b87d23
|
@ -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() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -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 {
|
||||
}
|
|
@ -12,6 +12,9 @@ import {ResearcherBaseComponent} from "../shared/researcher-base.component";
|
|||
import {LinksResolver} from "../search/links-resolver";
|
||||
import {SearchCustomFilter} from "../openaireLibrary/searchPages/searchUtils/searchUtils.class";
|
||||
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({
|
||||
selector: 'researcher',
|
||||
|
@ -56,6 +59,23 @@ import {properties} from "../../environments/environment";
|
|||
<h1 *ngIf="!authorId" class="uk-h3 uk-margin-small-bottom">Researcher Monitors</h1>
|
||||
</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 class="uk-container uk-container-large uk-margin-medium-top uk-margin-medium-bottom">
|
||||
<router-outlet></router-outlet>
|
||||
|
@ -63,11 +83,13 @@ import {properties} from "../../environments/environment";
|
|||
</div>
|
||||
`
|
||||
})
|
||||
export class ResearcherComponent extends ResearcherBaseComponent implements OnInit {
|
||||
export class ResearcherComponent extends ResearcherBaseComponent implements OnInit {
|
||||
totalResults: number;
|
||||
openResults: number;
|
||||
loading: boolean = false;
|
||||
|
||||
stakeholder;
|
||||
isSearch: boolean = false;
|
||||
openaireEntities = OpenaireEntities;
|
||||
constructor(protected _router: Router,
|
||||
protected _route: ActivatedRoute,
|
||||
protected seoService: SEOService,
|
||||
|
@ -77,9 +99,13 @@ export class ResearcherComponent extends ResearcherBaseComponent implements OnIn
|
|||
protected _searchOrcidService: SearchOrcidService,
|
||||
protected _searchResearchResultsService: SearchResearchResultsService,
|
||||
private _customFilterService: CustomFilterService,
|
||||
private layoutService: LayoutService) {
|
||||
private layoutService: LayoutService,
|
||||
private stakeholderService: StakeholderService,
|
||||
private configurationService: ConfigurationService) {
|
||||
super();
|
||||
super.initRouterParams(this._route);
|
||||
super.initRouterParams(this._route, event => {
|
||||
this.isSearch = event.url.includes('/search');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -87,37 +113,63 @@ export class ResearcherComponent extends ResearcherBaseComponent implements OnIn
|
|||
this.layoutService.setRootClass('researcher');
|
||||
this.params.subscribe(params => {
|
||||
this.authorId = params['stakeholder'];
|
||||
this.author = null;
|
||||
this._customFilterService.setCustomFilter([]);
|
||||
if (this.authorId) {
|
||||
this.loading = true;
|
||||
LinksResolver.resetProperties();
|
||||
LinksResolver.setSearchAndResultLanding("researcher/" + this.authorId);
|
||||
this.orcid = {
|
||||
success: () => {
|
||||
this._customFilterService.setCustomFilter(
|
||||
[new SearchCustomFilter("National", "country", "IE", "Irish National Monitor", false),
|
||||
new SearchCustomFilter("Orcid", "authorId", this.authorId, this.author.authorGivenName + " " + this.author.authorFamilyName)
|
||||
]);
|
||||
},
|
||||
error: () => {
|
||||
this._router.navigate([properties.errorLink]);
|
||||
}
|
||||
}
|
||||
this.results = {
|
||||
success: (res: string | number) => {
|
||||
this.totalResults = +res;
|
||||
if(this.totalResults ==0 ){
|
||||
if(this.stakeholder?.index_id !== this.authorId) {
|
||||
this.loading = true;
|
||||
this.author = null;
|
||||
this._customFilterService.setCustomFilter([]);
|
||||
|
||||
this.orcid = {
|
||||
success: () => {
|
||||
let name = this.author.authorGivenName + " " + this.author.authorFamilyName?this.author.authorFamilyName:"";
|
||||
this._customFilterService.setCustomFilter(
|
||||
[new SearchCustomFilter("National", "country", "IE", "Irish National Monitor", false),
|
||||
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: () => {
|
||||
this._router.navigate([properties.errorLink]);
|
||||
}
|
||||
}
|
||||
this.results = {
|
||||
success: (res: string | number) => {
|
||||
this.totalResults = +res;
|
||||
if(this.totalResults ==0 ){
|
||||
this._router.navigate([properties.errorLink]);
|
||||
}else{
|
||||
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.openResults = +res;
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
this.search();
|
||||
|
||||
/* } else {
|
||||
this._router.navigate([properties.errorLink]);
|
||||
}else{
|
||||
this.loading = false;
|
||||
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.search();
|
||||
} else {
|
||||
this.stakeholder = null;
|
||||
this.author = null;
|
||||
this._customFilterService.setCustomFilter([]);
|
||||
this.title = 'Researcher Monitors';
|
||||
this.description = 'Researcher Monitors';
|
||||
this.setMetadata();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -8,13 +8,14 @@ import {LoadingModule} from "../openaireLibrary/utils/loading/loading.module";
|
|||
import {IconsModule} from '../openaireLibrary/utils/icons/icons.module';
|
||||
import {IconsService} from '../openaireLibrary/utils/icons/icons.service';
|
||||
import {open_access} from '../openaireLibrary/utils/icons/icons';
|
||||
import {SandboxGuard} from "../shared/sandbox.guard";
|
||||
|
||||
const routes: Route[] = [
|
||||
{
|
||||
path: '', component: ResearcherComponent, children: [
|
||||
{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]}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
|
|
@ -4,6 +4,7 @@ import {SearchOrcidService} from "../openaireLibrary/claims/claim-utils/service/
|
|||
import {SearchResearchResultsService} from "../openaireLibrary/services/searchResearchResults.service";
|
||||
import {properties} from "../../environments/environment";
|
||||
import {StringUtils} from "../openaireLibrary/utils/string-utils.class";
|
||||
import {StakeholderBaseComponent} from "../openaireLibrary/monitor-admin/utils/stakeholder-base.component";
|
||||
|
||||
interface Resolver {
|
||||
success?: Function;
|
||||
|
@ -11,7 +12,7 @@ interface Resolver {
|
|||
}
|
||||
|
||||
@Directive()
|
||||
export class ResearcherBaseComponent extends BaseComponent {
|
||||
export class ResearcherBaseComponent extends StakeholderBaseComponent {
|
||||
author: any;
|
||||
authorId: string;
|
||||
orcid: Resolver;
|
||||
|
|
Loading…
Reference in New Issue