Merge Angular 16 Irish Monitor to develop #33

Merged
k.triantafyllou merged 151 commits from angular-16-irish-monitor into develop 2024-02-13 09:32:41 +01:00
2 changed files with 33 additions and 6 deletions
Showing only changes of commit 037c32c545 - Show all commits

View File

@ -29,7 +29,7 @@ export class DirectLinkingComponent {
// linkTo: string = null; // entity type (project or context or entity) // linkTo: string = null; // entity type (project or context or entity)
// linkToEntities: string[] = []; // linkToEntities: string[] = [];
showOptions:ShowOptions = new ShowOptions(); showOptions:ShowOptions = new ShowOptions();
validEntityTypes = ["dataset", "publication", "software", "orp", "project", "context"]; validEntityTypes = ["dataset", "publication", "software", "other", "project", "context"];
sources: ClaimEntity[] = []; sources: ClaimEntity[] = [];
inlineEntity: ClaimEntity = null; inlineEntity: ClaimEntity = null;
validInput: boolean = null;//'true; validInput: boolean = null;//'true;
@ -74,7 +74,7 @@ export class DirectLinkingComponent {
this.getResearchResultById("dataset", this.id); this.getResearchResultById("dataset", this.id);
} else if (this.type == "software") { } else if (this.type == "software") {
this.getResearchResultById("software", this.id); this.getResearchResultById("software", this.id);
} else if (this.type == "orp") { } else if (this.type == "other") {
this.getResearchResultById("other", this.id); this.getResearchResultById("other", this.id);
} else { } else {
this.validInput = this.isValidInput(null); this.validInput = this.isValidInput(null);
@ -110,9 +110,9 @@ export class DirectLinkingComponent {
return false; return false;
} else if (this.type == "project" && this.showOptions.linkTo != "result") { } else if (this.type == "project" && this.showOptions.linkTo != "result") {
return false; return false;
} else if (["dataset", "publication", "software", "orp"].indexOf(this.type) != -1 && (["project", "context", "result"].indexOf(this.showOptions.linkTo) == -1)) { } else if (["dataset", "publication", "software", "other"].indexOf(this.type) != -1 && (["project", "context", "result"].indexOf(this.showOptions.linkTo) == -1)) {
return false; return false;
} else if (["project", "dataset", "publication", "software", "orp"].indexOf(this.type) == -1) { } else if (["project", "dataset", "publication", "software", "other"].indexOf(this.type) == -1) {
return false; return false;
} else { } else {
return true; return true;

View File

@ -25,6 +25,7 @@ class Entities {
project = 'Project'; project = 'Project';
country = 'National'; country = 'National';
datasource = 'Repository'; datasource = 'Repository';
researcher = 'Researcher';
stakeholders = 'Dashboards'; stakeholders = 'Dashboards';
funders = 'Funders'; funders = 'Funders';
@ -32,6 +33,7 @@ class Entities {
organizations = 'Research Institutions'; organizations = 'Research Institutions';
projects = 'Projects'; projects = 'Projects';
datasources = 'Repositories'; datasources = 'Repositories';
researchers = 'Researchers';
} }
export class StakeholderConfiguration { export class StakeholderConfiguration {
@ -765,6 +767,7 @@ export class IndicatorUtils {
this.extractRI(obj, indicatorPath, stakeholder); this.extractRI(obj, indicatorPath, stakeholder);
this.extractOrganization(obj, indicatorPath, stakeholder); this.extractOrganization(obj, indicatorPath, stakeholder);
this.extractDatasource(obj, indicatorPath, stakeholder); this.extractDatasource(obj, indicatorPath, stakeholder);
this.extractResearcher(obj, indicatorPath, stakeholder);
} }
private extractFunder(obj, indicatorPath: IndicatorPath, stakeholder: Stakeholder) { private extractFunder(obj, indicatorPath: IndicatorPath, stakeholder: Stakeholder) {
@ -846,8 +849,8 @@ export class IndicatorUtils {
} }
} }
private extractDatasource(obj, indicatorPath: IndicatorPath, stakeholder: Stakeholder) { private extractDatasource(obj, indicatorPath: IndicatorPath, stakeholder: Stakeholder) {
// works for publication.project.organization.name // works for .datasource.name and .HostedBy datasource
// and publication.organization.name // and .datasource.id
if (stakeholder.type != "datasource") { if (stakeholder.type != "datasource") {
return; return;
} }
@ -871,6 +874,30 @@ export class IndicatorUtils {
} }
} }
} }
private extractResearcher(obj, indicatorPath: IndicatorPath, stakeholder: Stakeholder) {
// works for .orcid
if (stakeholder.type != "researcher") {
return;
}
for (let query of this.getQueryObjectName(obj) ? obj[this.getDescriptionObjectName(obj)][this.getQueryObjectName(obj)] : obj[this.getDescriptionObjectName(obj)]) {
if (query["query"]["profile"]) {
query["query"]["profile"] = ChartHelper.prefix + this.statsProfileParameter + ChartHelper.suffix;
}
if (!query["query"]["filters"]) {
return;
}
for (let filter of query["query"]["filters"]) {
for (let gfilter of filter["groupFilters"]) {
let replacedValue = this.replaceIndexValues(gfilter["values"][0], stakeholder, indicatorPath.parameters);
if(replacedValue) { // don't proceed in replacement if no replaced value matches
if ((gfilter["field"].indexOf(".orcid") != -1 )) {
gfilter["values"][0] = replacedValue;
}
}
}
}
}
}
private replaceIndexValues(currentValue, stakeholder, parameters ){ private replaceIndexValues(currentValue, stakeholder, parameters ){
if(currentValue == stakeholder.index_name){ if(currentValue == stakeholder.index_name){
parameters["index_name"] = stakeholder.index_name; parameters["index_name"] = stakeholder.index_name;