From 19151d1e4a6d735f4229a28eae2c6b00e1409227 Mon Sep 17 00:00:00 2001 From: SBIN2010 Date: Tue, 22 Oct 2024 23:07:40 +0300 Subject: [PATCH 1/8] fix: fixed Add Metrics to Tree Chart (#29158) --- .../plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx index 34d65a27d315..26fafbdc1b7f 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx @@ -89,9 +89,7 @@ const controlPanel: ControlPanelConfig = { { name: 'metric', config: { - ...optionalEntity, - type: 'DndMetricSelect', - label: t('Metric'), + ...sharedControls.metric, description: t('Metric for node values'), }, }, From 35aaeb66bf9d01a4e3f1cb7c9c92989b1503b25e Mon Sep 17 00:00:00 2001 From: SBIN2010 Date: Tue, 22 Oct 2024 23:45:27 +0300 Subject: [PATCH 2/8] fix: clear modal after CSS templates is added --- .../src/features/cssTemplates/CssTemplateModal.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/superset-frontend/src/features/cssTemplates/CssTemplateModal.tsx b/superset-frontend/src/features/cssTemplates/CssTemplateModal.tsx index 16af9e7039d3..74f0491543ea 100644 --- a/superset-frontend/src/features/cssTemplates/CssTemplateModal.tsx +++ b/superset-frontend/src/features/cssTemplates/CssTemplateModal.tsx @@ -131,7 +131,10 @@ const CssTemplateModal: FunctionComponent = ({ if (onCssTemplateAdd) { onCssTemplateAdd(); } - + setCurrentCssTemplate({ + template_name: '', + css: '', + }); hide(); }); } From db3afda17db52cf217af4f20b09a4d1e09848117 Mon Sep 17 00:00:00 2001 From: SBIN2010 Date: Wed, 23 Oct 2024 22:15:52 +0300 Subject: [PATCH 3/8] Revert "fix: clear modal after CSS templates is added" This reverts commit 35aaeb66bf9d01a4e3f1cb7c9c92989b1503b25e. --- .../src/features/cssTemplates/CssTemplateModal.tsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/superset-frontend/src/features/cssTemplates/CssTemplateModal.tsx b/superset-frontend/src/features/cssTemplates/CssTemplateModal.tsx index 74f0491543ea..16af9e7039d3 100644 --- a/superset-frontend/src/features/cssTemplates/CssTemplateModal.tsx +++ b/superset-frontend/src/features/cssTemplates/CssTemplateModal.tsx @@ -131,10 +131,7 @@ const CssTemplateModal: FunctionComponent = ({ if (onCssTemplateAdd) { onCssTemplateAdd(); } - setCurrentCssTemplate({ - template_name: '', - css: '', - }); + hide(); }); } From 9eea2e6fd6ac5cf4f41ae91b2941a9bfea82718b Mon Sep 17 00:00:00 2001 From: SBIN2010 Date: Mon, 25 Nov 2024 21:45:32 +0300 Subject: [PATCH 4/8] fix: tree metrics exclude validator --- .../plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx index 26fafbdc1b7f..4d8b0fa978ee 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx @@ -90,6 +90,8 @@ const controlPanel: ControlPanelConfig = { name: 'metric', config: { ...sharedControls.metric, + clearable: true, + validators: [], description: t('Metric for node values'), }, }, From 601dde2bb5fbde32df0a7311559b2ccf7e4773e0 Mon Sep 17 00:00:00 2001 From: SBIN2010 Date: Tue, 25 Mar 2025 15:06:36 +0300 Subject: [PATCH 5/8] fix: revert #30679 --- .../plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx index 4d8b0fa978ee..34d65a27d315 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx @@ -89,9 +89,9 @@ const controlPanel: ControlPanelConfig = { { name: 'metric', config: { - ...sharedControls.metric, - clearable: true, - validators: [], + ...optionalEntity, + type: 'DndMetricSelect', + label: t('Metric'), description: t('Metric for node values'), }, }, From 5b0932a271ef9c14ac74c4ddc8b64f69cc207c9d Mon Sep 17 00:00:00 2001 From: SBIN2010 Date: Thu, 10 Jul 2025 22:41:33 +0300 Subject: [PATCH 6/8] fix: added closing of tab after closing modal window --- .../DatabaseModal/ExtraOptions.test.tsx | 28 +++++++++++++++++++ .../databases/DatabaseModal/ExtraOptions.tsx | 11 +++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.test.tsx b/superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.test.tsx index c96ab3073fb8..f0436fa32e82 100644 --- a/superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.test.tsx +++ b/superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.test.tsx @@ -191,4 +191,32 @@ describe('ExtraOptions Component', () => { fireEvent.change(input, { target: { value: '1000' } }); expect(onExtraInputChange).toHaveBeenCalled(); }); + + it('renders the collaps tab correctly and resets to default tab after closing', () => { + const { rerender } = renderComponent(); + const sqlLabTab = screen.getByRole('tab', { + name: /SQL Lab./i, + }); + + expect(sqlLabTab).toHaveAttribute('aria-expanded', 'false'); + fireEvent.click(sqlLabTab); + expect(sqlLabTab).toHaveAttribute('aria-expanded', 'true'); + const customDb = { + ...defaultDb, + expose_in_sqllab: false, + }; + + rerender( + , + ); + expect(sqlLabTab).toHaveAttribute('aria-expanded', 'false'); + }); }); diff --git a/superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.tsx b/superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.tsx index 392ead726458..f5010d953a61 100644 --- a/superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.tsx +++ b/superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.tsx @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { ChangeEvent, EventHandler } from 'react'; +import { ChangeEvent, EventHandler, useState, useEffect } from 'react'; import cx from 'classnames'; import { t, @@ -88,12 +88,21 @@ const ExtraOptions = ({ const isAllowRunAsyncDisabled = isFeatureEnabled( FeatureFlag.ForceSqlLabRunAsync, ); + const [activeKey, setActiveKey] = useState(); + + useEffect(() => { + if (!expandableModalIsOpen) { + setActiveKey(undefined); + } + }, [expandableModalIsOpen]); return ( setActiveKey(key)} items={[ { key: 'sql-lab', From d26203ecad6901b4ff1369cd15862474898175cd Mon Sep 17 00:00:00 2001 From: SBIN2010 Date: Thu, 10 Jul 2025 22:51:14 +0300 Subject: [PATCH 7/8] fix: revert --- .../plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx index 34d65a27d315..4d8b0fa978ee 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx @@ -89,9 +89,9 @@ const controlPanel: ControlPanelConfig = { { name: 'metric', config: { - ...optionalEntity, - type: 'DndMetricSelect', - label: t('Metric'), + ...sharedControls.metric, + clearable: true, + validators: [], description: t('Metric for node values'), }, }, From bffc2ccecc0aea269c6fe2afd7ed068a69bc7d52 Mon Sep 17 00:00:00 2001 From: SBIN2010 Date: Thu, 10 Jul 2025 23:06:22 +0300 Subject: [PATCH 8/8] fix: added activeKey check condition --- .../src/features/databases/DatabaseModal/ExtraOptions.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.tsx b/superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.tsx index f5010d953a61..d04cd6d5c14c 100644 --- a/superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.tsx +++ b/superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.tsx @@ -91,10 +91,10 @@ const ExtraOptions = ({ const [activeKey, setActiveKey] = useState(); useEffect(() => { - if (!expandableModalIsOpen) { + if (!expandableModalIsOpen && activeKey !== undefined) { setActiveKey(undefined); } - }, [expandableModalIsOpen]); + }, [expandableModalIsOpen, activeKey]); return (