diff --git a/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.ts b/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.ts index 81b757047f..24994a2ae0 100644 --- a/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.ts +++ b/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.ts @@ -298,7 +298,7 @@ export class AttributeTableComponent extends PageComponent implements AfterViewI this.selectedWidgetsBundleAlias = null; this.attributeScope = this.defaultAttributeScope; this.pageLink.textSearch = null; - this.textSearch.reset(); + this.textSearch.reset('', {emitEvent: false}); if (this.viewsInited) { this.paginator.pageIndex = 0; const sortable = this.sort.sortables.get('key'); diff --git a/ui-ngx/src/app/modules/home/components/entity/entities-table.component.ts b/ui-ngx/src/app/modules/home/components/entity/entities-table.component.ts index ffc8abf4df..37aa676f68 100644 --- a/ui-ngx/src/app/modules/home/components/entity/entities-table.component.ts +++ b/ui-ngx/src/app/modules/home/components/entity/entities-table.component.ts @@ -275,7 +275,7 @@ export class EntitiesTableComponent extends PageComponent implements IEntitiesTa const decodedTextSearch = decodeURI(textSearchParam); this.textSearchMode = true; this.pageLink.textSearch = decodedTextSearch.trim(); - this.textSearch.setValue(decodedTextSearch); + this.textSearch.setValue(decodedTextSearch, {emitEvent: false}); } } this.dataSource = this.entitiesTableConfig.dataSource(this.dataLoaded.bind(this)); @@ -309,25 +309,24 @@ export class EntitiesTableComponent extends PageComponent implements IEntitiesTa } ngAfterViewInit() { - this.textSearch.valueChanges.pipe( debounceTime(150), distinctUntilChanged((prev, current) => (this.pageLink.textSearch ?? '') === current.trim()), takeUntil(this.destroy$) ).subscribe(value => { - const queryParams: PageQueryParam = {}; - if (isNotEmptyStr(value)) { - queryParams.textSearch = encodeURI(value); - this.pageLink.textSearch = value.trim(); + if (this.pageMode) { + const queryParams: PageQueryParam = { + textSearch: isNotEmptyStr(value) ? encodeURI(value) : null, + page: null + }; + this.updatedRouterParamsAndData(queryParams); } else { - queryParams.textSearch = null; - this.pageLink.textSearch = null; - } - if (this.displayPagination) { - this.paginator.pageIndex = 0; - queryParams.page = null; + this.pageLink.textSearch = isNotEmptyStr(value) ? value.trim() : null; + if (this.displayPagination) { + this.paginator.pageIndex = 0; + } + this.updateData(); } - this.updatedRouterParamsAndData(queryParams); }); if (this.pageMode) { @@ -346,9 +345,11 @@ export class EntitiesTableComponent extends PageComponent implements IEntitiesTa const decodedTextSearch = decodeURI(textSearchParam); this.textSearchMode = true; this.pageLink.textSearch = decodedTextSearch.trim(); - this.textSearch.setValue(decodedTextSearch); + this.textSearch.setValue(decodedTextSearch, {emitEvent: false}); } else { + this.textSearchMode = false; this.pageLink.textSearch = null; + this.textSearch.reset('', {emitEvent: false}); } this.updateData(); }); @@ -596,7 +597,7 @@ export class EntitiesTableComponent extends PageComponent implements IEntitiesTa resetSortAndFilter(update: boolean = true, preserveTimewindow: boolean = false) { this.textSearchMode = false; this.pageLink.textSearch = null; - this.textSearch.reset(); + this.textSearch.reset('', {emitEvent: false}); if (this.entitiesTableConfig.useTimePageLink && !preserveTimewindow) { this.timewindow = this.entitiesTableConfig.defaultTimewindowInterval; } diff --git a/ui-ngx/src/app/modules/home/components/relation/relation-table.component.ts b/ui-ngx/src/app/modules/home/components/relation/relation-table.component.ts index 3fa16acd3d..a0f7930a81 100644 --- a/ui-ngx/src/app/modules/home/components/relation/relation-table.component.ts +++ b/ui-ngx/src/app/modules/home/components/relation/relation-table.component.ts @@ -214,7 +214,7 @@ export class RelationTableComponent extends PageComponent implements AfterViewIn this.direction = EntitySearchDirection.FROM; this.updateColumns(); this.pageLink.textSearch = null; - this.textSearch.reset(); + this.textSearch.reset('', {emitEvent: false}); this.paginator.pageIndex = 0; const sortable = this.sort.sortables.get('type'); this.sort.active = sortable.id; diff --git a/ui-ngx/src/app/modules/home/components/vc/entity-versions-table.component.ts b/ui-ngx/src/app/modules/home/components/vc/entity-versions-table.component.ts index 660062980f..ecab191d3e 100644 --- a/ui-ngx/src/app/modules/home/components/vc/entity-versions-table.component.ts +++ b/ui-ngx/src/app/modules/home/components/vc/entity-versions-table.component.ts @@ -378,7 +378,7 @@ export class EntityVersionsTableComponent extends PageComponent implements OnIni private resetSortAndFilter(update: boolean) { this.textSearchMode = false; this.pageLink.textSearch = null; - this.textSearch.reset(); + this.textSearch.reset('', {emitEvent: false}); if (this.viewsInited) { this.paginator.pageIndex = 0; const sortable = this.sort.sortables.get('timestamp');