From d2424ef5eb7324db6cfea66f5b752464eb6aa3d1 Mon Sep 17 00:00:00 2001 From: Anan Z Date: Mon, 5 Feb 2024 07:35:02 +0000 Subject: [PATCH] Make table size adjustable according to table rows and columns * Provide a unique key prop to the table component to force it to fully re-render when the key changes, which will force table to adjust its size. Issue Resolved https://github.com/opensearch-project/OpenSearch-Dashboards/issues/5440 Signed-off-by: Anan Z --- CHANGELOG.md | 4 ++++ .../public/application/view_components/canvas/index.tsx | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20fbb8f92cf1..42b4c8b96b7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,8 +51,12 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [BUG][Discover] Fix advanced setting `discover:modifyColumnsOnSwitch` ([#5508](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5508)) - [BUG][Discover] Show 0 filters when there are no active filters ([#5508](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5508)) - [Discover] Fix missing index pattern field from breaking Discover [#5626](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5626) +<<<<<<< HEAD - [BUG] Remove duplicate sample data as id 90943e30-9a47-11e8-b64d-95841ca0b247 ([5668](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5668)) - [BUG][Multiple Datasource] Fix datasource testing connection unexpectedly passed with wrong endpoint [#5663](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5663) +======= +- [BUG][Discover] Make table size adjustable according to table rows and columns ([#5514](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5514)) +>>>>>>> c5f5c61f730... Make table size adjustable according to table rows and columns ### 🚞 Infrastructure diff --git a/src/plugins/discover/public/application/view_components/canvas/index.tsx b/src/plugins/discover/public/application/view_components/canvas/index.tsx index d5c54158e997..7c417d84c639 100644 --- a/src/plugins/discover/public/application/view_components/canvas/index.tsx +++ b/src/plugins/discover/public/application/view_components/canvas/index.tsx @@ -89,6 +89,12 @@ export default function DiscoverCanvas({ setHeaderActionMenu, history }: ViewPro }, [dispatch, filteredColumns, indexPattern]); const timeField = indexPattern?.timeFieldName ? indexPattern.timeFieldName : undefined; + const lastColumn = columns ? columns[columns.length - 1] : ''; + + if (!rows || rows.length === 0) { + // TODO: handle better + return
{'loading...'}
; + } return ( - + )}