Advanced form: apply new design (not completed). Entities selection for advanced form

This commit is contained in:
Konstantinos Triantafyllou 2022-04-18 11:29:14 +03:00
parent 0358887d4f
commit 5f042433be
5 changed files with 219 additions and 200 deletions

View File

@ -1,179 +1,185 @@
<div *ngIf="!simpleView"> <ng-container *ngIf="!simpleView">
<a *ngIf="showSwitchSearchLink && simpleSearchLink && simpleSearchLink.length > 0" <div class="uk-margin-small-bottom uk-grid uk-grid-small uk-flex-middle" uk-grid>
routerLinkActive="router-link-active" <div class="uk-width-2-5@m uk-width-1-1 uk-flex uk-flex-middle uk-flex-center uk-flex-left@m">
[routerLink]=simpleSearchLink style="z-index:1;" <span class="uk-margin-small-right uk-text-small" [class.uk-light]="dark">Advanced search in</span>
[queryParams]="customFilter?customFilter.getParameters():{}" <span *ngIf="disableSelect" class="uk-text-small uk-text-bold" [class.uk-light]="dark">{{entities.getLabel(entityType)}}</span>
[class]="(isDisabled)?'uk-float-right uk-disabled uk-link-muted portal-link uk-margin-right ':'uk-float-right portal-link uk-margin-right '">Quick search <entities-selection #entities [class.uk-hidden]="disableSelect" class="uk-width-expand" [simpleView]="false"
</a> [currentEntity]="entityType" [customFilter]="customFilter" (disableSelectEmitter)="disableSelectChange($event)"></entities-selection>
<h6 class="uk-margin-small-bottom"> </div>
Advanced search in <div class="uk-width-expand uk-text-small uk-flex uk-flex-center uk-flex-right@m" [class.uk-light]="dark">
<entities-selection [simpleView]="false" [currentEntity]="entityType" <a *ngIf="showSwitchSearchLink && simpleSearchLink && simpleSearchLink.length > 0"
[properties]="properties" [customFilter]="customFilter" ></entities-selection> [routerLink]=simpleSearchLink
[queryParams]="customFilter?customFilter.getParameters():{}"
</h6> [ngClass]="(isDisabled)?'uk-disabled uk-link-muted':null">Simple Search</a>
</div> </div>
<form *ngIf="!simpleView" </div>
[class]="((isDisabled )?'uk-disabled ':'') <div class="uk-card uk-card-default" [class.dark]="dark">
<form *ngIf="!simpleView"
[class]="((isDisabled )?'uk-disabled ':'')
+' advancedSearchForm uk-tile uk-padding-small uk-margin-medium-bottom'"> +' advancedSearchForm uk-tile uk-padding-small uk-margin-medium-bottom'">
<div> <div>
<!-- <quick-selections [resultTypes]="resultTypes" (typeChange)="queryChanged()" [isDisabled]="isDisabled" <!-- <quick-selections [resultTypes]="resultTypes" (typeChange)="queryChanged()" [isDisabled]="isDisabled"
[quickFilter]="quickFilter" [QFselected]="(quickFilter)?quickFilter.selected:null" [quickFilter]="quickFilter" [QFselected]="(quickFilter)?quickFilter.selected:null"
[properties]="properties" class="uk-grid " [properties]="properties" class="uk-grid "
></quick-selections> ></quick-selections>
<hr *ngIf="resultTypes || quickFilter" class="uk-margin-small">--> <hr *ngIf="resultTypes || quickFilter" class="uk-margin-small">-->
<table class=" uk-table uk-table-responsive uk-table-small uk-margin-remove"> <table class=" uk-table uk-table-responsive uk-table-small uk-margin-remove">
<tr> <tr>
<td class="uk-text-muted uk-text-uppercase">Field to search</td> <td class="uk-text-muted uk-text-uppercase">Field to search</td>
<td class="uk-text-muted uk-text-uppercase uk-width-1-2">Term</td> <td class="uk-text-muted uk-text-uppercase uk-width-1-2">Term</td>
</tr> </tr>
<tr *ngFor="let selectedField of selectedFields; let i = index"> <tr *ngFor="let selectedField of selectedFields; let i = index">
<td><mat-select [(ngModel)]="selectedField.id" name="selectField_{{i}}" [disableOptionCentering]="true" class="matSelection" panelClass="matSelectionPanel" <td><mat-select [(ngModel)]="selectedField.id" name="selectField_{{i}}" [disableOptionCentering]="true" class="matSelection" panelClass="matSelectionPanel"
(ngModelChange)="fieldIdsChanged(i,selectedField.id)"><!--(click)="fieldIdsChanged(i)" --> (ngModelChange)="fieldIdsChanged(i,selectedField.id)"><!--(click)="fieldIdsChanged(i)" -->
<mat-option *ngFor="let id of fieldIds" [value]="id">{{fieldIdsMap[id].name}} </mat-option> <mat-option *ngFor="let id of fieldIds" [value]="id">{{fieldIdsMap[id].name}} </mat-option>
</mat-select></td> </mat-select></td>
<td *ngIf="selectedField.type == 'keyword' || selectedField.type == 'identifier'"> <td *ngIf="selectedField.type == 'keyword' || selectedField.type == 'identifier'">
<div class="uk-inline uk-width-expand"> <div class="uk-inline uk-width-expand">
<a *ngIf="selectedField.value.length > 0" class="uk-form-icon uk-form-icon-flip" <a *ngIf="selectedField.value.length > 0" class="uk-form-icon uk-form-icon-flip"
(click)="selectedField.value = ''" (click)="selectedField.value = ''"
uk-icon="icon: close"></a> uk-icon="icon: close"></a>
<input type="text" class="form-control uk-input" <input type="text" class="form-control uk-input"
placeholder="Type keywords..." placeholder="Type keywords..."
[(ngModel)]="selectedField.value" name="value[{{i}}]"> [(ngModel)]="selectedField.value" name="value[{{i}}]">
</div> </div>
</td> </td>
<td *ngIf="selectedField.type == 'date'"> <td *ngIf="selectedField.type == 'date'">
<date-filter [dateValue]=selectedField.dateValue [validDateFrom]=validDateFrom class="uk-width-expand" <date-filter [dateValue]=selectedField.dateValue [validDateFrom]=validDateFrom class="uk-width-expand"
[validDateTo]=validDateTo></date-filter> [validDateTo]=validDateTo></date-filter>
</td> </td>
<td *ngIf=" selectedField.id && selectedField.type == 'vocabulary'"> <td *ngIf=" selectedField.id && selectedField.type == 'vocabulary'">
<static-autocomplete [properties]=properties *ngIf=" selectedField.id" [vocabularyId]=selectedField.param <static-autocomplete [properties]=properties *ngIf=" selectedField.id" [vocabularyId]=selectedField.param
[fieldId]=selectedField.id [fieldId]=selectedField.id
[list]=this.fieldList[selectedField.id] [entityName]="entityType" [list]=this.fieldList[selectedField.id] [entityName]="entityType"
[selectedValue]=selectedField.value [showSelected]=true [selectedValue]=selectedField.value [showSelected]=true
[placeHolderMessage]="'Search for '+selectedField.name" [title]="selectedField.name" [placeHolderMessage]="'Search for '+selectedField.name" [title]="selectedField.name"
[multipleSelections]=false [multipleSelections]=false
(selectedValueChanged)="valueChanged($event,i)" (selectedValueChanged)="valueChanged($event,i)"
(listUpdated)="listUpdated($event,selectedField.id)"></static-autocomplete> (listUpdated)="listUpdated($event,selectedField.id)"></static-autocomplete>
</td> </td>
<td *ngIf=" selectedField.id && selectedField.type == 'refine'" class="uk-width-1-3"> <td *ngIf=" selectedField.id && selectedField.type == 'refine'" class="uk-width-1-3">
<static-autocomplete [properties]=properties [list]=this.fieldList[selectedField.id] <static-autocomplete [properties]=properties [list]=this.fieldList[selectedField.id]
[fieldId]=selectedField.id [entityName]="entityType" [fieldName]=[selectedField.id] [fieldId]=selectedField.id [entityName]="entityType" [fieldName]=[selectedField.id]
[selectedValue]=selectedField.value [showSelected]=true [selectedValue]=selectedField.value [showSelected]=true
[placeHolderMessage]="'Search for '+selectedField.name" [title]="selectedField.name" [placeHolderMessage]="'Search for '+selectedField.name" [title]="selectedField.name"
[multipleSelections]=false (selectedValueChanged)="valueChanged($event,i)" [multipleSelections]=false (selectedValueChanged)="valueChanged($event,i)"
(listUpdated)="listUpdated($event,selectedField.id)" (listUpdated)="listUpdated($event,selectedField.id)"
(updateValueLabel)="updatedValueLabel($event, i)"></static-autocomplete> (updateValueLabel)="updatedValueLabel($event, i)"></static-autocomplete>
</td> </td>
<td *ngIf="selectedField.type == 'entity'"> <td *ngIf="selectedField.type == 'entity'">
<entities-autocomplete [properties]=properties [fieldId]=selectedField.id [entityType]=selectedField.param <entities-autocomplete [properties]=properties [fieldId]=selectedField.id [entityType]=selectedField.param
[selectedValue]=selectedField.value [showSelected]=true [selectedValue]=selectedField.value [showSelected]=true
[placeHolderMessage]="'Search for '+selectedField.name" [title]="selectedField.name" [placeHolderMessage]="'Search for '+selectedField.name" [title]="selectedField.name"
[multipleSelections]=false [multipleSelections]=false
(selectedValueChanged)="valueChanged($event,i)" (selectedValueChanged)="valueChanged($event,i)"
(updateValueLabel)="updatedValueLabel($event, i)"> (updateValueLabel)="updatedValueLabel($event, i)">
</entities-autocomplete> </entities-autocomplete>
</td> </td>
<td *ngIf="selectedField.type == 'boolean'" class="input-group"> <td *ngIf="selectedField.type == 'boolean'" class="input-group">
<span class="input-group-addon"> <span class="input-group-addon">
<input type="radio" [(ngModel)]="selectedField.value" [name]=selectedField.param <input type="radio" [(ngModel)]="selectedField.value" [name]=selectedField.param
value="true">Yes<br> value="true">Yes<br>
</span> </span>
<span class="input-group-addon"> <span class="input-group-addon">
<input type="radio" [(ngModel)]="selectedField.value" [name]=selectedField.param <input type="radio" [(ngModel)]="selectedField.value" [name]=selectedField.param
value="false">No<br> value="false">No<br>
</span> </span>
</td> </td>
<td style="min-width: 75px;"><mat-select *ngIf="i+1 <selectedFields.length" <td style="min-width: 75px;"><mat-select *ngIf="i+1 <selectedFields.length"
[(ngModel)]="selectedFields[i+1].operatorId" [(ngModel)]="selectedFields[i+1].operatorId"
name="selectOp_{{i}}" [disableOptionCentering]="true" class="matSelection uk-input" panelClass="matSelectionPanel"> name="selectOp_{{i}}" [disableOptionCentering]="true" class="matSelection uk-input" panelClass="matSelectionPanel">
<mat-option *ngFor="let op of operators" (change)="fieldOperatorChanged(i+1, op.id, op.id)" <mat-option *ngFor="let op of operators" (change)="fieldOperatorChanged(i+1, op.id, op.id)"
(click)="fieldOperatorChanged(i+1, op.id, op.id)" [value]="op.id">{{op.id}}</mat-option> (click)="fieldOperatorChanged(i+1, op.id, op.id)" [value]="op.id">{{op.id}}</mat-option>
</mat-select> </mat-select>
<div *ngIf="i == selectedFields.length-1 " class=" uk-text-right" style="margin-top: 55px;"> <div *ngIf="i == selectedFields.length-1 " class=" uk-text-right" style="margin-top: 55px;">
<span class="uk-text-muted uk-text-uppercase uk-margin-small-right " > Add rule</span> <span class="uk-text-muted uk-text-uppercase uk-margin-small-right " > Add rule</span>
</div> </div>
</td> </td>
<td class=" "> <td class=" ">
<span type="button" class="uk-icon-button portal-button-reverse clickable " <span type="button" class="uk-icon-button portal-button-reverse clickable "
(click)="removeField(i)"> (click)="removeField(i)">
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" <span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg" data-svg="minus"><rect height="1" width="18" y="9" x="1"></rect></svg></span> xmlns="http://www.w3.org/2000/svg" data-svg="minus"><rect height="1" width="18" y="9" x="1"></rect></svg></span>
</span> </span>
<div *ngIf="i == selectedFields.length-1 " class="uk-margin-small-top"> <div *ngIf="i == selectedFields.length-1 " class="uk-margin-small-top">
<span type="button" <span type="button"
class="uk-icon-button portal-button clickable " class="uk-icon-button portal-button clickable "
(click)="addField()"> (click)="addField()">
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" <span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg" data-svg="plus"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></span> xmlns="http://www.w3.org/2000/svg" data-svg="plus"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></span>
</span> </span>
</div>
</td>
</tr>
</table>
<div class=" uk-text-center">
<div *ngIf="!validDateFrom && validDateTo" class="uk-text-danger">
Please check your <u>from</u> date
</div> </div>
</td> <div *ngIf="!validDateTo && validDateFrom" class="uk-text-danger">
</tr> Please check your <u>to</u> date
</table> </div>
<div class=" uk-text-center"> <div *ngIf="!validDateFrom && !validDateTo" class="uk-text-danger">
<div *ngIf="!validDateFrom && validDateTo" class="uk-text-danger"> Please check your dates
Please check your <u>from</u> date </div>
</div> </div>
<div *ngIf="!validDateTo && validDateFrom" class="uk-text-danger"> <button (click)="queryChanged()" type="submit"
Please check your <u>to</u> date class=" uk-button uk-padding uk-padding-remove-top uk-padding-remove-bottom portal-button uk-padding uk-padding-remove-top uk-padding-remove-bottom " style="position: absolute;bottom: -19px;left: 45%;"> Search
</div> </button>
<div *ngIf="!validDateFrom && !validDateTo" class="uk-text-danger">
Please check your dates
</div> </div>
</form>
</div>
</ng-container>
<div *ngIf="simpleView" class="uk-flex uk-flex-center uk-flex-wrap">
<div class="uk-width-xlarge@l uk-width-large">
<div class="uk-margin-small-bottom uk-text-small uk-flex uk-flex-right" [class.uk-light]="dark" *ngIf="showSwitchSearchLink">
<a *ngIf ="this.entityType !='all' && this.entityType == this.selectedEntity && advancedSearchLink"
[routerLink]="advancedSearchLink" [queryParams]="advancedSearchLinkParameters"
[ngClass]="(isDisabled)?'uk-disabled uk-link-muted':null">Advanced search
</a>
<a *ngIf =" this.entityType !='all' && this.entityType != this.selectedEntity && selectedEntityAdvancedUrl "
[routerLink]="selectedEntityAdvancedUrl"
[queryParams]="{q:this.selectedFields[0].value,op:'and'}"
[ngClass]="(isDisabled)?'uk-disabled uk-link-muted':null">Advanced search
</a>
<ng-container *ngIf="this.entityType=='all'">
<a>Advanced Search</a>
<div class="uk-dropdown" uk-dropdown="pos: bottom-left; offset: 5; delay-hide: 0;">
<ul class="uk-nav uk-dropdown-nav">
<li>
<a [routerLink]="properties.searchLinkToAdvancedResults" [queryParams]="advancedSearchLinkParameters">Research outcomes</a>
</li>
<li>
<a [routerLink]="properties.searchLinkToAdvancedProjects" [queryParams]="advancedSearchLinkParameters" >Projects</a>
</li>
<li>
<a [routerLink]="properties.searchLinkToAdvancedDataProviders" [queryParams]="advancedSearchLinkParameters">Content providers</a>
</li>
<li>
<a [routerLink]="properties.searchLinkToAdvancedOrganizations" [queryParams]="advancedSearchLinkParameters">Organizations</a>
</li>
</ul>
</div>
</ng-container>
</div> </div>
<button (click)="queryChanged()" type="submit" <div class="uk-flex uk-flex-center uk-child-width-1-1">
class=" uk-button uk-padding uk-padding-remove-top uk-padding-remove-bottom portal-button uk-padding uk-padding-remove-top uk-padding-remove-bottom " style="position: absolute;bottom: -19px;left: 45%;"> Search <ng-container *ngIf="entitiesSelection">
</button> <advanced-search-input [class.uk-hidden]="disableSelect" [dark]="dark" [disabled]="isDisabled" (searchEmitter)="simpleKeywordChanged()">
</div> <entities-selection [simpleView]="true" [currentEntity]="entityType"
</form> (selectionChange)="simpleEntityChanged($event)" (disableSelectEmitter)="disableSelectChange($event)"
<div *ngIf="simpleView"> [onChangeNavigate]="true" [customFilter]="customFilter"></entities-selection>
<div class="uk-margin-small-bottom uk-flex uk-flex-right" [class.uk-light]="dark" *ngIf="showSwitchSearchLink"> <div input placeholder="Scholary works" [hint]="formPlaceholderText" [(value)]="selectedFields[0].value"></div>
<a *ngIf ="this.entityType !='all' && this.entityType == this.selectedEntity && advancedSearchLink" </advanced-search-input>
[routerLink]="advancedSearchLink" [queryParams]="advancedSearchLinkParameters" <div *ngIf="selectedFields[0] && disableSelect" search-input [disabled]="isDisabled" [(value)]="selectedFields[0].value"
[ngClass]="(isDisabled)?'uk-disabled uk-link-muted':null">Advanced search [placeholder]="formPlaceholderText" (searchEmitter)="simpleKeywordChanged()"></div>
</a> </ng-container>
<a *ngIf =" this.entityType !='all' && this.entityType != this.selectedEntity && selectedEntityAdvancedUrl " <div *ngIf="selectedFields[0] && !entitiesSelection" search-input [disabled]="isDisabled" [(value)]="selectedFields[0].value"
[routerLink]="selectedEntityAdvancedUrl"
[queryParams]="{q:this.selectedFields[0].value,op:'and'}"
[ngClass]="(isDisabled)?'uk-disabled uk-link-muted':null">Advanced search
</a>
<ng-container *ngIf="this.entityType=='all'">
<a>Advanced Search</a>
<div class="uk-dropdown" uk-dropdown="pos: bottom-left; offset: 5; delay-hide: 0;">
<ul class="uk-nav uk-dropdown-nav">
<li>
<a [routerLink]="properties.searchLinkToAdvancedResults" [queryParams]="advancedSearchLinkParameters">Research outcomes</a>
</li>
<li>
<a [routerLink]="properties.searchLinkToAdvancedProjects" [queryParams]="advancedSearchLinkParameters" >Projects</a>
</li>
<li>
<a [routerLink]="properties.searchLinkToAdvancedDataProviders" [queryParams]="advancedSearchLinkParameters">Content providers</a>
</li>
<li>
<a [routerLink]="properties.searchLinkToAdvancedOrganizations" [queryParams]="advancedSearchLinkParameters">Organizations</a>
</li>
</ul>
</div>
</ng-container>
</div>
<div class="uk-flex uk-flex-center uk-width-xlarge@l uk-width-large uk-child-width-1-1">
<ng-container *ngIf="entitiesSelection">
<advanced-search-input [class.uk-hidden]="entities.disableSelect" [dark]="dark" [disabled]="isDisabled" (searchEmitter)="simpleKeywordChanged()">
<entities-selection #entities [simpleView]="true" [currentEntity]="entityType"
(selectionChange)="simpleEntityChanged($event)"
[onChangeNavigate]="true" [customFilter]="customFilter"></entities-selection>
<div input placeholder="Scholary works" [hint]="formPlaceholderText" [(value)]="selectedFields[0].value"></div>
</advanced-search-input>
<div *ngIf="selectedFields[0] && entities.disableSelect" search-input [disabled]="isDisabled" [(value)]="selectedFields[0].value"
[placeholder]="formPlaceholderText" (searchEmitter)="simpleKeywordChanged()"></div> [placeholder]="formPlaceholderText" (searchEmitter)="simpleKeywordChanged()"></div>
</ng-container> </div>
<div *ngIf="selectedFields[0] && !entitiesSelection" search-input [disabled]="isDisabled" [(value)]="selectedFields[0].value"
[placeholder]="formPlaceholderText" (searchEmitter)="simpleKeywordChanged()"></div>
</div> </div>
</div> </div>

View File

@ -28,6 +28,7 @@ export class AdvancedSearchFormComponent {
@Output() queryChange = new EventEmitter(); @Output() queryChange = new EventEmitter();
@Input() resultTypes; @Input() resultTypes;
@Input() quickFilter: { filter: Filter, selected: boolean, filterId: string, value: string }; @Input() quickFilter: { filter: Filter, selected: boolean, filterId: string, value: string };
public disableSelect: boolean = false;
validDateFrom: boolean = true; validDateFrom: boolean = true;
validDateTo: boolean = true; validDateTo: boolean = true;
@Input() customFilter: SearchCustomFilter; @Input() customFilter: SearchCustomFilter;
@ -106,6 +107,10 @@ export class AdvancedSearchFormComponent {
} }
} }
disableSelectChange(value) {
this.disableSelect = value;
}
addField() { addField() {
this.newFieldId = this.fieldIds[0]; this.newFieldId = this.fieldIds[0];
var type = this.fieldIdsMap[this.newFieldId].type; var type = this.fieldIdsMap[this.newFieldId].type;

View File

@ -11,10 +11,14 @@ import {OpenaireEntities} from "../../utils/properties/searchFields";
@Component({ @Component({
selector: 'entities-selection', selector: 'entities-selection',
template: ` template: `
<ng-container *ngIf="simpleView"> <ng-container *ngIf="simpleView && entities.length > 0">
<div #input input placeholder="Type" hint="What type of content?" inputClass="advanced-search" <div #input input placeholder="Type" hint="What type of content?" inputClass="advanced-search"
[options]="entities" [(value)]="selectedEntity" (valueChange)="entityChanged()" type="select"></div> [options]="entities" [(value)]="selectedEntity" (valueChange)="entityChanged()" type="select"></div>
</ng-container> </ng-container>
<ng-container *ngIf="!simpleView && entities.length > 0">
<div #input input inputClass="inner small"
[options]="entities" [(value)]="selectedEntity" (valueChange)="entityChanged()" type="select"></div>
</ng-container>
` `
}) })
export class EntitiesSelectionComponent { export class EntitiesSelectionComponent {
@ -24,9 +28,9 @@ export class EntitiesSelectionComponent {
@Input() currentEntity = "result"; @Input() currentEntity = "result";
@Input() simpleView: boolean = true; @Input() simpleView: boolean = true;
@Input() onChangeNavigate: boolean = true; @Input() onChangeNavigate: boolean = true;
@Input() disableSelect: boolean = false;
@Output() selectionChange = new EventEmitter(); @Output() selectionChange = new EventEmitter();
@ViewChild('input') input: InputComponent; @ViewChild('input') input: InputComponent;
@Output() disableSelectEmitter: EventEmitter<boolean> = new EventEmitter<boolean>();
public entities: Option[] = []; public entities: Option[] = [];
public properties: EnvProperties = properties; public properties: EnvProperties = properties;
private subscriptions: Subscription[] = []; private subscriptions: Subscription[] = [];
@ -53,7 +57,9 @@ export class EntitiesSelectionComponent {
} }
} }
if(this.onlyresults) { if(this.onlyresults) {
this.entities.push({label: 'All ' + OpenaireEntities.RESULTS.toLowerCase(), value: 'all'}); if(this.simpleView) {
this.entities.push({label: 'All ' + OpenaireEntities.RESULTS.toLowerCase(), value: 'all'});
}
if(showPage[this.simpleView ? this.properties.searchLinkToResults : this.properties.searchLinkToAdvancedResults] && showEntity["publication"]) { if(showPage[this.simpleView ? this.properties.searchLinkToResults : this.properties.searchLinkToAdvancedResults] && showEntity["publication"]) {
this.entities.push({label: OpenaireEntities.PUBLICATIONS, value: 'publications'}); this.entities.push({label: OpenaireEntities.PUBLICATIONS, value: 'publications'});
} }
@ -67,12 +73,13 @@ export class EntitiesSelectionComponent {
this.entities.push({label: OpenaireEntities.OTHER, value: 'other'}); this.entities.push({label: OpenaireEntities.OTHER, value: 'other'});
} }
} else { } else {
this.entities.push({label: 'All Content', value: 'all'}); if(this.simpleView) {
this.entities.push({label: 'All Content', value: 'all'});
}
if(showPage[this.simpleView ? this.properties.searchLinkToResults : this.properties.searchLinkToAdvancedResults] if(showPage[this.simpleView ? this.properties.searchLinkToResults : this.properties.searchLinkToAdvancedResults]
&& (showEntity["publication"] || showEntity["dataset"] || showEntity["software"] || showEntity["orp"])) { && (showEntity["publication"] || showEntity["dataset"] || showEntity["software"] || showEntity["orp"])) {
this.entities.push({label: OpenaireEntities.RESULTS, value: 'result'}); this.entities.push({label: OpenaireEntities.RESULTS, value: 'result'});
} }
if(showPage[this.simpleView ? this.properties.searchLinkToProjects : this.properties.searchLinkToAdvancedProjects] && showEntity["project"]) { if(showPage[this.simpleView ? this.properties.searchLinkToProjects : this.properties.searchLinkToAdvancedProjects] && showEntity["project"]) {
this.entities.push({label: OpenaireEntities.PROJECTS, value: 'project'}); this.entities.push({label: OpenaireEntities.PROJECTS, value: 'project'});
} }
@ -90,28 +97,36 @@ export class EntitiesSelectionComponent {
this.entities = this.entities.filter(option => option.value !== 'project' && option.value !== 'dataprovider'); this.entities = this.entities.filter(option => option.value !== 'project' && option.value !== 'dataprovider');
} }
} }
this.disableSelect = this.entities.length == 1; console.log(this.entities);
this.disableSelectEmitter.emit(this.entities.length == 1);
} }
})); }));
} else if ((this.customFilter && this.customFilter.queryFieldName == "community") && this.properties.adminToolsCommunity === "monitor") { } else if (((this.customFilter && this.customFilter.queryFieldName == "community") && this.properties.adminToolsCommunity === "monitor") ||
this.disableSelect = true; (this.customFilter && (this.customFilter.queryFieldName == "relfunder" || this.customFilter.queryFieldName == "funder")) ||
} else if (this.customFilter && (this.customFilter.queryFieldName == "relfunder" || this.customFilter.queryFieldName == "funder")) { (this.customFilter && this.customFilter.queryFieldName == "relorganizationid")) {
this.disableSelect = true; this.entities.push({label: OpenaireEntities.RESULTS, value: 'result'});
} else if (this.customFilter && this.customFilter.queryFieldName == "relorganizationid") { this.entities.push({label: OpenaireEntities.PROJECTS, value: 'project'});
this.disableSelect = true; this.entities.push({label: OpenaireEntities.ORGANIZATIONS, value: 'organization'});
this.entities.push({label: OpenaireEntities.DATASOURCES, value: 'dataprovider'});
this.disableSelectEmitter.emit(true);
} else { } else {
if(this.onlyresults) { if(this.onlyresults) {
this.entities.push({label: 'All ' + OpenaireEntities.RESULTS.toLowerCase(), value: 'all'}); if(this.simpleView) {
this.entities.push({label: 'All ' + OpenaireEntities.RESULTS.toLowerCase(), value: 'all'});
}
this.entities.push({label: OpenaireEntities.PUBLICATIONS, value: 'publications'}); this.entities.push({label: OpenaireEntities.PUBLICATIONS, value: 'publications'});
this.entities.push({label: OpenaireEntities.DATASETS, value: 'datasets'}); this.entities.push({label: OpenaireEntities.DATASETS, value: 'datasets'});
this.entities.push({label: OpenaireEntities.SOFTWARE, value: 'software'}); this.entities.push({label: OpenaireEntities.SOFTWARE, value: 'software'});
this.entities.push({label: OpenaireEntities.OTHER, value: 'other'}); this.entities.push({label: OpenaireEntities.OTHER, value: 'other'});
} else { } else {
this.entities.push({label: 'All Content', value: 'all'}); if(this.simpleView) {
this.entities.push({label: 'All Content', value: 'all'});
}
this.entities.push({label: OpenaireEntities.RESULTS, value: 'result'}); this.entities.push({label: OpenaireEntities.RESULTS, value: 'result'});
this.entities.push({label: OpenaireEntities.PROJECTS, value: 'project'}); this.entities.push({label: OpenaireEntities.PROJECTS, value: 'project'});
this.entities.push({label: OpenaireEntities.ORGANIZATIONS, value: 'organization'}); this.entities.push({label: OpenaireEntities.ORGANIZATIONS, value: 'organization'});
this.entities.push({label: OpenaireEntities.DATASOURCES, value: 'dataprovider'}); this.entities.push({label: OpenaireEntities.DATASOURCES, value: 'dataprovider'});
this.disableSelectEmitter.emit(false);
} }
} }
this.selectedEntity = this.currentEntity; this.selectedEntity = this.currentEntity;
@ -128,6 +143,10 @@ export class EntitiesSelectionComponent {
} }
} }
getLabel(value: string) {
return this.entities.find(entity => entity.value === value)?.label;
}
entityChanged() { entityChanged() {
if (!this.simpleView || this.onChangeNavigate) { if (!this.simpleView || this.onChangeNavigate) {
this.router.navigate([this.getUrl(this.simpleView)], {queryParams: this.customFilter ? this.customFilter.getParameters() : {}}); this.router.navigate([this.getUrl(this.simpleView)], {queryParams: this.customFilter ? this.customFilter.getParameters() : {}});

View File

@ -4,8 +4,8 @@
refineFields.indexOf(customFilter.queryFieldName) == refineFields.indexOf(customFilter.queryFieldName) ==
-1) ||customFilter.isHiddenFilter)"> -1) ||customFilter.isHiddenFilter)">
<span class="uk-width-auto"> <span class="uk-width-auto">
<span class="uk-label uk-flex uk-flex-middle"> <span class="uk-label uk-label-secondary uk-flex uk-flex-middle">
<span class="uk-margin-small-right uk-width-expand">{{customFilter.valueName}}</span> <span class="uk-margin-small-right uk-width-expand">{{customFilter.valueName}}</span>
</span> </span>
</span> </span>
</ng-container> </ng-container>
@ -13,13 +13,12 @@
<ng-container *ngFor="let type of resultTypes.values; let i = index; let end = last; "> <ng-container *ngFor="let type of resultTypes.values; let i = index; let end = last; ">
<ng-container *ngIf="type.selected"> <ng-container *ngIf="type.selected">
<span class="uk-width-auto"> <span class="uk-width-auto">
<a [attr.uk-tooltip]="'Remove ' + type.name" (click)="removeResultType(type.id)" <span class="uk-label uk-label-primary uk-flex uk-flex-middle">
[class.uk-disabled]="disabled" class="uk-link-reset"> <span class="uk-margin-small-right uk-width-expand">{{type.name}}</span>
<span class="uk-label uk-flex uk-flex-middle"> <button [class.uk-disabled]="disabled" class="uk-close uk-icon" [disabled]="disabled">
<span class="uk-margin-small-right uk-width-expand">{{type.name}}</span> <icon name="close" flex="true" ratio="0.7"></icon>
<icon class="uk-text-muted" name="close" flex="true" ratio="0.7"></icon> </button>
</span> </span>
</a>
</span> </span>
</ng-container> </ng-container>
</ng-container> </ng-container>
@ -28,13 +27,12 @@
<ng-container *ngFor="let filter of rangeFilters "> <ng-container *ngFor="let filter of rangeFilters ">
<ng-container *ngIf="filter.selectedFromAndToValues"> <ng-container *ngIf="filter.selectedFromAndToValues">
<span class="uk-width-auto"> <span class="uk-width-auto">
<a [attr.uk-tooltip]="'Remove ' + filter.selectedFromAndToValues" (click)="removeRangeFilter(filter)" <span class="uk-label uk-label-primary uk-flex uk-flex-middle">
[class.uk-disabled]="disabled" class="uk-link-reset"> <span class="uk-margin-small-right uk-width-expand">{{filter.selectedFromAndToValues}}</span>
<span class="uk-label uk-flex uk-flex-middle"> <button [class.uk-disabled]="disabled" class="uk-close uk-icon" [disabled]="disabled">
<span class="uk-margin-small-right uk-width-expand">{{filter.selectedFromAndToValues}}</span> <icon name="close" flex="true" ratio="0.7"></icon>
<icon class="uk-text-muted" name="close" flex="true" ratio="0.7"></icon> </button>
</span> </span>
</a>
</span> </span>
</ng-container> </ng-container>
</ng-container> </ng-container>
@ -44,13 +42,12 @@
<ng-container *ngFor="let value of getSelectedValues(filter); let i = index; let end = last; "> <ng-container *ngFor="let value of getSelectedValues(filter); let i = index; let end = last; ">
<span *ngIf="!customFilter || (customFilter.isHiddenFilter && customFilter.valueId != value.id)" <span *ngIf="!customFilter || (customFilter.isHiddenFilter && customFilter.valueId != value.id)"
class="uk-width-auto"> class="uk-width-auto">
<a [attr.uk-tooltip]="'Remove ' + value.name" class="uk-link-reset" (click)="removeFilter(value, filter)" <span class="uk-label uk-label-primary uk-flex uk-flex-middle">
[class.uk-disabled]="disabled"> <span class="uk-margin-small-right uk-width-expand">{{value.name}}</span>
<span class="uk-label uk-flex uk-flex-middle"> <button [class.uk-disabled]="disabled" class="uk-close uk-icon" [disabled]="disabled">
<span class="uk-margin-small-right uk-width-expand">{{value.name}}</span> <icon name="close" flex="true" ratio="0.7"></icon>
<icon class="uk-text-muted" name="close" flex="true" ratio="0.7"></icon> </button>
</span> </span>
</a>
</span> </span>
</ng-container> </ng-container>
</ng-container> </ng-container>
@ -119,10 +116,10 @@
</div> </div>
</div> </div>
<div class="uk-position-relative"> <div class="uk-position-relative">
<div class="uk-container uk-container-large uk-section uk-section-small uk-margin-bottom" id="searchForm"> <div class="uk-container uk-container-small uk-section uk-section-small uk-margin-bottom" id="searchForm">
<div class="uk-grid uk-flex uk-flex-middle uk-flex-center" uk-grid> <div class="uk-grid uk-flex uk-flex-middle uk-flex-center" uk-grid>
<div id="searchImage"></div> <div id="searchImage"></div>
<advanced-search-form <advanced-search-form class="uk-width-expand"
[entityType]="entityType" [entityType]="entityType"
[fieldIds]="fieldIds" [fieldIds]="fieldIds"
[fieldIdsMap]="fieldIdsMap" [fieldIdsMap]="fieldIdsMap"

View File

@ -19,15 +19,7 @@ import {EnvProperties} from "../../utils/properties/env-properties";
import {properties} from "../../../../environments/environment"; import {properties} from "../../../../environments/environment";
import {ClickEvent} from "../../utils/click/click-outside-or-esc.directive"; import {ClickEvent} from "../../utils/click/click-outside-or-esc.directive";
export type InputType = export type InputType = 'text' | 'URL' | 'logoURL' | 'autocomplete' | 'autocomplete_soft' | 'textarea' | 'select' | 'chips';
'text'
| 'URL'
| 'logoURL'
| 'autocomplete'
| 'autocomplete_soft'
| 'textarea'
| 'select'
| 'chips';
export interface Option { export interface Option {
icon?: string, icon?: string,
@ -74,12 +66,12 @@ declare var UIkit;
</ng-template> </ng-template>
<ng-template [ngIf]="type === 'select'"> <ng-template [ngIf]="type === 'select'">
<ng-container *ngIf="placeholderInfo?.static"> <ng-container *ngIf="placeholderInfo?.static">
<div *ngIf="!formControl.value" class="placeholder uk-text-truncate">{{placeholderInfo.label}}</div> <div *ngIf="!getLabel(formControl.value)" class="placeholder uk-text-truncate">{{placeholderInfo.label}}</div>
<div *ngIf="getLabel(formControl.value)" class="input uk-text-truncate">{{getLabel(formControl.value)}}</div>
</ng-container> </ng-container>
<ng-container *ngIf="!placeholderInfo?.static"> <ng-container *ngIf="!placeholderInfo?.static">
<div *ngIf="!getLabel(formControl.value)" class="input uk-text-truncate">No value selected</div> <div *ngIf="!getLabel(formControl.value)" class="input uk-text-truncate">No value selected</div>
<div *ngIf="getLabel(formControl.value)" <div *ngIf="getLabel(formControl.value)" class="input uk-text-truncate">{{getLabel(formControl.value)}}</div>
class="input uk-text-truncate">{{getLabel(formControl.value)}}</div>
</ng-container> </ng-container>
</ng-template> </ng-template>
<ng-template [ngIf]="type === 'autocomplete'"> <ng-template [ngIf]="type === 'autocomplete'">