Merge branch 'new-theme' of code-repo.d4science.org:MaDgIK/openaire-library into new-theme

This commit is contained in:
Konstantinos Triantafyllou 2022-06-23 19:47:00 +03:00
commit 4966a1d342
7 changed files with 28 additions and 6 deletions

View File

@ -18,7 +18,7 @@ import {OpenaireEntities} from '../../utils/properties/searchFields';
<ng-container *ngFor="let filter of fetchProjects.filters"> <ng-container *ngFor="let filter of fetchProjects.filters">
<div class="uk-inline"> <div class="uk-inline">
<button class="uk-button uk-button-default uk-button-small uk-margin-small-bottom" type="button"> <button class="uk-button uk-button-default uk-button-small uk-margin-small-bottom" type="button">
{{filter.title}} <span uk-icon="chevron-down"></span> {{filter.title}}<span *ngIf="filter.countSelectedValues>0"> ({{filter.countSelectedValues}})</span> <span uk-icon="chevron-down"></span>
</button> </button>
<div uk-dropdown="mode: click" class="uk-width-large uk-overflow-auto" style="max-width:460px !important; "> <div uk-dropdown="mode: click" class="uk-width-large uk-overflow-auto" style="max-width:460px !important; ">
<div class="uk-padding-small uk-overflow-auto uk-height-max-large uk-height-min-medium"> <div class="uk-padding-small uk-overflow-auto uk-height-max-large uk-height-min-medium">
@ -111,12 +111,14 @@ export class ProjectsInModalComponent {
private updateFilters() { private updateFilters() {
this.filterQuery = ""; this.filterQuery = "";
for (let filter of this.fetchProjects.filters) { for (let filter of this.fetchProjects.filters) {
filter.countSelectedValues = 0;
var filterLimits = ""; var filterLimits = "";
for (let value of filter.values) { for (let value of filter.values) {
if (value.selected == true) { if (value.selected == true) {
//filterLimits+=((filterLimits.length == 0)?'':',') +'"'+ StringUtils.URIEncode(value.id)+'"'; //filterLimits+=((filterLimits.length == 0)?'':',') +'"'+ StringUtils.URIEncode(value.id)+'"';
filterLimits += ((filterLimits.length == 0) ? '' : ' or ') + filter.filterId + ' exact '; filterLimits += ((filterLimits.length == 0) ? '' : ' or ') + filter.filterId + ' exact ';
filterLimits += '"' + StringUtils.URIEncode(value.id) + '"'; filterLimits += '"' + StringUtils.URIEncode(value.id) + '"';
filter.countSelectedValues++;
} }
} }
if (filterLimits.length > 0) { if (filterLimits.length > 0) {

View File

@ -136,6 +136,7 @@ export class SearchAllComponent {
this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService); this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService);
this.fetchOrps = new FetchResearchResults(this._searchResearchResultsService); this.fetchOrps = new FetchResearchResults(this._searchResearchResultsService);
this.fetchOrganizations = new FetchOrganizations(this._searchOrganizationsService); this.fetchOrganizations = new FetchOrganizations(this._searchOrganizationsService);
this.searchFields.sortFieldsByName(this.fieldIds, this.fieldIdsMap);
this.selectedFields.push(new AdvancedField(this.fieldIds[0], this.fieldIdsMap[this.fieldIds[0]].param, this.fieldIdsMap[this.fieldIds[0]].name, this.fieldIdsMap[this.fieldIds[0]].type, '', "and")); this.selectedFields.push(new AdvancedField(this.fieldIds[0], this.fieldIdsMap[this.fieldIds[0]].param, this.fieldIdsMap[this.fieldIds[0]].name, this.fieldIdsMap[this.fieldIds[0]].type, '', "and"));
} }

View File

@ -99,6 +99,8 @@ export class SearchDataProvidersComponent {
this.errorCodes = new ErrorCodes(); this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent(); this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING; this.searchUtils.status = this.errorCodes.LOADING;
this.searchFields.sortFieldsByName(this.fieldIds, this.fieldIdsMap);
} }
ngOnInit() { ngOnInit() {
this.refineFields = DatasourcesHelperClass.getrefineFields(this.type); this.refineFields = DatasourcesHelperClass.getrefineFields(this.type);

View File

@ -89,8 +89,7 @@ export class SearchOrganizationsComponent {
this.errorMessages = new ErrorMessagesComponent(); this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING; this.searchUtils.status = this.errorCodes.LOADING;
this.searchFields.sortFieldsByName(this.fieldIds, this.fieldIdsMap);
} }
ngOnInit() { ngOnInit() {

View File

@ -92,6 +92,8 @@ export class SearchProjectsComponent {
this.errorMessages = new ErrorMessagesComponent(); this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING; this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.refineStatus = this.errorCodes.LOADING; this.searchUtils.refineStatus = this.errorCodes.LOADING;
this.searchFields.sortFieldsByName(this.fieldIds, this.fieldIdsMap);
} }
ngOnInit() { ngOnInit() {

View File

@ -113,6 +113,8 @@ export class SearchResearchResultsComponent {
this.searchUtils.status = this.errorCodes.LOADING; this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.refineStatus = this.errorCodes.LOADING; this.searchUtils.refineStatus = this.errorCodes.LOADING;
this.getPublicCommunities(); this.getPublicCommunities();
this.searchFields.sortFieldsByName(this.fieldIds, this.fieldIdsMap);
} }
getRoute(){ getRoute(){

View File

@ -418,7 +418,7 @@ export class SearchFields {
"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"]; "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},
@ -549,7 +549,8 @@ export class SearchFields {
operator: "ju", operator: "ju",
equalityOperator: " exact ", equalityOperator: " exact ",
filterType: "checkbox" filterType: "checkbox"
} },
["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 } [] = [
@ -698,7 +699,20 @@ export class SearchFields {
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 }) {
fieldIds.sort((a: string, b: string) => {
if(a == "q") {
return -1;
} else if(b == "q") {
return 1;
}
let nameA: string = fieldIdsMap[a].name;
let nameB: string = fieldIdsMap[b].name;
return nameA.localeCompare(nameB);
})
}
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";