diff --git a/src/app/researcher/author/author.component.ts b/src/app/researcher/author/author.component.ts
deleted file mode 100644
index 56d2578..0000000
--- a/src/app/researcher/author/author.component.ts
+++ /dev/null
@@ -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: `
-
-
-
- `
-})
-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() {
-
- }
-
-
-}
diff --git a/src/app/researcher/author/author.module.ts b/src/app/researcher/author/author.module.ts
deleted file mode 100644
index b3091a8..0000000
--- a/src/app/researcher/author/author.module.ts
+++ /dev/null
@@ -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 {
-}
diff --git a/src/app/researcher/researcher.component.ts b/src/app/researcher/researcher.component.ts
index c66c0da..17fb42a 100644
--- a/src/app/researcher/researcher.component.ts
+++ b/src/app/researcher/researcher.component.ts
@@ -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";
Researcher Monitors
+
@@ -63,11 +83,13 @@ import {properties} from "../../environments/environment";
`
})
-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();
}
});
}
diff --git a/src/app/researcher/researcher.module.ts b/src/app/researcher/researcher.module.ts
index da31580..fb2b0d5 100644
--- a/src/app/researcher/researcher.module.ts
+++ b/src/app/researcher/researcher.module.ts
@@ -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]}
]
}
];
diff --git a/src/app/shared/researcher-base.component.ts b/src/app/shared/researcher-base.component.ts
index 7f8a5e3..540e097 100644
--- a/src/app/shared/researcher-base.component.ts
+++ b/src/app/shared/researcher-base.component.ts
@@ -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;