You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by li...@apache.org on 2023/03/01 22:02:27 UTC
[superset] branch master updated: fix: customize tab on heatmap chart is blank (#23243)
This is an automated email from the ASF dual-hosted git repository.
lilykuang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 1f3eb56688 fix: customize tab on heatmap chart is blank (#23243)
1f3eb56688 is described below
commit 1f3eb566884230dd5f3236b4e3e654cc0009db79
Author: Lily Kuang <li...@preset.io>
AuthorDate: Wed Mar 1 14:02:12 2023 -0800
fix: customize tab on heatmap chart is blank (#23243)
---
.../components/ControlPanelsContainer.test.tsx | 39 ++++++++++++++++++++++
.../explore/components/ControlPanelsContainer.tsx | 2 +-
2 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/superset-frontend/src/explore/components/ControlPanelsContainer.test.tsx b/superset-frontend/src/explore/components/ControlPanelsContainer.test.tsx
index 2be8745fa1..333d3ec799 100644
--- a/superset-frontend/src/explore/components/ControlPanelsContainer.test.tsx
+++ b/superset-frontend/src/explore/components/ControlPanelsContainer.test.tsx
@@ -17,6 +17,7 @@
* under the License.
*/
import React from 'react';
+import userEvent from '@testing-library/user-event';
import { render, screen } from 'spec/helpers/testing-library';
import {
DatasourceType,
@@ -104,5 +105,43 @@ describe('ControlPanelsContainer', () => {
expect(
await screen.findAllByTestId('collapsible-control-panel-header'),
).toHaveLength(4);
+ expect(screen.getByRole('tab', { name: /customize/i })).toBeInTheDocument();
+ userEvent.click(screen.getByRole('tab', { name: /customize/i }));
+ expect(
+ await screen.findAllByTestId('collapsible-control-panel-header'),
+ ).toHaveLength(5);
+ });
+
+ test('renders ControlPanelSections no Customize Tab', async () => {
+ getChartControlPanelRegistry().registerValue('table', {
+ controlPanelSections: [
+ {
+ label: t('GROUP BY'),
+ description: t(
+ 'Use this section if you want a query that aggregates',
+ ),
+ expanded: true,
+ controlSetRows: [
+ ['groupby'],
+ ['metrics'],
+ ['percent_metrics'],
+ ['timeseries_limit_metric', 'row_limit'],
+ ['include_time', 'order_desc'],
+ ],
+ },
+ {
+ label: t('Options'),
+ expanded: true,
+ controlSetRows: [],
+ },
+ ],
+ });
+ render(<ControlPanelsContainer {...getDefaultProps()} />, {
+ useRedux: true,
+ });
+ expect(screen.queryByText(/customize/i)).not.toBeInTheDocument();
+ expect(
+ await screen.findAllByTestId('collapsible-control-panel-header'),
+ ).toHaveLength(2);
});
});
diff --git a/superset-frontend/src/explore/components/ControlPanelsContainer.tsx b/superset-frontend/src/explore/components/ControlPanelsContainer.tsx
index 018f0b0ac3..8a456619f4 100644
--- a/superset-frontend/src/explore/components/ControlPanelsContainer.tsx
+++ b/superset-frontend/src/explore/components/ControlPanelsContainer.tsx
@@ -236,7 +236,7 @@ function getState(
)
) {
querySections.push(section);
- } else {
+ } else if (section.controlSetRows.length > 0) {
customizeSections.push(section);
}
});