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">
<icon *ngIf="!searchControl?.value && icon" [name]="icon" [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)">
<icon [flex]="true" name="close"></icon>
</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)">
<icon [flex]="true" name="close"></icon>
</button>

View File

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