1. Change selected fitlers in monitor base on filters in search. 2. Add label secondary with color of monitor

This commit is contained in:
Konstantinos Triantafyllou 2022-04-18 14:44:44 +03:00
parent 156e069c08
commit 8c76b808d9
6 changed files with 36 additions and 38 deletions

View File

@ -1,35 +1,22 @@
<ng-template #selected_filters_pills let-margin="margin"> <ng-template #selected_filters_pills>
<span *ngIf="periodFilter.selectedFromAndToValues.length > 0" class="uk-grid-margin"> <span *ngIf="periodFilter.selectedFromAndToValues.length > 0" class="uk-width-auto">
<a (click)="clearPeriodFilter()" [class]="((loading)?' uk-disabled':' ')+' uk-link-text '"> <span <span class="uk-label uk-label-primary uk-flex uk-flex-middle">
class="filter-tag" [class.uk-margin-small-left]="margin" <span class="uk-margin-small-right uk-width-expand uk-text-truncate">{{periodFilter.selectedFromAndToValues}}</span>
title="Remove {{periodFilter.selectedFromAndToValues}}"> <button [class.uk-disabled]="loading" (click)="clearPeriodFilter()" class="uk-close uk-icon" [disabled]="loading">
<i uk-icon="close"></i> <icon name="close" flex="true" ratio="0.7"></icon>
<span class="uk-margin-small-left">{{periodFilter.selectedFromAndToValues}}</span> </button>
</span></a>
</span> </span>
</span>
<ng-container *ngFor="let filter of filters "> <ng-container *ngFor="let filter of filters ">
<ng-container *ngIf="filter.countSelectedValues > 0"> <ng-container *ngIf="filter.countSelectedValues > 0">
<ng-container *ngFor="let value of filter.values; let i = index; let end = last; "> <ng-container *ngFor="let value of filter.values; let i = index;">
<ng-container *ngIf="value.selected"> <ng-container *ngIf="value.selected">
<span class="uk-grid-margin"> <span class="uk-width-auto">
<span class="filter-tag" [class.uk-margin-small-left]="margin" [title]="'Remove '+value.name" <span class="uk-label uk-label-primary uk-flex uk-flex-middle">
(click)="value.selected = false; filter.radioValue=''; filter.countSelectedValues= <span class="uk-margin-small-right uk-width-expand uk-text-truncate">{{value.name}}</span>
filter.countSelectedValues -1; <button [class.uk-disabled]="loading" (click)="clearFilterValue(filter, value)" class="uk-close uk-icon" [disabled]="loading">
filterChanged({value:filter}) "> <icon name="close" flex="true" ratio="0.7"></icon>
<a [class.uk-disabled]="loading"> </button>
<span class=" clickable" aria-hidden="true">
<span class="uk-icon">
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
icon="close" ratio="0.8"><path fill="none" stroke="#000" stroke-width="1.6"
d="M16,16 L4,4"></path><path fill="none"
stroke="#000"
stroke-width="1.6"
d="M16,4 L4,16"></path></svg>
</span>
</span>
<span class="uk-margin-small-left"
[innerHtml]="(value.name.length > 34)?value.name.substring(0,34)+'...':value.name"></span>
</a>
</span> </span>
</span> </span>
</ng-container> </ng-container>
@ -252,7 +239,7 @@
<a *ngIf="countSelectedFilters() > 1" <a *ngIf="countSelectedFilters() > 1"
class="uk-text-small uk-width-1-2" (click)="clearAll()"> Clear All </a> class="uk-text-small uk-width-1-2" (click)="clearAll()"> Clear All </a>
</div> </div>
<div class="uk-grid uk-grid-small uk-text-small" uk-grid> <div class="uk-grid uk-grid-small" uk-grid>
<ng-container *ngTemplateOutlet="selected_filters_pills; context: {margin:false}"></ng-container> <ng-container *ngTemplateOutlet="selected_filters_pills; context: {margin:false}"></ng-container>
</div> </div>
<div *ngIf="!user" class="uk-margin-top"><a class="uk-link" (click)="logIn()"> Sign in</a> to apply filters.</div> <div *ngIf="!user" class="uk-margin-top"><a class="uk-link" (click)="logIn()"> Sign in</a> to apply filters.</div>

View File

@ -26,7 +26,7 @@ import {Subscriber, Subscription} from "rxjs";
import {User} from "../openaireLibrary/login/utils/helper.class"; import {User} from "../openaireLibrary/login/utils/helper.class";
import {UserManagementService} from "../openaireLibrary/services/user-management.service"; import {UserManagementService} from "../openaireLibrary/services/user-management.service";
import {RangeFilter} from "../openaireLibrary/utils/rangeFilter/rangeFilterHelperClasses.class"; import {RangeFilter} from "../openaireLibrary/utils/rangeFilter/rangeFilterHelperClasses.class";
import {Filter} from "../openaireLibrary/searchPages/searchUtils/searchHelperClasses.class"; import {Filter, Value} from "../openaireLibrary/searchPages/searchUtils/searchHelperClasses.class";
import {RouterHelper} from "../openaireLibrary/utils/routerHelper.class"; import {RouterHelper} from "../openaireLibrary/utils/routerHelper.class";
import {properties} from "../../environments/environment"; import {properties} from "../../environments/environment";
import {IndexInfoService} from "../openaireLibrary/utils/indexInfo.service"; import {IndexInfoService} from "../openaireLibrary/utils/indexInfo.service";
@ -247,7 +247,7 @@ export class MonitorComponent implements OnInit, OnDestroy {
} }
} }
} else { } else {
this.clearfFilter(filter); this.clearFilter(filter);
} }
} }
@ -282,14 +282,14 @@ export class MonitorComponent implements OnInit, OnDestroy {
clearAll() { clearAll() {
for (let filter of this.filters) { for (let filter of this.filters) {
this.clearfFilter(filter); this.clearFilter(filter);
} }
this.periodFilter.selectedFromValue = ""; this.periodFilter.selectedFromValue = "";
this.periodFilter.selectedToValue = ""; this.periodFilter.selectedToValue = "";
this.validateYearRange(true) this.validateYearRange(true)
} }
clearfFilter(filter: Filter) { clearFilter(filter: Filter) {
filter.countSelectedValues = 0; filter.countSelectedValues = 0;
filter.radioValue = ""; filter.radioValue = "";
for (let value of filter.values) { for (let value of filter.values) {
@ -440,7 +440,15 @@ export class MonitorComponent implements OnInit, OnDestroy {
this.periodFilter.selectedToValue = ""; this.periodFilter.selectedToValue = "";
this.filter(); this.filter();
} }
}
clearFilterValue(filter: Filter, value: Value) {
value.selected = false;
filter.radioValue = '';
filter.countSelectedValues = filter.countSelectedValues - 1;
this.filterChanged({
value:filter
});
} }
private setIndicators() { private setIndicators() {

@ -1 +1 @@
Subproject commit 7e9db1d0dec3f8abdb716f082bcbe441304b95d6 Subproject commit 19bf9f79685fa8628cd741fbfbb07991ccabf20d

View File

@ -15,14 +15,14 @@ import {SearchForm} from "../../../openaireLibrary/searchPages/searchUtils/newSe
[includeOnlyResultsAndFilter]="false" [includeOnlyResultsAndFilter]="false"
[showSwitchSearchLink]="true" [showSwitchSearchLink]="true"
[openaireLink]="'https://'+(properties.environment != 'production'?'beta.':'')+'explore.openaire.eu/search/advanced/research-outcomes'" [openaireLink]="'https://'+(properties.environment != 'production'?'beta.':'')+'explore.openaire.eu/search/advanced/research-outcomes'"
[piwikSiteId]="piwikSiteId" [piwikSiteId]="piwikSiteId" [searchForm]="searchForm"
></search-research-results> ></search-research-results>
` `
}) })
export class MonitorAdvancedSearchResearchResultsComponent { export class MonitorAdvancedSearchResearchResultsComponent {
customFilter: SearchCustomFilter = null; customFilter: SearchCustomFilter = null;
initialized: boolean = false; initialized: boolean = false;
@Input() searchForm: SearchForm = {class: 'search-form', dark: true}; @Input() searchForm: SearchForm = {class: 'search-form', dark: false};
properties; properties;
piwikSiteId; piwikSiteId;
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,

View File

@ -36,6 +36,9 @@
--text-primary-color: var(--monitor-color); --text-primary-color: var(--monitor-color);
--text-gradient-color: linear-gradient(110deg, var(--monitor-light-color) 0%, var(--monitor-dark-color) 100%); --text-gradient-color: linear-gradient(110deg, var(--monitor-light-color) 0%, var(--monitor-dark-color) 100%);
/** Label */
--label-secondary: var(--monitor-color);
/* List */ /* List */
--list-disc-color: var(--monitor-color); --list-disc-color: var(--monitor-color);

@ -1 +1 @@
Subproject commit a47c66f4802cb7af2ad12f1ad75516e94b20c328 Subproject commit c98b39a5a5d45e3f9676be11d38b78d881f9f8d5