Merge branch 'new-theme' of code-repo.d4science.org:MaDgIK/openaire-library into new-theme
This commit is contained in:
commit
4966a1d342
|
@ -18,7 +18,7 @@ import {OpenaireEntities} from '../../utils/properties/searchFields';
|
|||
<ng-container *ngFor="let filter of fetchProjects.filters">
|
||||
<div class="uk-inline">
|
||||
<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>
|
||||
<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">
|
||||
|
@ -111,12 +111,14 @@ export class ProjectsInModalComponent {
|
|||
private updateFilters() {
|
||||
this.filterQuery = "";
|
||||
for (let filter of this.fetchProjects.filters) {
|
||||
filter.countSelectedValues = 0;
|
||||
var filterLimits = "";
|
||||
for (let value of filter.values) {
|
||||
if (value.selected == true) {
|
||||
//filterLimits+=((filterLimits.length == 0)?'':',') +'"'+ StringUtils.URIEncode(value.id)+'"';
|
||||
filterLimits += ((filterLimits.length == 0) ? '' : ' or ') + filter.filterId + ' exact ';
|
||||
filterLimits += '"' + StringUtils.URIEncode(value.id) + '"';
|
||||
filter.countSelectedValues++;
|
||||
}
|
||||
}
|
||||
if (filterLimits.length > 0) {
|
||||
|
|
|
@ -136,6 +136,7 @@ export class SearchAllComponent {
|
|||
this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService);
|
||||
this.fetchOrps = new FetchResearchResults(this._searchResearchResultsService);
|
||||
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"));
|
||||
|
||||
}
|
||||
|
|
|
@ -99,6 +99,8 @@ export class SearchDataProvidersComponent {
|
|||
this.errorCodes = new ErrorCodes();
|
||||
this.errorMessages = new ErrorMessagesComponent();
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
|
||||
this.searchFields.sortFieldsByName(this.fieldIds, this.fieldIdsMap);
|
||||
}
|
||||
ngOnInit() {
|
||||
this.refineFields = DatasourcesHelperClass.getrefineFields(this.type);
|
||||
|
|
|
@ -89,8 +89,7 @@ export class SearchOrganizationsComponent {
|
|||
this.errorMessages = new ErrorMessagesComponent();
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
|
||||
|
||||
|
||||
this.searchFields.sortFieldsByName(this.fieldIds, this.fieldIdsMap);
|
||||
}
|
||||
ngOnInit() {
|
||||
|
||||
|
|
|
@ -92,6 +92,8 @@ export class SearchProjectsComponent {
|
|||
this.errorMessages = new ErrorMessagesComponent();
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
this.searchUtils.refineStatus = this.errorCodes.LOADING;
|
||||
|
||||
this.searchFields.sortFieldsByName(this.fieldIds, this.fieldIdsMap);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
|
|
@ -113,6 +113,8 @@ export class SearchResearchResultsComponent {
|
|||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
this.searchUtils.refineStatus = this.errorCodes.LOADING;
|
||||
this.getPublicCommunities();
|
||||
|
||||
this.searchFields.sortFieldsByName(this.fieldIds, this.fieldIdsMap);
|
||||
}
|
||||
|
||||
getRoute(){
|
||||
|
|
|
@ -418,7 +418,7 @@ export class SearchFields {
|
|||
"datasourcejurisdiction"];
|
||||
public DATASOURCE_ADVANCED_FIELDS: string[] = ["q", "datasourceofficialname",
|
||||
"datasourceenglishname", "datasourceodsubjects", "datasourcetypename", "datasourceodlanguages",
|
||||
"datasourceodcontenttypes", "datasourcecompatibilityname", "relorganizationid", "collectedfromdatasourceid"];
|
||||
"datasourceodcontenttypes", "datasourcecompatibilityname", "relorganizationid", "collectedfromdatasourceid", "pid"];
|
||||
|
||||
public DATASOURCE_FIELDS: { [key: string]: FieldDetails } = {
|
||||
["q"]: {name: "Any field", type: "keyword", param: "q", operator: "op", equalityOperator: "=", filterType: null},
|
||||
|
@ -549,7 +549,8 @@ export class SearchFields {
|
|||
operator: "ju",
|
||||
equalityOperator: " exact ",
|
||||
filterType: "checkbox"
|
||||
}
|
||||
},
|
||||
["pid"]: {name: "PID", type: "keyword", param: "pid", operator: "pd", equalityOperator: " exact ", filterType: null}
|
||||
};
|
||||
|
||||
public DEPOSIT_DATASOURCE_KEYWORD_FIELDS: { "name": string, "equalityOperator": string } [] = [
|
||||
|
@ -699,6 +700,19 @@ export class SearchFields {
|
|||
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 {
|
||||
let field = this.getField(fieldId, fieldType);
|
||||
return field?field.filterType:"checkbox";
|
||||
|
|
Loading…
Reference in New Issue