From a2466083683df7dfafb074221b27189bfbed9565 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Fri, 30 Sep 2022 14:51:00 +0300 Subject: [PATCH] [Eosc Explore]: Updated some styles | Replaced "datasourcetypeuiname" field with "eoscdatasourcetype" | Do not add hardcoded compatibility label "Not yet registered" | Bug fix in Access filter 1. styles.less: Renamed from styles.css and added imports of less files and portal-custom.css (to be updated). 2. angular.json: In styles configuration added styles.less. 3. index.html & beta/index.html: In beta badge, used background instead of background-color to css rules. 4. portal-custom.css: Added rule for .search-form to inherit color in background. 5. searchFields.ts: a. Replaced "datasourcetypeuiname" field with "eoscdatasourcetype" for datasources refine filter "Type". b. In method "getResultAdvancedFields()" return always RESULT_ADVANCED_FIELDS without excluding "eoscifguidelines". 6. datasourcesHelper.class.ts: Replaced "datasourcetypeuiname" field with "eoscdatasourcetype" for datasources queries and used updated type names "Research Entity Registry" (old "Registry") and "Journal Archive" (old "Journal archive"). 7. cache-interceptor.service.ts: Updated cachingRequests array, using new "eoscdatasourcetype" and its values. 8. dataProvider.component.html && result-preview.component.html: Do not add hardcoded compatibility label "Not yet registered" and updated checks. 9. resultLanding.service.ts & parsingFunctions.class.ts: Parse resultLandingInfo.eoscSubjects only by "eoscifguidelines" field not "subjects". 10. searchFilter.component.ts: [Bug fix] In Access filter, fixed bug in view all, when clearing the preselected value. * Do not forget to add in package.json in devDependencies, "@types/express-serve-static-core": "4.17.28" --- cache-interceptor.service.ts | 4 +- .../dataProvider/dataProvider.component.html | 6 +- .../landing-utils/parsingFunctions.class.ts | 76 +++++++++---------- landingPages/result/resultLanding.service.ts | 8 +- .../searchUtils/datasourcesHelper.class.ts | 10 +-- .../searchUtils/searchFilter.component.ts | 21 ++--- utils/properties/searchFields.ts | 32 ++++++-- .../result-preview.component.html | 6 +- 8 files changed, 90 insertions(+), 73 deletions(-) diff --git a/cache-interceptor.service.ts b/cache-interceptor.service.ts index 4244e807..12f5c557 100644 --- a/cache-interceptor.service.ts +++ b/cache-interceptor.service.ts @@ -23,12 +23,12 @@ export class CacheInterceptorService implements HttpInterceptor { "/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=instancetypename&fields=fos&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&fq=resultbestaccessright%20exact%20%22Open%20Access%22&type=results&page=0&size=0", "/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=instancetypename&fields=fos&fields=relfunder&fields=sdg&fields=country&fields=resultlanguagename&fields=resulthostingdatasource&fields=community&&fq=resultbestaccessright exact \"Open Access\"&type=results&page=0&size=0", "/resources2/?format=json&refine=true&fields=funder&fields=projectstartyear&fields=projectendyear&fields=projectoamandatepublications&&type=projects&page=0&size=0", - "/resources2/?format=json&refine=true&fields=datasourcetypeuiname&fields=datasourceodlanguages&fields=datasourceodcontenttypes&fields=datasourcecompatibilityname&fields=country&fields=collectedfromname&fields=datasourcethematic&fields=datasourcejurisdiction&&type=datasources&page=0&size=0", + "/resources2/?format=json&refine=true&fields=eoscdatasourcetype&fields=datasourceodlanguages&fields=datasourceodcontenttypes&fields=datasourcecompatibilityname&fields=country&fields=collectedfromname&fields=datasourcethematic&fields=datasourcejurisdiction&&type=datasources&page=0&size=0", "/resources2/?format=json&query= ( (reldatasourcecompatibilityid exact driver or reldatasourcecompatibilityid exact driver-openaire2.0 or reldatasourcecompatibilityid exact openaire2.0 or reldatasourcecompatibilityid exact openaire3.0 or reldatasourcecompatibilityid exact openaire4.0 or reldatasourcecompatibilityid exact openaire-cris_1.1 or reldatasourcecompatibilityid exact openaire2.0_data or reldatasourcecompatibilityid exact hostedBy or relproject=*) ) &refine=true&fields=country&&type=organizations&page=0&size=0", "/projects/?format=json&refine=true&page=1&size=0&fields=funder", - "/resources/?format=json&query=( oaftype exact datasource and (datasourcetypeuiname exact \"Journal archive\" or datasourcetypeuiname exact \"Repository\"))&refine=true&fields=datasourcetypename&fields=country&fields=datasourceodsubjects&fields=datasourceodcontenttypes&fields=datasourcecompatibilityname&fields=datasourcethematic&fields=datasourcejurisdiction&&type=datasources&page=0&size=0", + "/resources/?format=json&query=( oaftype exact datasource and (eoscdatasourcetype exact \"Journal Archive\" or eoscdatasourcetype exact \"Repository\"))&refine=true&fields=datasourcetypename&fields=country&fields=datasourceodsubjects&fields=datasourceodcontenttypes&fields=datasourcecompatibilityname&fields=datasourcethematic&fields=datasourcejurisdiction&&type=datasources&page=0&size=0", "/search/v2/api/datasources/count?format=json", "/search/v2/api/publications/count?format=json", "/search/v2/api/datasets/count?format=json", "/search/v2/api/software/count?format=json", "/search/v2/api/other/count?format=json", "relresulttype%3Dpublication" diff --git a/landingPages/dataProvider/dataProvider.component.html b/landingPages/dataProvider/dataProvider.component.html index c07d2248..888317a6 100644 --- a/landingPages/dataProvider/dataProvider.component.html +++ b/landingPages/dataProvider/dataProvider.component.html @@ -114,9 +114,9 @@ {{dataProviderInfo.compatibility.name}} - {{dataProviderInfo.compatibility.info}} - - Not yet registered in OpenAIRE + {{dataProviderInfo.compatibility.info}} + + {{dataProviderInfo.compatibility.info}} in OpenAIRE diff --git a/landingPages/landing-utils/parsingFunctions.class.ts b/landingPages/landing-utils/parsingFunctions.class.ts index e8b456aa..dd3ed6f2 100644 --- a/landingPages/landing-utils/parsingFunctions.class.ts +++ b/landingPages/landing-utils/parsingFunctions.class.ts @@ -518,8 +518,8 @@ export class ParsingFunctions { } // publication & dataset landing : for subjects and otherSubjects and classifiedSubjects - parseAllSubjects(_subjects: any, vocabulary: any): [string[], Map, Map, string[], string[], any[]] { - let eoscSubjectsFound = []; + parseAllSubjects(_subjects: any, vocabulary: any): [string[], Map, Map, string[], string[], ] { + // let eoscSubjectsFound = []; let subjects: string[]; let otherSubjects: Map; let classifiedSubjects: Map; @@ -530,25 +530,25 @@ export class ParsingFunctions { let subject; let length = Array.isArray(_subjects) ? _subjects.length : 1; - + for (let i = 0; i < length; i++) { subject = Array.isArray(_subjects) ? _subjects[i] : _subjects; if (subject.classid != "") { if (subject.classid == "keyword") { let content: string = subject.content+""; - let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content); - let found: boolean = checkAndAddEoscSubjectResp["found"]; - if(found) { - setOfEoscSubjects = checkAndAddEoscSubjectResp["setOfEoscSubject"]; - eoscSubjectsFound = checkAndAddEoscSubjectResp["eoscSubjectsFound"]; - } else { - if (subjects == undefined) { - subjects = new Array(); - } - subjects.push(content); + // let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content); + // let found: boolean = checkAndAddEoscSubjectResp["found"]; + // if(found) { + // setOfEoscSubjects = checkAndAddEoscSubjectResp["setOfEoscSubject"]; + // eoscSubjectsFound = checkAndAddEoscSubjectResp["eoscSubjectsFound"]; + // } else { + if (subjects == undefined) { + subjects = new Array(); } + subjects.push(content); + // } } else if (!vocabulary || vocabulary[subject.classid] || subject.classid === "SDG" || subject.classid === "FOS") { - // if (subject.inferred && subject.inferred == true) { + // if (subject.inferred && subject.inferred == true) { if(subject.classid === "SDG") { if (sdg == undefined) { sdg = new Array(); @@ -564,37 +564,37 @@ export class ParsingFunctions { classifiedSubjects = new Map(); } - let content: string = subject.content+""; - let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content); - let found: boolean = checkAndAddEoscSubjectResp["found"]; - if(found) { - setOfEoscSubjects = checkAndAddEoscSubjectResp["setOfEoscSubject"]; - eoscSubjectsFound = checkAndAddEoscSubjectResp["eoscSubjectsFound"]; - } else { - if (!classifiedSubjects.has(subject.classname)) { - classifiedSubjects.set(subject.classname, new Array()); - } - classifiedSubjects.get(subject.classname).push(content); - } + let content: string = subject.content+""; + // let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content); + // let found: boolean = checkAndAddEoscSubjectResp["found"]; + // if(found) { + // setOfEoscSubjects = checkAndAddEoscSubjectResp["setOfEoscSubject"]; + // eoscSubjectsFound = checkAndAddEoscSubjectResp["eoscSubjectsFound"]; + // } else { + if (!classifiedSubjects.has(subject.classname)) { + classifiedSubjects.set(subject.classname, new Array()); + } + classifiedSubjects.get(subject.classname).push(content); + // } } } else { let content: string = subject.content+""; - let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content); - let found: boolean = checkAndAddEoscSubjectResp["found"]; - if(found) { - setOfEoscSubjects = checkAndAddEoscSubjectResp["setOfEoscSubject"]; - eoscSubjectsFound = checkAndAddEoscSubjectResp["eoscSubjectsFound"]; - } else { - let classname: string = subject.classname + ""; - if (subjects == undefined) { - subjects = new Array(); - } - subjects.push(content); + // let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content); + // let found: boolean = checkAndAddEoscSubjectResp["found"]; + // if(found) { + // setOfEoscSubjects = checkAndAddEoscSubjectResp["setOfEoscSubject"]; + // eoscSubjectsFound = checkAndAddEoscSubjectResp["eoscSubjectsFound"]; + // } else { + let classname: string = subject.classname + ""; + if (subjects == undefined) { + subjects = new Array(); } + subjects.push(content); + // } } } } - return [subjects, otherSubjects, classifiedSubjects, fos, sdg, eoscSubjectsFound]; + return [subjects, otherSubjects, classifiedSubjects, fos, sdg]; } checkAndAddEoscSubject(setOfEoscSubjects: Set, eoscSubjectsFound, subject, content) { diff --git a/landingPages/result/resultLanding.service.ts b/landingPages/result/resultLanding.service.ts index 55b4f30a..c40c9993 100644 --- a/landingPages/result/resultLanding.service.ts +++ b/landingPages/result/resultLanding.service.ts @@ -336,7 +336,7 @@ export class ResultLandingService { // res['result']['metadata']['oaf:entity']['oaf:result']['subject'] if(data[8] != null) { - let subjectResults: [string[], Map, Map, string[], string[], any[]] = this.parsingFunctions.parseAllSubjects(data[8], subjectsVocabulary); + let subjectResults: [string[], Map, Map, string[], string[]] = this.parsingFunctions.parseAllSubjects(data[8], subjectsVocabulary); this.resultLandingInfo.subjects = subjectResults[0]; this.resultLandingInfo.otherSubjects = subjectResults[1]; this.resultLandingInfo.classifiedSubjects = subjectResults[2]; @@ -351,9 +351,9 @@ export class ResultLandingService { }) } - if(!this.resultLandingInfo.eoscSubjects) { - this.resultLandingInfo.eoscSubjects = subjectResults[5]; - } + // if(!this.resultLandingInfo.eoscSubjects) { + // this.resultLandingInfo.eoscSubjects = subjectResults[5]; + // } } this.resultLandingInfo.hostedBy_collectedFrom = this.parsingFunctions.addPublisherToHostedBy_collectedFrom( diff --git a/searchPages/searchUtils/datasourcesHelper.class.ts b/searchPages/searchUtils/datasourcesHelper.class.ts index 6c298c0a..1b03bc8d 100644 --- a/searchPages/searchUtils/datasourcesHelper.class.ts +++ b/searchPages/searchUtils/datasourcesHelper.class.ts @@ -22,7 +22,7 @@ export class DatasourcesHelperClass { public static getTitle(type: "all" | "registries" | "journals" | "compatible" | "deposit" | "services") { if (type == "registries") { - return "Entity Registries" + return "Research Entity Registries" } else if (type == "journals") { return "Journals" } else if (type == "compatible") { @@ -48,15 +48,15 @@ export class DatasourcesHelperClass { } public static getQueryPrefix(type: "all" | "registries" | "journals" | "compatible" | "deposit" | "services"): string { if (type == "registries") { - return 'datasourcetypeuiname exact "Registry"'; + return 'eoscdatasourcetype exact "Research Entity Registry"'; } else if (type == "journals") { // return ' not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ) '; - return 'oaftype exact datasource not datasourcecompatibilityid = notCompatible and datasourcetypeuiname exact "Journal archive" '; + return 'oaftype exact datasource not datasourcecompatibilityid = notCompatible and eoscdatasourcetype exact "Journal Archive" '; } else if (type == "compatible") { - return ' oaftype exact datasource and datasourcecompatibilityid <> notCompatible and datasourcetypeuiname exact "Repository" '; + return ' oaftype exact datasource and datasourcecompatibilityid <> notCompatible and eoscdatasourcetype exact "Repository" '; }else if (type == "deposit") { - return ' oaftype exact datasource and (datasourcetypeuiname exact "Journal archive" or datasourcetypeuiname exact "Repository")'; + return ' oaftype exact datasource and (eoscdatasourcetype exact "Journal Archive" or eoscdatasourcetype exact "Repository")'; } else { return ""; } diff --git a/searchPages/searchUtils/searchFilter.component.ts b/searchPages/searchUtils/searchFilter.component.ts index 310d2752..9484c2c3 100644 --- a/searchPages/searchUtils/searchFilter.component.ts +++ b/searchPages/searchUtils/searchFilter.component.ts @@ -62,16 +62,16 @@ export class SearchFilterComponent implements OnInit, OnChanges { this.queryParams = Object.assign({}, params); this.paramPosition = SearchFields.getParameterOrder(this.filter.filterId, this.getEntries(params)); }); - this.filter.values = this.filter.values.filter(value => !value.name.toLowerCase().includes('unknown') && !value.name.toLowerCase().includes('not available')); - this.sort(); - if (this.filter.filterType == "radio") { - this.filter.radioValue = ""; - this.filter.values.forEach(value => { - if (value.selected) { - this.filter.radioValue = value.id - } - }); - } + // this.filter.values = this.filter.values.filter(value => !value.name.toLowerCase().includes('unknown') && !value.name.toLowerCase().includes('not available')); + // this.sort(); + // if (this.filter.filterType == "radio") { + // this.filter.radioValue = ""; + // this.filter.values.forEach(value => { + // if (value.selected) { + // this.filter.radioValue = value.id + // } + // }); + // } } ngOnChanges(changes: SimpleChanges) { @@ -85,6 +85,7 @@ export class SearchFilterComponent implements OnInit, OnChanges { } }); } + this.sort(); } } diff --git a/utils/properties/searchFields.ts b/utils/properties/searchFields.ts index ab616156..97ab07f4 100644 --- a/utils/properties/searchFields.ts +++ b/utils/properties/searchFields.ts @@ -422,7 +422,7 @@ export class SearchFields { //DATAPROVIDERS // add Collected From Filter "collectedfromname" - public DATASOURCE_REFINE_FIELDS: string[] = ["datasourcetypeuiname", "datasourceodlanguages", "datasourceodcontenttypes", + public DATASOURCE_REFINE_FIELDS: string[] = ["eoscdatasourcetype", "datasourceodlanguages", "datasourceodcontenttypes", "datasourcecompatibilityname", "country", "collectedfromname","datasourcethematic", "datasourcejurisdiction"]; public DATASOURCE_ADVANCED_FIELDS: string[] = ["q", "datasourceofficialname", @@ -471,6 +471,14 @@ export class SearchFields { equalityOperator: " exact ", filterType: "radio" }, + ["eoscdatasourcetype"]: { + name: "Type", + type: "refine", + param: "type", + operator: "tp", + equalityOperator: " exact ", + filterType: "radio" + }, ["datasourcetypename"]: { name: "Type", type: "vocabulary", @@ -567,7 +575,7 @@ export class SearchFields { {"name": "relorganizationshortname", "equalityOperator": "="}, {"name": "datasourceofficialname", "equalityOperator": "="}, {"name": "datasourceenglishname", "equalityOperator": "="}, - {"name": "datasourcetypeuiname", "equalityOperator": " exact "}, + {"name": "eoscdatasourcetype", "equalityOperator": " exact "}, {"name": "country", "equalityOperator": " exact "}, {"name": "datasourcesubject", "equalityOperator": " all "} ]; @@ -582,6 +590,14 @@ export class SearchFields { equalityOperator: " exact ", filterType: "radio" }, + ["eoscdatasourcetype"]: { + name: "Repository type", + type: "refine", + param: "type", + operator: "tp", + equalityOperator: " exact ", + filterType: "radio" + }, ["country"]: { name: "Countries", type: "vocabulary", @@ -701,11 +717,11 @@ export class SearchFields { } getResultAdvancedFields() { - if(properties.environment == "production") { - this.RESULT_ADVANCED_FIELDS = this.RESULT_ADVANCED_FIELDS.filter((value, index, array) => { - return value != "eoscifguidelines"; - }) - } + // if(properties.environment == "production") { + // this.RESULT_ADVANCED_FIELDS = this.RESULT_ADVANCED_FIELDS.filter((value, index, array) => { + // return value != "eoscifguidelines"; + // }) + // } return this.RESULT_ADVANCED_FIELDS; } @@ -806,7 +822,7 @@ export class SearchFields { if (fieldId == "relfunder" || fieldId == "relfundinglevel0_id" || fieldId == "relfundinglevel1_id" || fieldId == "relfundinglevel2_id" || fieldId == "relproject" || fieldId == "community" || fieldId == "projectendyear-range-projectstartyear") { return "and"; - } else if (fieldId == "instancetypename" || fieldId == "datasourcetypeuiname" + } else if (fieldId == "instancetypename" || fieldId == "eoscdatasourcetype" || fieldId == "resultlanguagename" || fieldId == "datasourceodlanguages" || fieldId == "datasourcecompatibilityname" || fieldId == "country" || fieldId == "datasourceodcontenttypes" || fieldId == "resulthostingdatasource" || fieldId == "collectedfrom") { diff --git a/utils/result-preview/result-preview.component.html b/utils/result-preview/result-preview.component.html index 806a4771..942b2552 100644 --- a/utils/result-preview/result-preview.component.html +++ b/utils/result-preview/result-preview.component.html @@ -129,15 +129,15 @@ {{result.compatibility}} {{' '}} - Not yet registered in OpenAIRE + {{result.compatibility}} in OpenAIRE {{' '}}