From b92957e510ade609b3a89ac342af466591aa1a2d Mon Sep 17 00:00:00 2001 From: "JUST.in DO IT" Date: Wed, 4 Oct 2023 11:06:01 -0700 Subject: [PATCH] fix(sqllab): Broken query containing 'children' (#25490) --- .../FilterableTable/FilterableTable.test.tsx | 8 ++++---- .../src/components/FilterableTable/index.tsx | 1 + superset-frontend/src/components/Table/index.tsx | 10 ++++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/superset-frontend/src/components/FilterableTable/FilterableTable.test.tsx b/superset-frontend/src/components/FilterableTable/FilterableTable.test.tsx index 17e9cad2faa98..aebf2c44b2319 100644 --- a/superset-frontend/src/components/FilterableTable/FilterableTable.test.tsx +++ b/superset-frontend/src/components/FilterableTable/FilterableTable.test.tsx @@ -25,11 +25,11 @@ import userEvent from '@testing-library/user-event'; describe('FilterableTable', () => { const mockedProps = { - orderedColumnKeys: ['a', 'b', 'c'], + orderedColumnKeys: ['a', 'b', 'c', 'children'], data: [ - { a: 'a1', b: 'b1', c: 'c1', d: 0 }, - { a: 'a2', b: 'b2', c: 'c2', d: 100 }, - { a: null, b: 'b3', c: 'c3', d: 50 }, + { a: 'a1', b: 'b1', c: 'c1', d: 0, children: 0 }, + { a: 'a2', b: 'b2', c: 'c2', d: 100, children: 2 }, + { a: null, b: 'b3', c: 'c3', d: 50, children: 1 }, ], height: 500, }; diff --git a/superset-frontend/src/components/FilterableTable/index.tsx b/superset-frontend/src/components/FilterableTable/index.tsx index b27bc330102ec..9861d0af586fc 100644 --- a/superset-frontend/src/components/FilterableTable/index.tsx +++ b/superset-frontend/src/components/FilterableTable/index.tsx @@ -366,6 +366,7 @@ const FilterableTable = ({ usePagination={false} columns={columns} data={filteredList} + childrenColumnName="" virtualize bordered /> diff --git a/superset-frontend/src/components/Table/index.tsx b/superset-frontend/src/components/Table/index.tsx index 84ca7883f5757..12fdcec1d8e7d 100644 --- a/superset-frontend/src/components/Table/index.tsx +++ b/superset-frontend/src/components/Table/index.tsx @@ -150,6 +150,12 @@ export interface TableProps { * only supported for virtualize == true */ allowHTML?: boolean; + + /** + * The column that contains children to display. + * Check https://ant.design/components/table#table for more details. + */ + childrenColumnName?: string; } const defaultRowSelection: React.Key[] = []; @@ -259,6 +265,7 @@ export function Table( recordCount, onRow, allowHTML = false, + childrenColumnName, } = props; const wrapperRef = useRef(null); @@ -392,6 +399,9 @@ export function Table( theme, height: bodyHeight, bordered, + expandable: { + childrenColumnName, + }, }; return (