1. Entities Selections: Fix conditions. 2. Filters selected add uk-text-truncate

This commit is contained in:
Konstantinos Triantafyllou 2022-04-18 14:43:33 +03:00
parent 5f042433be
commit 19bf9f7968
3 changed files with 27 additions and 27 deletions

View File

@ -1,9 +1,10 @@
<ng-container *ngIf="!simpleView">
<div class="uk-margin-small-bottom uk-grid uk-grid-small uk-flex-middle" uk-grid>
<div class="uk-margin-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"
<span class="uk-text-small" [class.uk-light]="dark">Advanced search in
<span *ngIf="disableSelect" class="uk-text-small uk-text-bold" [class.uk-light]="dark">{{entities.getLabel(entityType)}}</span>
</span>
<entities-selection #entities [class.uk-hidden]="disableSelect" class="uk-width-expand uk-margin-small-left" [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">
@ -13,7 +14,7 @@
[ngClass]="(isDisabled)?'uk-disabled uk-link-muted':null">Simple Search</a>
</div>
</div>
<div class="uk-card uk-card-default" [class.dark]="dark">
<div class="uk-card uk-card-default uk-box-shadow-medium" [class.dark]="dark">
<form *ngIf="!simpleView"
[class]="((isDisabled )?'uk-disabled ':'')
+' advancedSearchForm uk-tile uk-padding-small uk-margin-medium-bottom'">

View File

@ -38,9 +38,9 @@ export class EntitiesSelectionComponent {
constructor(private config: ConfigurationService, private router: Router) {
}
/** TODO change conditions base on PortalType instead of customFilter */
ngOnInit() {
if ((this.customFilter && this.customFilter.queryFieldName == "communityId") || (this.properties.adminToolsCommunity !== "monitor")) {
//this.config.getCommunityInformation(this.properties, (this.customFilter && this.customFilter.queryFieldName == "communityId") ? this.customFilter.valueId : this.properties.adminToolsCommunity).subscribe(data => {
if ((this.customFilter && this.customFilter.queryFieldName == "communityId") || (['explore', 'aggregator'].includes(this.properties.adminToolsPortalType))) {
this.subscriptions.push(this.config.communityInformationState.subscribe(data => {
if (data) {
let showEntity = {};
@ -97,11 +97,10 @@ export class EntitiesSelectionComponent {
this.entities = this.entities.filter(option => option.value !== 'project' && option.value !== 'dataprovider');
}
}
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.customFilter && (this.customFilter.queryFieldName == "relfunder" || this.customFilter.queryFieldName == "funder")) ||
(this.customFilter && this.customFilter.queryFieldName == "relorganizationid")) {
this.entities.push({label: OpenaireEntities.RESULTS, value: 'result'});

View File

@ -4,21 +4,21 @@
refineFields.indexOf(customFilter.queryFieldName) ==
-1) ||customFilter.isHiddenFilter)">
<span class="uk-width-auto">
<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-label uk-label-secondary uk-text-truncate">
{{customFilter.valueName}}
</span>
</span>
</ng-container>
<ng-container *ngIf="resultTypes && resultTypes.countSelectedValues > 0">
<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;">
<ng-container *ngIf="type.selected">
<span class="uk-width-auto">
<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">
<span class="uk-margin-small-right uk-width-expand uk-text-truncate">{{type.name}}</span>
<button [class.uk-disabled]="disabled" (click)="removeResultType(type.id)" class="uk-close uk-icon" [disabled]="disabled">
<icon name="close" flex="true" ratio="0.7"></icon>
</button>
</span>
</span>
</span>
</ng-container>
</ng-container>
@ -28,11 +28,11 @@
<ng-container *ngIf="filter.selectedFromAndToValues">
<span class="uk-width-auto">
<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">
<span class="uk-margin-small-right uk-width-expand uk-text-truncate">{{filter.selectedFromAndToValues}}</span>
<button [class.uk-disabled]="disabled" (click)="removeRangeFilter(filter)" class="uk-close uk-icon" [disabled]="disabled">
<icon name="close" flex="true" ratio="0.7"></icon>
</button>
</span>
</span>
</span>
</ng-container>
</ng-container>
@ -40,15 +40,15 @@
<ng-container *ngFor="let filter of filters ">
<ng-container *ngIf="filter.countSelectedValues > 0">
<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">
<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>
<span *ngIf="!customFilter || (customFilter.isHiddenFilter && customFilter.valueId != value.id)"
class="uk-width-auto">
<span class="uk-label uk-label-primary uk-flex uk-flex-middle">
<span class="uk-margin-small-right uk-width-expand uk-text-truncate">{{value.name}}</span>
<button [class.uk-disabled]="disabled" (click)="removeFilter(value, filter)" class="uk-close uk-icon" [disabled]="disabled">
<icon name="close" flex="true" ratio="0.7"></icon>
</button>
</span>
</span>
</ng-container>
</ng-container>
</ng-container>