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">
<a *ngIf="showSwitchSearchLink && simpleSearchLink && simpleSearchLink.length > 0"
routerLinkActive="router-link-active"
[routerLink]=simpleSearchLink style="z-index:1;"
[queryParams]="customFilter?customFilter.getParameters():{}"
[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
</a>
<h6 class="uk-margin-small-bottom">
Advanced search in
<entities-selection [simpleView]="false" [currentEntity]="entityType"
[properties]="properties" [customFilter]="customFilter" ></entities-selection>
</h6>
</div>
<form *ngIf="!simpleView"
[class]="((isDisabled )?'uk-disabled ':'')
<ng-container *ngIf="!simpleView">
<div class="uk-margin-small-bottom uk-grid uk-grid-small uk-flex-middle" uk-grid>
<div class="uk-width-2-5@m uk-width-1-1 uk-flex uk-flex-middle uk-flex-center uk-flex-left@m">
<span class="uk-margin-small-right uk-text-small" [class.uk-light]="dark">Advanced search in</span>
<span *ngIf="disableSelect" class="uk-text-small uk-text-bold" [class.uk-light]="dark">{{entities.getLabel(entityType)}}</span>
<entities-selection #entities [class.uk-hidden]="disableSelect" class="uk-width-expand" [simpleView]="false"
[currentEntity]="entityType" [customFilter]="customFilter" (disableSelectEmitter)="disableSelectChange($event)"></entities-selection>
</div>
<div class="uk-width-expand uk-text-small uk-flex uk-flex-center uk-flex-right@m" [class.uk-light]="dark">
<a *ngIf="showSwitchSearchLink && simpleSearchLink && simpleSearchLink.length > 0"
[routerLink]=simpleSearchLink
[queryParams]="customFilter?customFilter.getParameters():{}"
[ngClass]="(isDisabled)?'uk-disabled uk-link-muted':null">Simple Search</a>
</div>
</div>
<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'">
<div>
<div>
<!-- <quick-selections [resultTypes]="resultTypes" (typeChange)="queryChanged()" [isDisabled]="isDisabled"
[quickFilter]="quickFilter" [QFselected]="(quickFilter)?quickFilter.selected:null"
[properties]="properties" class="uk-grid "
></quick-selections>
<hr *ngIf="resultTypes || quickFilter" class="uk-margin-small">-->
<table class=" uk-table uk-table-responsive uk-table-small uk-margin-remove">
<tr>
<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>
</tr>
<tr *ngFor="let selectedField of selectedFields; let i = index">
<td><mat-select [(ngModel)]="selectedField.id" name="selectField_{{i}}" [disableOptionCentering]="true" class="matSelection" panelClass="matSelectionPanel"
(ngModelChange)="fieldIdsChanged(i,selectedField.id)"><!--(click)="fieldIdsChanged(i)" -->
<mat-option *ngFor="let id of fieldIds" [value]="id">{{fieldIdsMap[id].name}} </mat-option>
</mat-select></td>
<td *ngIf="selectedField.type == 'keyword' || selectedField.type == 'identifier'">
<div class="uk-inline uk-width-expand">
<a *ngIf="selectedField.value.length > 0" class="uk-form-icon uk-form-icon-flip"
(click)="selectedField.value = ''"
uk-icon="icon: close"></a>
<input type="text" class="form-control uk-input"
placeholder="Type keywords..."
[(ngModel)]="selectedField.value" name="value[{{i}}]">
</div>
<!-- <quick-selections [resultTypes]="resultTypes" (typeChange)="queryChanged()" [isDisabled]="isDisabled"
[quickFilter]="quickFilter" [QFselected]="(quickFilter)?quickFilter.selected:null"
[properties]="properties" class="uk-grid "
></quick-selections>
<hr *ngIf="resultTypes || quickFilter" class="uk-margin-small">-->
<table class=" uk-table uk-table-responsive uk-table-small uk-margin-remove">
<tr>
<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>
</tr>
<tr *ngFor="let selectedField of selectedFields; let i = index">
<td><mat-select [(ngModel)]="selectedField.id" name="selectField_{{i}}" [disableOptionCentering]="true" class="matSelection" panelClass="matSelectionPanel"
(ngModelChange)="fieldIdsChanged(i,selectedField.id)"><!--(click)="fieldIdsChanged(i)" -->
<mat-option *ngFor="let id of fieldIds" [value]="id">{{fieldIdsMap[id].name}} </mat-option>
</mat-select></td>
<td *ngIf="selectedField.type == 'keyword' || selectedField.type == 'identifier'">
<div class="uk-inline uk-width-expand">
<a *ngIf="selectedField.value.length > 0" class="uk-form-icon uk-form-icon-flip"
(click)="selectedField.value = ''"
uk-icon="icon: close"></a>
<input type="text" class="form-control uk-input"
placeholder="Type keywords..."
[(ngModel)]="selectedField.value" name="value[{{i}}]">
</div>
</td>
<td *ngIf="selectedField.type == 'date'">
<date-filter [dateValue]=selectedField.dateValue [validDateFrom]=validDateFrom class="uk-width-expand"
[validDateTo]=validDateTo></date-filter>
</td>
<td *ngIf=" selectedField.id && selectedField.type == 'vocabulary'">
<static-autocomplete [properties]=properties *ngIf=" selectedField.id" [vocabularyId]=selectedField.param
[fieldId]=selectedField.id
[list]=this.fieldList[selectedField.id] [entityName]="entityType"
[selectedValue]=selectedField.value [showSelected]=true
[placeHolderMessage]="'Search for '+selectedField.name" [title]="selectedField.name"
[multipleSelections]=false
(selectedValueChanged)="valueChanged($event,i)"
(listUpdated)="listUpdated($event,selectedField.id)"></static-autocomplete>
</td>
<td *ngIf=" selectedField.id && selectedField.type == 'refine'" class="uk-width-1-3">
<static-autocomplete [properties]=properties [list]=this.fieldList[selectedField.id]
[fieldId]=selectedField.id [entityName]="entityType" [fieldName]=[selectedField.id]
[selectedValue]=selectedField.value [showSelected]=true
[placeHolderMessage]="'Search for '+selectedField.name" [title]="selectedField.name"
[multipleSelections]=false (selectedValueChanged)="valueChanged($event,i)"
(listUpdated)="listUpdated($event,selectedField.id)"
(updateValueLabel)="updatedValueLabel($event, i)"></static-autocomplete>
</td>
<td *ngIf="selectedField.type == 'entity'">
<entities-autocomplete [properties]=properties [fieldId]=selectedField.id [entityType]=selectedField.param
[selectedValue]=selectedField.value [showSelected]=true
[placeHolderMessage]="'Search for '+selectedField.name" [title]="selectedField.name"
[multipleSelections]=false
(selectedValueChanged)="valueChanged($event,i)"
(updateValueLabel)="updatedValueLabel($event, i)">
</entities-autocomplete>
</td>
</td>
<td *ngIf="selectedField.type == 'date'">
<date-filter [dateValue]=selectedField.dateValue [validDateFrom]=validDateFrom class="uk-width-expand"
[validDateTo]=validDateTo></date-filter>
</td>
<td *ngIf=" selectedField.id && selectedField.type == 'vocabulary'">
<static-autocomplete [properties]=properties *ngIf=" selectedField.id" [vocabularyId]=selectedField.param
[fieldId]=selectedField.id
[list]=this.fieldList[selectedField.id] [entityName]="entityType"
[selectedValue]=selectedField.value [showSelected]=true
[placeHolderMessage]="'Search for '+selectedField.name" [title]="selectedField.name"
[multipleSelections]=false
(selectedValueChanged)="valueChanged($event,i)"
(listUpdated)="listUpdated($event,selectedField.id)"></static-autocomplete>
</td>
<td *ngIf=" selectedField.id && selectedField.type == 'refine'" class="uk-width-1-3">
<static-autocomplete [properties]=properties [list]=this.fieldList[selectedField.id]
[fieldId]=selectedField.id [entityName]="entityType" [fieldName]=[selectedField.id]
[selectedValue]=selectedField.value [showSelected]=true
[placeHolderMessage]="'Search for '+selectedField.name" [title]="selectedField.name"
[multipleSelections]=false (selectedValueChanged)="valueChanged($event,i)"
(listUpdated)="listUpdated($event,selectedField.id)"
(updateValueLabel)="updatedValueLabel($event, i)"></static-autocomplete>
</td>
<td *ngIf="selectedField.type == 'entity'">
<entities-autocomplete [properties]=properties [fieldId]=selectedField.id [entityType]=selectedField.param
[selectedValue]=selectedField.value [showSelected]=true
[placeHolderMessage]="'Search for '+selectedField.name" [title]="selectedField.name"
[multipleSelections]=false
(selectedValueChanged)="valueChanged($event,i)"
(updateValueLabel)="updatedValueLabel($event, i)">
</entities-autocomplete>
</td>
<td *ngIf="selectedField.type == 'boolean'" class="input-group">
<td *ngIf="selectedField.type == 'boolean'" class="input-group">
<span class="input-group-addon">
<input type="radio" [(ngModel)]="selectedField.value" [name]=selectedField.param
value="true">Yes<br>
</span>
<span class="input-group-addon">
<span class="input-group-addon">
<input type="radio" [(ngModel)]="selectedField.value" [name]=selectedField.param
value="false">No<br>
</span>
</td>
<td style="min-width: 75px;"><mat-select *ngIf="i+1 <selectedFields.length"
[(ngModel)]="selectedFields[i+1].operatorId"
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)"
(click)="fieldOperatorChanged(i+1, op.id, op.id)" [value]="op.id">{{op.id}}</mat-option>
</mat-select>
<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>
</div>
</td>
<td class=" ">
</td>
<td style="min-width: 75px;"><mat-select *ngIf="i+1 <selectedFields.length"
[(ngModel)]="selectedFields[i+1].operatorId"
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)"
(click)="fieldOperatorChanged(i+1, op.id, op.id)" [value]="op.id">{{op.id}}</mat-option>
</mat-select>
<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>
</div>
</td>
<td class=" ">
<span type="button" class="uk-icon-button portal-button-reverse clickable "
(click)="removeField(i)">
<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>
</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"
class="uk-icon-button portal-button clickable "
(click)="addField()">
class="uk-icon-button portal-button clickable "
(click)="addField()">
<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>
</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>
</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 *ngIf="!validDateTo && validDateFrom" class="uk-text-danger">
Please check your <u>to</u> date
</div>
<div *ngIf="!validDateFrom && !validDateTo" class="uk-text-danger">
Please check your dates
<div *ngIf="!validDateTo && validDateFrom" class="uk-text-danger">
Please check your <u>to</u> date
</div>
<div *ngIf="!validDateFrom && !validDateTo" class="uk-text-danger">
Please check your dates
</div>
</div>
<button (click)="queryChanged()" type="submit"
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
</button>
</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>
<button (click)="queryChanged()" type="submit"
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
</button>
</div>
</form>
<div *ngIf="simpleView">
<div class="uk-margin-small-bottom 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 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"
<div class="uk-flex uk-flex-center uk-child-width-1-1">
<ng-container *ngIf="entitiesSelection">
<advanced-search-input [class.uk-hidden]="disableSelect" [dark]="dark" [disabled]="isDisabled" (searchEmitter)="simpleKeywordChanged()">
<entities-selection [simpleView]="true" [currentEntity]="entityType"
(selectionChange)="simpleEntityChanged($event)" (disableSelectEmitter)="disableSelectChange($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] && disableSelect" search-input [disabled]="isDisabled" [(value)]="selectedFields[0].value"
[placeholder]="formPlaceholderText" (searchEmitter)="simpleKeywordChanged()"></div>
</ng-container>
<div *ngIf="selectedFields[0] && !entitiesSelection" search-input [disabled]="isDisabled" [(value)]="selectedFields[0].value"
[placeholder]="formPlaceholderText" (searchEmitter)="simpleKeywordChanged()"></div>
</ng-container>
<div *ngIf="selectedFields[0] && !entitiesSelection" search-input [disabled]="isDisabled" [(value)]="selectedFields[0].value"
[placeholder]="formPlaceholderText" (searchEmitter)="simpleKeywordChanged()"></div>
</div>
</div>
</div>

View File

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

View File

@ -11,10 +11,14 @@ import {OpenaireEntities} from "../../utils/properties/searchFields";
@Component({
selector: 'entities-selection',
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"
[options]="entities" [(value)]="selectedEntity" (valueChange)="entityChanged()" type="select"></div>
</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 {
@ -24,9 +28,9 @@ export class EntitiesSelectionComponent {
@Input() currentEntity = "result";
@Input() simpleView: boolean = true;
@Input() onChangeNavigate: boolean = true;
@Input() disableSelect: boolean = false;
@Output() selectionChange = new EventEmitter();
@ViewChild('input') input: InputComponent;
@Output() disableSelectEmitter: EventEmitter<boolean> = new EventEmitter<boolean>();
public entities: Option[] = [];
public properties: EnvProperties = properties;
private subscriptions: Subscription[] = [];
@ -53,7 +57,9 @@ export class EntitiesSelectionComponent {
}
}
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"]) {
this.entities.push({label: OpenaireEntities.PUBLICATIONS, value: 'publications'});
}
@ -67,12 +73,13 @@ export class EntitiesSelectionComponent {
this.entities.push({label: OpenaireEntities.OTHER, value: 'other'});
}
} 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]
&& (showEntity["publication"] || showEntity["dataset"] || showEntity["software"] || showEntity["orp"])) {
this.entities.push({label: OpenaireEntities.RESULTS, value: 'result'});
}
if(showPage[this.simpleView ? this.properties.searchLinkToProjects : this.properties.searchLinkToAdvancedProjects] && showEntity["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.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") {
this.disableSelect = true;
} else if (this.customFilter && (this.customFilter.queryFieldName == "relfunder" || this.customFilter.queryFieldName == "funder")) {
this.disableSelect = true;
} else if (this.customFilter && this.customFilter.queryFieldName == "relorganizationid") {
this.disableSelect = true;
} else if (((this.customFilter && this.customFilter.queryFieldName == "community") && this.properties.adminToolsCommunity === "monitor") ||
(this.customFilter && (this.customFilter.queryFieldName == "relfunder" || this.customFilter.queryFieldName == "funder")) ||
(this.customFilter && this.customFilter.queryFieldName == "relorganizationid")) {
this.entities.push({label: OpenaireEntities.RESULTS, value: 'result'});
this.entities.push({label: OpenaireEntities.PROJECTS, value: 'project'});
this.entities.push({label: OpenaireEntities.ORGANIZATIONS, value: 'organization'});
this.entities.push({label: OpenaireEntities.DATASOURCES, value: 'dataprovider'});
this.disableSelectEmitter.emit(true);
} else {
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.DATASETS, value: 'datasets'});
this.entities.push({label: OpenaireEntities.SOFTWARE, value: 'software'});
this.entities.push({label: OpenaireEntities.OTHER, value: 'other'});
} 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.PROJECTS, value: 'project'});
this.entities.push({label: OpenaireEntities.ORGANIZATIONS, value: 'organization'});
this.entities.push({label: OpenaireEntities.DATASOURCES, value: 'dataprovider'});
this.disableSelectEmitter.emit(false);
}
}
this.selectedEntity = this.currentEntity;
@ -128,6 +143,10 @@ export class EntitiesSelectionComponent {
}
}
getLabel(value: string) {
return this.entities.find(entity => entity.value === value)?.label;
}
entityChanged() {
if (!this.simpleView || this.onChangeNavigate) {
this.router.navigate([this.getUrl(this.simpleView)], {queryParams: this.customFilter ? this.customFilter.getParameters() : {}});

View File

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

View File

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