Merge remote-tracking branch 'origin/master' into new-theme

This commit is contained in:
Konstantinos Triantafyllou 2022-03-16 15:33:05 +02:00
commit e103ced738
11 changed files with 125 additions and 34 deletions

View File

@ -201,7 +201,7 @@ export class MetricsComponent {
private sub: Subscription; private sub: Subscription;
private timeouts: any[] = []; private timeouts: any[] = [];
public metricsClicked: boolean = true; public metricsClicked: boolean = false;
public status: number; public status: number;
public state: number = -1; public state: number = -1;

View File

@ -559,10 +559,12 @@ export class ParsingFunctions {
} }
// publication & dataset landing : for subjects and otherSubjects and classifiedSubjects // publication & dataset landing : for subjects and otherSubjects and classifiedSubjects
parseAllSubjects(_subjects: any): [string[], Map<string, string[]>, Map<string, string[]>] { parseAllSubjects(_subjects: any): [string[], Map<string, string[]>, Map<string, string[]>, string[], string[]] {
let subjects: string[]; let subjects: string[];
let otherSubjects: Map<string, string[]>; let otherSubjects: Map<string, string[]>;
let classifiedSubjects: Map<string, string[]>; let classifiedSubjects: Map<string, string[]>;
let fos: string[];
let sdg: string[];
let subject; let subject;
let length = Array.isArray(_subjects) ? _subjects.length : 1; let length = Array.isArray(_subjects) ? _subjects.length : 1;
@ -571,15 +573,27 @@ export class ParsingFunctions {
subject = Array.isArray(_subjects) ? _subjects[i] : _subjects; subject = Array.isArray(_subjects) ? _subjects[i] : _subjects;
if (subject.classid != "") { if (subject.classid != "") {
if (subject.inferred && subject.inferred == true) { if (subject.inferred && subject.inferred == true) {
if (classifiedSubjects == undefined) { if(subject.classid === "SDG") {
classifiedSubjects = new Map<string, string[]>(); if (sdg == undefined) {
} sdg = new Array<string>();
}
sdg.push(subject.content+"");
} else if(subject.classid === "FOS") {
if (fos == undefined) {
fos = new Array<string>();
}
fos.push(subject.content+"");
} else {
if (classifiedSubjects == undefined) {
classifiedSubjects = new Map<string, string[]>();
}
if (!classifiedSubjects.has(subject.classname)) { if (!classifiedSubjects.has(subject.classname)) {
classifiedSubjects.set(subject.classname, new Array<string>()); classifiedSubjects.set(subject.classname, new Array<string>());
} }
classifiedSubjects.get(subject.classname).push(subject.content); classifiedSubjects.get(subject.classname).push(subject.content+"");
}
} else { } else {
if (subject.classid == "keyword") { if (subject.classid == "keyword") {
let content: string = subject.content+""; let content: string = subject.content+"";
@ -636,7 +650,7 @@ export class ParsingFunctions {
} }
} }
} }
return [subjects, otherSubjects, classifiedSubjects]; return [subjects, otherSubjects, classifiedSubjects, fos, sdg];
} }
parseContexts(_contexts: any): { parseContexts(_contexts: any): {

View File

@ -54,7 +54,7 @@ import {EnvProperties} from "../../utils/properties/env-properties";
<span>, </span> <span>, </span>
</ng-container> </ng-container>
<span *ngIf="journal['lissn']" class="uk-display-inline-block"> <span *ngIf="journal['lissn']" class="uk-display-inline-block">
<span class="uk-display-inline-block">lissn: {{journal['lissn']}}</span>(kostis) <span class="uk-display-inline-block">lissn: {{journal['lissn']}}</span>
<span>, </span> <span>, </span>
</span> </span>
<span *ngIf="journal && (journal['issn'] ||journal['lissn'] || journal['eissn'] )"> <span *ngIf="journal && (journal['issn'] ||journal['lissn'] || journal['eissn'] )">

View File

@ -182,6 +182,26 @@
<showIdentifiers [identifiers]="resultLandingInfo.identifiers" [showViewAll]="true"></showIdentifiers> <showIdentifiers [identifiers]="resultLandingInfo.identifiers" [showViewAll]="true"></showIdentifiers>
</div> </div>
<!-- Subjects --> <!-- Subjects -->
<div *ngIf="resultLandingInfo.fos" class="uk-margin-medium-bottom">
<div class="uk-text-muted">
Fields of Science and Technology classification
</div>
<div class="uk-margin-small-top">
<div *ngIf="resultLandingInfo.fos && resultLandingInfo.fos.length > 0">
{{resultLandingInfo.fos.join(', ')}}
</div>
</div>
</div>
<div *ngIf="resultLandingInfo.sdg" class="uk-margin-medium-bottom">
<div class="uk-text-muted">
Sustainable Development Goals
</div>
<div class="uk-margin-small-top">
<div *ngIf="resultLandingInfo.sdg && resultLandingInfo.sdg.length > 0">
{{resultLandingInfo.sdg.join(', ')}}
</div>
</div>
</div>
<div *ngIf="resultLandingInfo.subjects || resultLandingInfo.otherSubjects || <div *ngIf="resultLandingInfo.subjects || resultLandingInfo.otherSubjects ||
resultLandingInfo.classifiedSubjects" class="uk-margin-medium-bottom"> resultLandingInfo.classifiedSubjects" class="uk-margin-medium-bottom">
<showSubjects [subjects]="resultLandingInfo.subjects" <showSubjects [subjects]="resultLandingInfo.subjects"

View File

@ -380,7 +380,7 @@ export class ResultLandingComponent {
this.seoService.createLinkForCanonicalURL(this.canonicalUrl); this.seoService.createLinkForCanonicalURL(this.canonicalUrl);
this.updateUrl(this.canonicalUrl); this.updateUrl(this.canonicalUrl);
if ((this.type == "publication") && (this.properties.environment == "beta" || this.properties.environment == "development") && (typeof document !== 'undefined')) { if ((this.type == "publication") && (this.properties.environment == "beta" || this.properties.environment == "development") && (typeof document !== 'undefined')) {
this.getOpenCitations(); // this.getOpenCitations();
} }
this.addNoIndexFilter(); this.addNoIndexFilter();
if (this.resultLandingInfo.title) { if (this.resultLandingInfo.title) {
@ -453,7 +453,10 @@ export class ResultLandingComponent {
} }
public get hasPrimaryInfo(): boolean { public get hasPrimaryInfo(): boolean {
return !!this.resultLandingInfo && (!!this.resultLandingInfo.description || !!this.resultLandingInfo.identifiers || !!this.resultLandingInfo.subjects); return !!this.resultLandingInfo && (
(!!this.resultLandingInfo.description && this.resultLandingInfo.description.length > 0)
|| !!this.resultLandingInfo.identifiers || !!this.resultLandingInfo.subjects
|| (!!this.resultLandingInfo.organizations && this.resultLandingInfo.organizations.length > 0));
} }
public get hasSecondaryInfo(): boolean { public get hasSecondaryInfo(): boolean {

View File

@ -8,6 +8,7 @@ import {map} from "rxjs/operators";
import {HostedByCollectedFrom, Organization} from "../../utils/result-preview/result-preview"; import {HostedByCollectedFrom, Organization} from "../../utils/result-preview/result-preview";
import {Dates, Identifier, StringUtils} from "../../utils/string-utils.class"; import {Dates, Identifier, StringUtils} from "../../utils/string-utils.class";
import {properties} from "../../../../environments/environment"; import {properties} from "../../../../environments/environment";
import {HelperFunctions} from "../../utils/HelperFunctions.class";
@Injectable() @Injectable()
export class ResultLandingService { export class ResultLandingService {
@ -151,18 +152,21 @@ export class ResultLandingService {
if(!this.resultLandingInfo.title || data[1][i].classid == "main title") { if(!this.resultLandingInfo.title || data[1][i].classid == "main title") {
this.resultLandingInfo.title = String(data[1][i].content); this.resultLandingInfo.title = String(data[1][i].content);
} }
if(data[1][i].classid == "main title") { if(!this.resultLandingInfo.subtitle && data[1][i].classid === 'subtitle') {
break; this.resultLandingInfo.subtitle = String(data[1][i].content);
} }
// if(data[1][i].classid == "main title") {
// break;
// }
} }
} }
if(this.resultLandingInfo.title === this.resultLandingInfo.subtitle) {
this.resultLandingInfo.subtitle = "";
}
if(!this.resultLandingInfo.title) { if(!this.resultLandingInfo.title) {
this.resultLandingInfo.title = ""; this.resultLandingInfo.title = "";
} }
// this.resultLandingInfo.title = (data[1][0] && data[1][0].content) ? String(data[1][0].content) : ""; // this.resultLandingInfo.title = (data[1][0] && data[1][0].content) ? String(data[1][0].content) : "";
if(data[1][1].classid === 'subtitle') {
this.resultLandingInfo.subtitle = (data[1][1] && data[1][1].content) ? String(data[1][1].content) : "";
}
} else { } else {
this.resultLandingInfo.title = (data[1] && data[1].content) ? String(data[1].content) : ""; this.resultLandingInfo.title = (data[1] && data[1].content) ? String(data[1].content) : "";
} }
@ -191,6 +195,8 @@ export class ResultLandingService {
} }
this.resultLandingInfo.relatedResults = this.parsingFunctions.parseResults(this.resultLandingInfo.relatedResults, relation, provenanceAction); this.resultLandingInfo.relatedResults = this.parsingFunctions.parseResults(this.resultLandingInfo.relatedResults, relation, provenanceAction);
} else if(relation['to'].class && relation['to'].class.toLowerCase() == "hasauthorinstitution") {
this.resultLandingInfo.organizations = this.parseRelatedOrganizations(this.resultLandingInfo.organizations, relation);
} }
} }
} }
@ -325,10 +331,20 @@ export class ResultLandingService {
// res['result']['metadata']['oaf:entity']['oaf:result']['subject'] // res['result']['metadata']['oaf:entity']['oaf:result']['subject']
if(data[7] != null) { if(data[7] != null) {
let subjectResults: [string[], Map<string, string[]>, Map<string, string[]>] = this.parsingFunctions.parseAllSubjects(data[7]); let subjectResults: [string[], Map<string, string[]>, Map<string, string[]>, string[], string[]] = this.parsingFunctions.parseAllSubjects(data[7]);
this.resultLandingInfo.subjects = subjectResults[0]; this.resultLandingInfo.subjects = subjectResults[0];
this.resultLandingInfo.otherSubjects = subjectResults[1]; this.resultLandingInfo.otherSubjects = subjectResults[1];
this.resultLandingInfo.classifiedSubjects = subjectResults[2]; this.resultLandingInfo.classifiedSubjects = subjectResults[2];
this.resultLandingInfo.fos = subjectResults[3];
if(this.resultLandingInfo.fos) {
this.resultLandingInfo.fos.sort((a, b) => a.localeCompare(b))
}
this.resultLandingInfo.sdg = subjectResults[4];
if(this.resultLandingInfo.sdg) {
this.resultLandingInfo.sdg.sort((a, b) => {
return HelperFunctions.sortSDGs(a, b);
})
}
this.resultLandingInfo.showEgiNotebookButton = this.parsingFunctions.notebookInSubjects; this.resultLandingInfo.showEgiNotebookButton = this.parsingFunctions.notebookInSubjects;
} }

View File

@ -10,7 +10,7 @@ import {
import {Filter, Value} from './searchHelperClasses.class'; import {Filter, Value} from './searchHelperClasses.class';
import {ActivatedRoute, Router} from "@angular/router"; import {ActivatedRoute, Router} from "@angular/router";
import {SearchFields} from "../../utils/properties/searchFields"; import {SearchFields} from "../../utils/properties/searchFields";
import {HelperFunctions} from "../../utils/HelperFunctions.class";
@Component({ @Component({
selector: 'search-filter', selector: 'search-filter',
templateUrl: 'searchFilter.component.html' templateUrl: 'searchFilter.component.html'
@ -223,20 +223,21 @@ export class SearchFilterComponent implements OnInit, OnChanges {
sort(values: Value[]) { sort(values: Value[]) {
let sorted: Value[] = values.slice(); let sorted: Value[] = values.slice();
if (this.sortBy == "name") { if (this.sortBy == "name") {
sorted.sort((n1, n2) => { sorted.sort((n1, n2) => {
if (n1.name.toLowerCase() > n2.name.toLowerCase()) { if (this.filter.filterId === "sdg") {
return 1; return HelperFunctions.sortSDGs(n1.name.toLowerCase(), n2.name.toLowerCase());
} else {
if (n1.name.toLowerCase() > n2.name.toLowerCase()) {
return 1;
}
if (n1.name < n2.name) {
return -1;
}
return 0;
} }
if (n1.name < n2.name) {
return -1;
}
return 0;
}); });
return sorted;
} }
return sorted;
} }
toggle() { toggle() {

View File

@ -341,7 +341,7 @@ export class SearchResearchResultsService {
}); });
} }
var date: string = (resData.dateofacceptance) + ""; // transform to string in case it is an integer var date: string = (resData.dateofacceptance ? resData.dateofacceptance : '') + ''; // transform to string in case it is an integer
result.year = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date; result.year = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date;
let abstracts = this.parsingFunctions.parseDescription(resData.description); let abstracts = this.parsingFunctions.parseDescription(resData.description);

View File

@ -70,4 +70,23 @@ export class HelperFunctions {
public static getValues(value: any): any[] { public static getValues(value: any): any[] {
return Object.keys(value).map(key => value[key]); return Object.keys(value).map(key => value[key]);
} }
public static sortSDGs(sgd1: string, sdg2: string): number {
let splitA: string[] = sgd1.split(".");
let numA: number;
if(splitA && splitA.length > 0) {
numA = +splitA[0];
}
let splitB: string[] = sdg2.split(".");
let numB: number;
if(splitB && splitB.length > 0) {
numB = +splitB[0];
}
if(numA && numB) {
return numA - numB;
} else {
return sgd1.localeCompare(sdg2);
}
}
} }

View File

@ -49,6 +49,8 @@ export class ResultLandingInfo {
subjects: string[]; subjects: string[];
otherSubjects: Map<string, string[]>; otherSubjects: Map<string, string[]>;
classifiedSubjects: Map<string, string[]>; //<class of subject, subjects> classifiedSubjects: Map<string, string[]>; //<class of subject, subjects>
fos: string[];
sdg: string[];
showEgiNotebookButton: boolean = false; showEgiNotebookButton: boolean = false;
// // percentage is for trust // // percentage is for trust

View File

@ -14,7 +14,7 @@ export class SearchFields {
"resultbestaccessright", "relfunder", "resultbestaccessright", "relfunder",
"relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id", "relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id",
"relproject", "relproject",
"instancetypename", "resultlanguagename", "community", "resulthostingdatasource", "country"]; "instancetypename", "resultlanguagename", "community", "resulthostingdatasource", "country", "sdg", "fos"];
public RESULT_ADVANCED_FIELDS: string[] = ["q", "resulttitle", "resultauthor", "authorid", "resultdescription", "resultsubject", "resultpublisher", public RESULT_ADVANCED_FIELDS: string[] = ["q", "resulttitle", "resultauthor", "authorid", "resultdescription", "resultsubject", "resultpublisher",
"resultbestaccessright", "community", "collectedfromdatasourceid", "resulthostingdatasourceid", "resultdateofacceptance", "resultbestaccessright", "community", "collectedfromdatasourceid", "resulthostingdatasourceid", "resultdateofacceptance",
@ -231,6 +231,22 @@ export class SearchFields {
operator: "cu", operator: "cu",
equalityOperator: " exact ", equalityOperator: " exact ",
filterType: "checkbox" filterType: "checkbox"
},
["sdg"]: {
name: "Sustainable Development Goals (SDG)",
type: "refine",
param: "sdg",
operator: "sg",
equalityOperator: " exact ",
filterType: "checkbox"
},
["fos"]: {
name: "Fields of Science and Technology classification (FOS)",
type: "refine",
param: "fos",
operator: "fs",
equalityOperator: " exact ",
filterType: "checkbox"
} }
}; };