From c22c4c771e3a629f8156b0dbcdb3d8d977ee2828 Mon Sep 17 00:00:00 2001 From: Sirazh Gabdullin Date: Thu, 6 Apr 2023 21:53:51 +0600 Subject: [PATCH 1/3] Fix: Update button position when number of rows per page is large Signed-off-by: Sirazh Gabdullin --- src/plugins/vis_type_table/public/utils/use_pagination.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/vis_type_table/public/utils/use_pagination.ts b/src/plugins/vis_type_table/public/utils/use_pagination.ts index 45dbed2c0da8..e3993f1c0868 100644 --- a/src/plugins/vis_type_table/public/utils/use_pagination.ts +++ b/src/plugins/vis_type_table/public/utils/use_pagination.ts @@ -9,7 +9,7 @@ import { TableVisConfig } from '../types'; export const usePagination = (visConfig: TableVisConfig, nRow: number) => { const [pagination, setPagination] = useState({ pageIndex: 0, - pageSize: visConfig.perPage || 10, + pageSize: Math.min(visConfig.perPage || 10, nRow), }); const onChangeItemsPerPage = useCallback( (pageSize) => setPagination((p) => ({ ...p, pageSize, pageIndex: 0 })), @@ -20,7 +20,7 @@ export const usePagination = (visConfig: TableVisConfig, nRow: number) => { ]); useEffect(() => { - const perPage = visConfig.perPage || 10; + const perPage = Math.min(visConfig.perPage || 10, nRow); const maxiPageIndex = Math.ceil(nRow / perPage) - 1; setPagination((p) => ({ pageIndex: p.pageIndex > maxiPageIndex ? maxiPageIndex : p.pageIndex, From 76bd30945c0467be78d5822e754368d156ea3f5e Mon Sep 17 00:00:00 2001 From: Sirazh Gabdullin Date: Mon, 10 Apr 2023 23:43:19 +0600 Subject: [PATCH 2/3] Update CHANGELOG.md Signed-off-by: Sirazh Gabdullin --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bba5b8bfc73e..63d0b71eb421 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -112,6 +112,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Clean up and rebuild `@osd/pm` ([#3570](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3570)) - [Vega] Add Filter custom label for opensearchDashboardsAddFilter ([#3640](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3640)) - [Timeline] Fix y-axis label color in dark mode ([#3698](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3698)) +- [Table Visualization][bug] Fix data table rendering empty space ([#3797](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3797)) ### 🚞 Infrastructure From 60b09fee1ae1c5d9cf08867d95455f99fbd648a6 Mon Sep 17 00:00:00 2001 From: Sirazh Gabdullin Date: Mon, 10 Apr 2023 23:55:19 +0600 Subject: [PATCH 3/3] Update CHANGELOG.md Signed-off-by: Sirazh Gabdullin --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63d0b71eb421..ba0102c982e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -112,7 +112,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Clean up and rebuild `@osd/pm` ([#3570](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3570)) - [Vega] Add Filter custom label for opensearchDashboardsAddFilter ([#3640](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3640)) - [Timeline] Fix y-axis label color in dark mode ([#3698](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3698)) -- [Table Visualization][bug] Fix data table rendering empty space ([#3797](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3797)) +- [Table Visualization] Fix table rendering empty unused space ([#3797](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3797)) ### 🚞 Infrastructure