mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
Merged PR 901: #2080 Suchbegriff bei Filter zurücksetzen beibehalten
Related work items: #2080
This commit is contained in:
committed by
Lorenz Hilpert
parent
62439f9e7d
commit
d3a477425e
@@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { DomainCatalogService } from '@domain/catalog';
|
||||
import { Observable, Subject } from 'rxjs';
|
||||
import { debounceTime, filter, map, shareReplay, switchMap, tap, withLatestFrom } from 'rxjs/operators';
|
||||
import { debounceTime, map, switchMap, tap, withLatestFrom } from 'rxjs/operators';
|
||||
|
||||
import { UiFilter } from '@ui/filter';
|
||||
import { ComponentStore, tapResponse } from '@ngrx/component-store';
|
||||
@@ -77,12 +77,16 @@ export class ArticleSearchService extends ComponentStore<ArticleSearchState> {
|
||||
this.patchState({ hits });
|
||||
}
|
||||
|
||||
async setDefaultFilter() {
|
||||
async setDefaultFilter(defaultQueryParams?: Record<string, string>) {
|
||||
const filter = await this.catalog
|
||||
.getSettings()
|
||||
.pipe(map((settings) => UiFilter.create(settings)))
|
||||
.toPromise();
|
||||
|
||||
if (!!defaultQueryParams) {
|
||||
filter?.fromQueryParams(defaultQueryParams);
|
||||
}
|
||||
|
||||
this.setFilter(filter);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</div>
|
||||
|
||||
<div class="cta-wrapper">
|
||||
<button class="cta-reset-filter" (click)="resetFilter()">
|
||||
<button class="cta-reset-filter" (click)="resetFilter(filter)">
|
||||
Filter zurücksetzen
|
||||
</button>
|
||||
|
||||
|
||||
@@ -50,7 +50,8 @@ export class ArticleSearchFilterComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
resetFilter() {
|
||||
this.articleSearch.setDefaultFilter();
|
||||
resetFilter(value: UiFilter) {
|
||||
const queryParams = { main_qs: value?.getQueryParams()?.main_qs || '' };
|
||||
this.articleSearch.setDefaultFilter(queryParams);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,8 @@ export class GoodsInSearchFilterComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
async resetFilter() {
|
||||
this._goodsInSearchStore.resetFilter();
|
||||
const queryParams = { main_qs: this.filter?.getQueryParams()?.main_qs || '' };
|
||||
this._goodsInSearchStore.resetFilter(queryParams);
|
||||
this._initSettings();
|
||||
this._cdr.markForCheck();
|
||||
}
|
||||
|
||||
@@ -102,8 +102,14 @@ export class GoodsInSearchStore extends ComponentStore<GoodsInSearchState> {
|
||||
}
|
||||
}
|
||||
|
||||
resetFilter() {
|
||||
this.setFilter(UiFilter.create(this.defaultSettings));
|
||||
resetFilter(defaultQueryParams?: Record<string, string>) {
|
||||
const filter = UiFilter.create(this.defaultSettings);
|
||||
|
||||
if (!!defaultQueryParams) {
|
||||
filter?.fromQueryParams(defaultQueryParams);
|
||||
}
|
||||
|
||||
this.setFilter(filter);
|
||||
}
|
||||
|
||||
clearResults() {
|
||||
|
||||
@@ -51,7 +51,8 @@ export class GoodsOutSearchFilterComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
async resetFilter() {
|
||||
this._goodsOutSearchStore.resetFilter();
|
||||
const queryParams = { main_qs: this.filter?.getQueryParams()?.main_qs || '' };
|
||||
this._goodsOutSearchStore.resetFilter(queryParams);
|
||||
this._initSettings();
|
||||
this._cdr.markForCheck();
|
||||
}
|
||||
|
||||
@@ -106,8 +106,14 @@ export class GoodsOutSearchStore extends ComponentStore<GoodsOutSearchState> {
|
||||
}
|
||||
}
|
||||
|
||||
resetFilter() {
|
||||
this.setFilter(UiFilter.create(this.defaultSettings));
|
||||
resetFilter(defaultQueryParams?: Record<string, string>) {
|
||||
const filter = UiFilter.create(this.defaultSettings);
|
||||
|
||||
if (!!defaultQueryParams) {
|
||||
filter?.fromQueryParams(defaultQueryParams);
|
||||
}
|
||||
|
||||
this.setFilter(filter);
|
||||
}
|
||||
|
||||
clearResults() {
|
||||
|
||||
Reference in New Issue
Block a user