Add foslabel in searchFiles only for beta, dev. Change eoscifguidelines to refine. Input fix double icon in select with many values.

This commit is contained in:
Konstantinos Triantafyllou 2023-07-06 12:53:37 +03:00
parent ea1b054b63
commit 76cb586ebd
2 changed files with 79 additions and 61 deletions

View File

@ -168,11 +168,11 @@ declare var UIkit;
<ng-template [ngIf]="formControl.enabled"> <ng-template [ngIf]="formControl.enabled">
<icon *ngIf="!searchControl?.value && icon" [name]="icon" [flex]="true"></icon> <icon *ngIf="!searchControl?.value && icon" [name]="icon" [flex]="true"></icon>
<icon *ngIf="!icon && selectable && selectArrow" [name]="selectArrow" [flex]="true"></icon> <icon *ngIf="!icon && selectable && selectArrow" [name]="selectArrow" [flex]="true"></icon>
<button *ngIf="focused && type === 'autocomplete'" class="uk-close uk-icon" <button *ngIf="focused && type === 'autocomplete' && (!selectable || searchControl.value)" class="uk-close uk-icon"
(click)="resetSearch($event)"> (click)="resetSearch($event)">
<icon [flex]="true" name="close"></icon> <icon [flex]="true" name="close"></icon>
</button> </button>
<button *ngIf="(!focused && type === 'autocomplete') || (type !== 'autocomplete' && !searchControl?.value && !!formControl?.value && (searchable || !selectable))" <button *ngIf="(!focused && type === 'autocomplete' && !selectable) || (type !== 'autocomplete' && !searchControl?.value && !!formControl?.value && (searchable || !selectable))"
class="uk-close uk-icon" (click)="resetValue($event)"> class="uk-close uk-icon" (click)="resetValue($event)">
<icon [flex]="true" name="close"></icon> <icon [flex]="true" name="close"></icon>
</button> </button>

View File

@ -2,7 +2,7 @@ import {Filter} from "../../searchPages/searchUtils/searchHelperClasses.class";
import {properties} from "../../../../environments/environment"; import {properties} from "../../../../environments/environment";
export class SearchFields { export class SearchFields {
//main Entities //main Entities
//RESULTS //RESULTS
//Used for datasets and publications and software and orp //Used for datasets and publications and software and orp
@ -11,10 +11,10 @@ export class SearchFields {
public RESULT_RANGE_FIELDS = [ public RESULT_RANGE_FIELDS = [
["resultacceptanceyear", "resultacceptanceyear"] ["resultacceptanceyear", "resultacceptanceyear"]
]; ];
// Remove Collected From Filter "collectedfrom","collectedfrom" // Remove Collected From Filter "collectedfrom","collectedfrom"
public RESULT_REFINE_FIELDS = [ public RESULT_REFINE_FIELDS = [
"resultbestaccessright", "instancetypename", "fos", "relfunder", "resultbestaccessright", "instancetypename", (properties.environment !== 'production' ? "foslabel" : "fos"), "relfunder",
"relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id", "relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id",
"relproject", "sdg", "country", "resultlanguagename", "resulthostingdatasource", "community"]; "relproject", "sdg", "country", "resultlanguagename", "resulthostingdatasource", "community"];
@ -59,7 +59,7 @@ export class SearchFields {
}, },
["eoscifguidelines"]: { ["eoscifguidelines"]: {
name: "EOSC Subject", name: "EOSC Subject",
type: "keyword", type: "refine",
param: "eoscSubj", param: "eoscSubj",
operator: "es", operator: "es",
equalityOperator: " exact ", equalityOperator: " exact ",
@ -81,9 +81,16 @@ export class SearchFields {
equalityOperator: "=", equalityOperator: "=",
filterType: null filterType: null
}, },
["pid"]: {name: "PID", type: "keyword", param: "pid", operator: "pd", equalityOperator: " exact ", filterType: null}, ["pid"]: {
name: "PID",
type: "keyword",
param: "pid",
operator: "pd",
equalityOperator: " exact ",
filterType: null
},
["resulthostingdatasourceid"]: { ["resulthostingdatasourceid"]: {
name: "Hosting "+OpenaireEntities.DATASOURCE, name: "Hosting " + OpenaireEntities.DATASOURCE,
type: "entity", type: "entity",
param: "hostedBy", param: "hostedBy",
operator: "hs", operator: "hs",
@ -219,7 +226,7 @@ export class SearchFields {
filterType: null filterType: null
}, },
["collectedfromdatasourceid"]: { ["collectedfromdatasourceid"]: {
name: "Collected from "+OpenaireEntities.DATASOURCE, name: "Collected from " + OpenaireEntities.DATASOURCE,
type: "entity", type: "entity",
param: "collectedFrom", param: "collectedFrom",
operator: "cl", operator: "cl",
@ -257,9 +264,17 @@ export class SearchFields {
operator: "fs", operator: "fs",
equalityOperator: " exact ", equalityOperator: " exact ",
filterType: "checkbox" filterType: "checkbox"
},
["foslabel"]: {
name: "Field of Science [Beta]",
type: "vocabulary",
param: "foslabel",
operator: "fl",
equalityOperator: " exact ",
filterType: "checkbox"
} }
}; };
//PROJECT //PROJECT
public PROJECT_RANGE_FIELDS = [ public PROJECT_RANGE_FIELDS = [
["projectendyear", "projectstartyear"] ["projectendyear", "projectstartyear"]
@ -296,7 +311,7 @@ export class SearchFields {
equalityOperator: "=", equalityOperator: "=",
filterType: null filterType: null
}, },
["funder"]: { ["funder"]: {
name: "Funder", name: "Funder",
type: "refine", type: "refine",
@ -378,7 +393,7 @@ export class SearchFields {
// filterType: "radio" // filterType: "radio"
// }, // },
["projectoamandatepublications"]: { ["projectoamandatepublications"]: {
name: "OA "+OpenaireEntities.PUBLICATIONS+" Mandate", name: "OA " + OpenaireEntities.PUBLICATIONS + " Mandate",
type: "boolean", type: "boolean",
param: "oapubl", param: "oapubl",
operator: "oap", operator: "oap",
@ -386,7 +401,7 @@ export class SearchFields {
filterType: "radio" filterType: "radio"
}, },
["projectoamandatedata"]: { ["projectoamandatedata"]: {
name: "OA "+OpenaireEntities.DATASETS+" Mandate", name: "OA " + OpenaireEntities.DATASETS + " Mandate",
type: "boolean", type: "boolean",
param: "oadata", param: "oadata",
operator: "oad", operator: "oad",
@ -410,25 +425,25 @@ export class SearchFields {
filterType: null filterType: null
}, },
["collectedfromdatasourceid"]: { ["collectedfromdatasourceid"]: {
name: "Collected from "+OpenaireEntities.DATASOURCE, name: "Collected from " + OpenaireEntities.DATASOURCE,
type: "entity", type: "entity",
param: "collectedFrom", param: "collectedFrom",
operator: "cl", operator: "cl",
equalityOperator: " exact ", equalityOperator: " exact ",
filterType: null filterType: null
} }
}; };
//DATAPROVIDERS //DATAPROVIDERS
// add Collected From Filter "collectedfromname" // add Collected From Filter "collectedfromname"
public DATASOURCE_REFINE_FIELDS: string[] = ["eoscdatasourcetype", "datasourceodlanguages", "datasourceodcontenttypes", public DATASOURCE_REFINE_FIELDS: string[] = ["eoscdatasourcetype", "datasourceodlanguages", "datasourceodcontenttypes",
"datasourcecompatibilityname", "country", "collectedfromname","datasourcethematic", "datasourcecompatibilityname", "country", "collectedfromname", "datasourcethematic",
"datasourcejurisdiction"]; "datasourcejurisdiction"];
public DATASOURCE_ADVANCED_FIELDS: string[] = ["q", "datasourceofficialname", public DATASOURCE_ADVANCED_FIELDS: string[] = ["q", "datasourceofficialname",
"datasourceenglishname", "datasourceodsubjects", "datasourcetypename", "datasourceodlanguages", "datasourceenglishname", "datasourceodsubjects", "datasourcetypename", "datasourceodlanguages",
"datasourceodcontenttypes", "datasourcecompatibilityname", "relorganizationid", "collectedfromdatasourceid", "pid"]; "datasourceodcontenttypes", "datasourcecompatibilityname", "relorganizationid", "collectedfromdatasourceid", "pid"];
public DATASOURCE_FIELDS: { [key: string]: FieldDetails } = { public DATASOURCE_FIELDS: { [key: string]: FieldDetails } = {
["q"]: {name: "Any field", type: "keyword", param: "q", operator: "op", equalityOperator: "=", filterType: null}, ["q"]: {name: "Any field", type: "keyword", param: "q", operator: "op", equalityOperator: "=", filterType: null},
["datasourceofficialname"]: { ["datasourceofficialname"]: {
@ -536,7 +551,7 @@ export class SearchFields {
filterType: "checkbox" filterType: "checkbox"
}, },
["collectedfromdatasourceid"]: { ["collectedfromdatasourceid"]: {
name: "Collected from "+OpenaireEntities.DATASOURCE, name: "Collected from " + OpenaireEntities.DATASOURCE,
type: "entity", type: "entity",
param: "collectedFrom", param: "collectedFrom",
operator: "cl", operator: "cl",
@ -569,7 +584,7 @@ export class SearchFields {
}, },
["pid"]: {name: "PID", type: "keyword", param: "pid", operator: "pd", equalityOperator: " exact ", filterType: null} ["pid"]: {name: "PID", type: "keyword", param: "pid", operator: "pd", equalityOperator: " exact ", filterType: null}
}; };
public DEPOSIT_DATASOURCE_KEYWORD_FIELDS: { "name": string, "equalityOperator": string } [] = [ public DEPOSIT_DATASOURCE_KEYWORD_FIELDS: { "name": string, "equalityOperator": string } [] = [
{"name": "relorganizationname", "equalityOperator": "="}, {"name": "relorganizationname", "equalityOperator": "="},
{"name": "relorganizationshortname", "equalityOperator": "="}, {"name": "relorganizationshortname", "equalityOperator": "="},
@ -579,8 +594,8 @@ export class SearchFields {
{"name": "country", "equalityOperator": " exact "}, {"name": "country", "equalityOperator": " exact "},
{"name": "datasourcesubject", "equalityOperator": " all "} {"name": "datasourcesubject", "equalityOperator": " all "}
]; ];
public DEPOSIT_DATASOURCE_REFINE_FIELDS: string[] = ["datasourcetypename", "country", "datasourceodsubjects", "datasourceodcontenttypes", "datasourcecompatibilityname","datasourcethematic", "datasourcejurisdiction"]; public DEPOSIT_DATASOURCE_REFINE_FIELDS: string[] = ["datasourcetypename", "country", "datasourceodsubjects", "datasourceodcontenttypes", "datasourcecompatibilityname", "datasourcethematic", "datasourcejurisdiction"];
public DEPOSIT_DATASOURCE_FIELDS: { [key: string]: FieldDetails } = { public DEPOSIT_DATASOURCE_FIELDS: { [key: string]: FieldDetails } = {
["datasourcetypeuiname"]: { ["datasourcetypeuiname"]: {
name: "Repository type", name: "Repository type",
@ -631,26 +646,26 @@ export class SearchFields {
filterType: "checkbox" filterType: "checkbox"
}, },
}; };
// public COMPATIBLE_DATAPROVIDER_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"]; // public COMPATIBLE_DATAPROVIDER_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"];
public COMPATIBLE_DATAPROVIDER_FIELDS: string[] = ["datasourcetypename", "datasourceodlanguages", "datasourceodcontenttypes", public COMPATIBLE_DATAPROVIDER_FIELDS: string[] = ["datasourcetypename", "datasourceodlanguages", "datasourceodcontenttypes",
"datasourcecompatibilityname", "country", "collectedfromname","datasourcethematic", "datasourcecompatibilityname", "country", "collectedfromname", "datasourcethematic",
"datasourcejurisdiction"]; "datasourcejurisdiction"];
// public ENTITY_REGISTRIES_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"]; // public ENTITY_REGISTRIES_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"];
public ENTITY_REGISTRIES_FIELDS: string[] = ["datasourcetypename", "datasourceodlanguages", "datasourceodcontenttypes", public ENTITY_REGISTRIES_FIELDS: string[] = ["datasourcetypename", "datasourceodlanguages", "datasourceodcontenttypes",
"datasourcecompatibilityname", "country", "collectedfromname","datasourcethematic", "datasourcecompatibilityname", "country", "collectedfromname", "datasourcethematic",
"datasourcejurisdiction"]; "datasourcejurisdiction"];
// public JOURNAL_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"]; // public JOURNAL_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"];
public JOURNAL_FIELDS: string[] = ["datasourcetypename", "datasourceodlanguages", "datasourceodcontenttypes", public JOURNAL_FIELDS: string[] = ["datasourcetypename", "datasourceodlanguages", "datasourceodcontenttypes",
"datasourcecompatibilityname", "country", "collectedfromname","datasourcethematic", "datasourcecompatibilityname", "country", "collectedfromname", "datasourcethematic",
"datasourcejurisdiction"]; "datasourcejurisdiction"];
//ORGANIZATION //ORGANIZATION
public ORGANIZATION_REFINE_FIELDS: string[] = ["country"] public ORGANIZATION_REFINE_FIELDS: string[] = ["country"]
public ORGANIZATION_ADVANCED_FIELDS: string[] = ["q", "organizationlegalname", "organizationlegalshortname", "country"]; public ORGANIZATION_ADVANCED_FIELDS: string[] = ["q", "organizationlegalname", "organizationlegalshortname", "country"];
public ORGANIZATION_FIELDS: { [key: string]: FieldDetails } = { public ORGANIZATION_FIELDS: { [key: string]: FieldDetails } = {
["q"]: {name: "Any field", type: "keyword", param: "q", operator: "op", equalityOperator: "=", filterType: null}, ["q"]: {name: "Any field", type: "keyword", param: "q", operator: "op", equalityOperator: "=", filterType: null},
["organizationlegalname"]: { ["organizationlegalname"]: {
@ -695,7 +710,7 @@ export class SearchFields {
//add project field depending on funder //add project field depending on funder
public HIDDEN_FIELDS: string[] = ["fundinglevel0_id", "fundinglevel1_id", "fundinglevel2_id", public HIDDEN_FIELDS: string[] = ["fundinglevel0_id", "fundinglevel1_id", "fundinglevel2_id",
"relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id", "relproject", "instancetypename"]; "relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id", "relproject", "instancetypename"];
public DEPENDENT_FIELDS: { [key: string]: string } = { public DEPENDENT_FIELDS: { [key: string]: string } = {
["relproject"]: "relfunder", ["relproject"]: "relfunder",
["fundinglevel0_id"]: "funder", ["fundinglevel0_id"]: "funder",
@ -706,14 +721,14 @@ export class SearchFields {
["relfundinglevel2_id"]: "relfundinglevel1_id", ["relfundinglevel2_id"]: "relfundinglevel1_id",
["instancetypename"]: "type" ["instancetypename"]: "type"
}; };
public ADVANCED_SEARCH_OPERATORS: string[] = ["and", "or"]; public ADVANCED_SEARCH_OPERATORS: string[] = ["and", "or"];
public COMMUNITIES_SEARCH_FIELDS: string[] = ["type", "access", "role"]; public COMMUNITIES_SEARCH_FIELDS: string[] = ["type", "access", "role"];
public STAKEHOLDER_SEARCH_FIELDS: string[] = ["type", "access", "role"]; public STAKEHOLDER_SEARCH_FIELDS: string[] = ["type", "access", "role"];
constructor() { constructor() {
} }
@ -741,16 +756,17 @@ export class SearchFields {
return null; return null;
} }
} }
getFieldName(fieldId: string, fieldType: string): string { getFieldName(fieldId: string, fieldType: string): string {
let field = this.getField(fieldId, fieldType); let field = this.getField(fieldId, fieldType);
return field?field.name:"UNDEFINED"; return field ? field.name : "UNDEFINED";
} }
sortFieldsByName(fieldIds: string[], fieldIdsMap: { [key: string]: FieldDetails }) { sortFieldsByName(fieldIds: string[], fieldIdsMap: { [key: string]: FieldDetails }) {
fieldIds.sort((a: string, b: string) => { fieldIds.sort((a: string, b: string) => {
if(a == "q") { if (a == "q") {
return -1; return -1;
} else if(b == "q") { } else if (b == "q") {
return 1; return 1;
} }
let nameA: string = fieldIdsMap[a].name; let nameA: string = fieldIdsMap[a].name;
@ -761,30 +777,31 @@ export class SearchFields {
getFieldFilterType(fieldId: string, fieldType: string, usedBy: string = "search"): string { getFieldFilterType(fieldId: string, fieldType: string, usedBy: string = "search"): string {
let field = this.getField(fieldId, fieldType); let field = this.getField(fieldId, fieldType);
return field?field.filterType:"checkbox"; return field ? field.filterType : "checkbox";
} }
getFieldParam(fieldId: string, fieldType: string): string { getFieldParam(fieldId: string, fieldType: string): string {
let field = this.getField(fieldId, fieldType); let field = this.getField(fieldId, fieldType);
return field?field.param:"UNDEFINED"; return field ? field.param : "UNDEFINED";
} }
public static getParameterOrder(fieldId: string, params): number {
public static getParameterOrder(fieldId: string, params): number {
let fields = []; let fields = [];
let searchFields = new SearchFields(); let searchFields = new SearchFields();
if (searchFields.RESULT_REFINE_FIELDS.indexOf(fieldId) !=-1) { if (searchFields.RESULT_REFINE_FIELDS.indexOf(fieldId) != -1) {
fields = searchFields.RESULT_REFINE_FIELDS; fields = searchFields.RESULT_REFINE_FIELDS;
} else if (searchFields.PROJECT_REFINE_FIELDS.indexOf(fieldId) !=-1) { } else if (searchFields.PROJECT_REFINE_FIELDS.indexOf(fieldId) != -1) {
fields = searchFields.PROJECT_REFINE_FIELDS fields = searchFields.PROJECT_REFINE_FIELDS
} else if (searchFields.ORGANIZATION_REFINE_FIELDS.indexOf(fieldId) !=-1) { } else if (searchFields.ORGANIZATION_REFINE_FIELDS.indexOf(fieldId) != -1) {
fields = searchFields.ORGANIZATION_REFINE_FIELDS; fields = searchFields.ORGANIZATION_REFINE_FIELDS;
} else if (searchFields.DATASOURCE_REFINE_FIELDS.indexOf(fieldId) !=-1) { } else if (searchFields.DATASOURCE_REFINE_FIELDS.indexOf(fieldId) != -1) {
fields = searchFields.DATASOURCE_REFINE_FIELDS; fields = searchFields.DATASOURCE_REFINE_FIELDS;
} }
let index = fields.indexOf(fieldId); let index = fields.indexOf(fieldId);
let paramIndex = 0; let paramIndex = 0;
if(index != -1){ if (index != -1) {
for(let keyValue of params){ for (let keyValue of params) {
if(fields.indexOf(keyValue[0])>index){ if (fields.indexOf(keyValue[0]) > index) {
break; break;
} }
paramIndex++ paramIndex++
@ -792,6 +809,7 @@ export class SearchFields {
} }
return paramIndex; return paramIndex;
} }
/* /*
AND AND
Funder: relfunder, relfundinglevel0_id, relfundinglevel1_id, relfundinglevel2_id Funder: relfunder, relfundinglevel0_id, relfundinglevel1_id, relfundinglevel2_id
@ -818,15 +836,15 @@ export class SearchFields {
Subjects: Subjects:
Supported Identifiers: Supported Identifiers:
*/ */
getFieldOperator(fieldId: string): string { getFieldOperator(fieldId: string): string {
if (fieldId == "relfunder" || fieldId == "relfundinglevel0_id" || fieldId == "relfundinglevel1_id" || fieldId == "relfundinglevel2_id" if (fieldId == "relfunder" || fieldId == "relfundinglevel0_id" || fieldId == "relfundinglevel1_id" || fieldId == "relfundinglevel2_id"
|| fieldId == "relproject" || fieldId == "community" || fieldId == "projectendyear-range-projectstartyear") { || fieldId == "relproject" || fieldId == "community" || fieldId == "projectendyear-range-projectstartyear") {
return "and"; return "and";
} else if (fieldId == "instancetypename" || fieldId == "eoscdatasourcetype" } else if (fieldId == "instancetypename" || fieldId == "eoscdatasourcetype"
|| fieldId == "resultlanguagename" || fieldId == "datasourceodlanguages" || fieldId == "resultlanguagename" || fieldId == "datasourceodlanguages"
|| fieldId == "datasourcecompatibilityname" || fieldId == "country" || fieldId == "datasourceodcontenttypes" || fieldId == "datasourcecompatibilityname" || fieldId == "country" || fieldId == "datasourceodcontenttypes"
|| fieldId == "resulthostingdatasource" || fieldId == "collectedfrom") { || fieldId == "resulthostingdatasource" || fieldId == "collectedfrom") {
return "or"; return "or";
} }
return "or"; return "or";