You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2023/10/04 18:18:54 UTC

[superset] 02/03: fix(sqllab): Broken query containing 'children' (#25490)

This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 1367d7b9540b5e5829f17f51b50fa617f92ae70b
Author: JUST.in DO IT <ju...@airbnb.com>
AuthorDate: Wed Oct 4 11:06:01 2023 -0700

    fix(sqllab): Broken query containing 'children' (#25490)
    
    (cherry picked from commit b92957e510ade609b3a89ac342af466591aa1a2d)
---
 .../src/components/FilterableTable/FilterableTable.test.tsx    |  8 ++++----
 superset-frontend/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 17e9cad2fa..aebf2c44b2 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 91fc1f4477..01dd31be72 100644
--- a/superset-frontend/src/components/FilterableTable/index.tsx
+++ b/superset-frontend/src/components/FilterableTable/index.tsx
@@ -391,6 +391,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 84ca7883f5..12fdcec1d8 100644
--- a/superset-frontend/src/components/Table/index.tsx
+++ b/superset-frontend/src/components/Table/index.tsx
@@ -150,6 +150,12 @@ export interface TableProps<RecordType> {
    * 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<RecordType extends object>(
     recordCount,
     onRow,
     allowHTML = false,
+    childrenColumnName,
   } = props;
 
   const wrapperRef = useRef<HTMLDivElement | null>(null);
@@ -392,6 +399,9 @@ export function Table<RecordType extends object>(
     theme,
     height: bodyHeight,
     bordered,
+    expandable: {
+      childrenColumnName,
+    },
   };
 
   return (