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:52 UTC

[superset] branch 3.0 updated (4ad2a05333 -> 220dc58fe0)

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

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


    from 4ad2a05333 chore: Adds 3.0.1 CHANGELOG
     new ae700d13cf fix: Unable to sync columns when database or dataset name contains `+` (#25390)
     new 1367d7b954 fix(sqllab): Broken query containing 'children' (#25490)
     new 220dc58fe0 chore: Expand error detail on screencapture (#25519)

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/components/Datasource/DatasourceEditor.jsx |  6 ++----
 .../Datasource/DatasourceEditor.test.jsx           |  2 +-
 .../components/ErrorMessage/ErrorAlert.test.tsx    | 24 ++++++++++++++++++++++
 .../src/components/ErrorMessage/ErrorAlert.tsx     |  6 ++++--
 .../FilterableTable/FilterableTable.test.tsx       |  8 ++++----
 .../src/components/FilterableTable/index.tsx       |  1 +
 superset-frontend/src/components/Table/index.tsx   | 10 +++++++++
 7 files changed, 46 insertions(+), 11 deletions(-)


[superset] 03/03: chore: Expand error detail on screencapture (#25519)

Posted by mi...@apache.org.
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 220dc58fe07740a499cdb1d1c050dd53d06d2e8a
Author: JUST.in DO IT <ju...@airbnb.com>
AuthorDate: Wed Oct 4 11:06:22 2023 -0700

    chore: Expand error detail on screencapture (#25519)
    
    (cherry picked from commit ba541e802278bde10f77a543b66a9b4da3bc15cf)
---
 .../components/ErrorMessage/ErrorAlert.test.tsx    | 24 ++++++++++++++++++++++
 .../src/components/ErrorMessage/ErrorAlert.tsx     |  6 ++++--
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx b/superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx
index 38006c2ec4..2c2f1c2349 100644
--- a/superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx
+++ b/superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx
@@ -21,6 +21,7 @@ import React from 'react';
 import userEvent from '@testing-library/user-event';
 import { render, screen } from 'spec/helpers/testing-library';
 import { supersetTheme } from '@superset-ui/core';
+import { isCurrentUserBot } from 'src/utils/isBot';
 import ErrorAlert from './ErrorAlert';
 import { ErrorLevel, ErrorSource } from './types';
 
@@ -31,6 +32,10 @@ jest.mock(
       <span role="img" aria-label={fileName.replace('_', '-')} />,
 );
 
+jest.mock('src/utils/isBot', () => ({
+  isCurrentUserBot: jest.fn(),
+}));
+
 const mockedProps = {
   body: 'Error body',
   level: 'warning' as ErrorLevel,
@@ -41,6 +46,14 @@ const mockedProps = {
   description: 'we are unable to connect db.',
 };
 
+beforeEach(() => {
+  (isCurrentUserBot as jest.Mock).mockReturnValue(false);
+});
+
+afterEach(() => {
+  jest.clearAllMocks();
+});
+
 test('should render', () => {
   const { container } = render(<ErrorAlert {...mockedProps} />);
   expect(container).toBeInTheDocument();
@@ -100,6 +113,17 @@ test('should render the See more button', () => {
   expect(screen.getByText('See more')).toBeInTheDocument();
 });
 
+test('should render the error subtitle and body defaultly for the screen capture request', () => {
+  const seemoreProps = {
+    ...mockedProps,
+    source: 'explore' as ErrorSource,
+  };
+  (isCurrentUserBot as jest.Mock).mockReturnValue(true);
+  render(<ErrorAlert {...seemoreProps} />);
+  expect(screen.getByText('Error subtitle')).toBeInTheDocument();
+  expect(screen.getByText('Error body')).toBeInTheDocument();
+});
+
 test('should render the modal', () => {
   render(<ErrorAlert {...mockedProps} />, { useRedux: true });
   const button = screen.getByText('See more');
diff --git a/superset-frontend/src/components/ErrorMessage/ErrorAlert.tsx b/superset-frontend/src/components/ErrorMessage/ErrorAlert.tsx
index cf2522b4e4..d61abea597 100644
--- a/superset-frontend/src/components/ErrorMessage/ErrorAlert.tsx
+++ b/superset-frontend/src/components/ErrorMessage/ErrorAlert.tsx
@@ -21,6 +21,7 @@ import { styled, useTheme, t } from '@superset-ui/core';
 import { noOp } from 'src/utils/common';
 import Modal from 'src/components/Modal';
 import Button from 'src/components/Button';
+import { isCurrentUserBot } from 'src/utils/isBot';
 
 import Icons from 'src/components/Icons';
 import { ErrorLevel, ErrorSource } from './types';
@@ -102,9 +103,10 @@ export default function ErrorAlert({
   const theme = useTheme();
 
   const [isModalOpen, setIsModalOpen] = useState(false);
-  const [isBodyExpanded, setIsBodyExpanded] = useState(false);
+  const [isBodyExpanded, setIsBodyExpanded] = useState(isCurrentUserBot());
 
-  const isExpandable = ['explore', 'sqllab'].includes(source);
+  const isExpandable =
+    isCurrentUserBot() || ['explore', 'sqllab'].includes(source);
   const iconColor = theme.colors[level].base;
 
   return (


[superset] 01/03: fix: Unable to sync columns when database or dataset name contains `+` (#25390)

Posted by mi...@apache.org.
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 ae700d13cf65e99f9a7e6d089c59bef18a4cdcf5
Author: mapledan <ma...@gmail.com>
AuthorDate: Wed Oct 4 02:15:01 2023 +0800

    fix: Unable to sync columns when database or dataset name contains `+` (#25390)
    
    (cherry picked from commit dbe0838f8f446b94568644bdf68b86f75a87baf1)
---
 superset-frontend/src/components/Datasource/DatasourceEditor.jsx    | 6 ++----
 .../src/components/Datasource/DatasourceEditor.test.jsx             | 2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/superset-frontend/src/components/Datasource/DatasourceEditor.jsx b/superset-frontend/src/components/Datasource/DatasourceEditor.jsx
index 3d0cc7da57..ffbba4c7db 100644
--- a/superset-frontend/src/components/Datasource/DatasourceEditor.jsx
+++ b/superset-frontend/src/components/Datasource/DatasourceEditor.jsx
@@ -762,9 +762,7 @@ class DatasourceEditor extends React.PureComponent {
       database_name:
         datasource.database.database_name || datasource.database.name,
       schema_name: datasource.schema,
-      table_name: datasource.table_name
-        ? encodeURIComponent(datasource.table_name)
-        : datasource.table_name,
+      table_name: datasource.table_name,
       normalize_columns: datasource.normalize_columns,
     };
     Object.entries(params).forEach(([key, value]) => {
@@ -773,7 +771,7 @@ class DatasourceEditor extends React.PureComponent {
         params[key] = null;
       }
     });
-    const endpoint = `/datasource/external_metadata_by_name/?q=${rison.encode(
+    const endpoint = `/datasource/external_metadata_by_name/?q=${rison.encode_uri(
       params,
     )}`;
     this.setState({ metadataLoading: true });
diff --git a/superset-frontend/src/components/Datasource/DatasourceEditor.test.jsx b/superset-frontend/src/components/Datasource/DatasourceEditor.test.jsx
index ae35ebc139..9100eb6c86 100644
--- a/superset-frontend/src/components/Datasource/DatasourceEditor.test.jsx
+++ b/superset-frontend/src/components/Datasource/DatasourceEditor.test.jsx
@@ -75,7 +75,7 @@ describe('DatasourceEditor', () => {
       setTimeout(() => {
         expect(fetchMock.calls(DATASOURCE_ENDPOINT)).toHaveLength(1);
         expect(fetchMock.calls(DATASOURCE_ENDPOINT)[0][0]).toContain(
-          'Vehicle%20Sales%20%2B%27',
+          'Vehicle+Sales%20%2B',
         );
         fetchMock.reset();
         done();


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

Posted by mi...@apache.org.
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 (