From 5b6fe6fa9392d2480e35063bb9e785f0ff1b4b1f Mon Sep 17 00:00:00 2001 From: Volker Theile Date: Mon, 5 Jun 2023 11:20:30 +0200 Subject: [PATCH] UI: Search button only performs a search on a page level Fixes: https://github.com/aquarist-labs/s3gw/issues/556 Signed-off-by: Volker Theile --- CHANGELOG.md | 1 + .../shared/components/datatable/datatable.component.ts | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fbf20a3..f60c54ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Do not display objects that have also a delete marker (gh#aquarist-labs/s3gw#548). +- Search button only performs a search on a page level (gh#aquarist-labs/s3gw#556). ## [0.16.0] diff --git a/src/frontend/src/app/shared/components/datatable/datatable.component.ts b/src/frontend/src/app/shared/components/datatable/datatable.component.ts index 1b5085f1..7fff1af3 100644 --- a/src/frontend/src/app/shared/components/datatable/datatable.component.ts +++ b/src/frontend/src/app/shared/components/datatable/datatable.component.ts @@ -477,10 +477,9 @@ export class DatatableComponent implements Datatable, OnInit { private applyFilters(): void { // Filter the data according the following rules: // 1. Order the data according the given criteria (column sorting). - // 2. Get the data that is displayed on the given page (pagination). - // 3. Apply the given search filter. + // 2. Apply the given search filter. + // 3. Get the data that is displayed on the given page (pagination). const filteredData = _.orderBy(this.data, [this.sortHeader], [this.sortDirection]) - .slice((this.page - 1) * this.pageSize, (this.page - 1) * this.pageSize + this.pageSize) .filter((o: DatatableData) => _.some(this.columns, (column: DatatableColumn) => { let value = _.get(o, column.prop); @@ -499,7 +498,8 @@ export class DatatableComponent implements Datatable, OnInit { } return _.includes(_.lowerCase(value), _.lowerCase(this.searchFilter)); }) - ); + ) + .slice((this.page - 1) * this.pageSize, (this.page - 1) * this.pageSize + this.pageSize); if ( filteredData.length !== this.filteredData.length || !_.isEqual(filteredData, this.filteredData)