diff --git a/superset-frontend/src/dashboard/components/SliceHeaderControls/SliceHeaderControls.test.tsx b/superset-frontend/src/dashboard/components/SliceHeaderControls/SliceHeaderControls.test.tsx
index 158bd99e858d9..979073fd036bf 100644
--- a/superset-frontend/src/dashboard/components/SliceHeaderControls/SliceHeaderControls.test.tsx
+++ b/superset-frontend/src/dashboard/components/SliceHeaderControls/SliceHeaderControls.test.tsx
@@ -36,7 +36,7 @@ jest.mock('src/common/components', () => {
};
});
-const createProps = () => ({
+const createProps = (viz_type = 'sunburst') => ({
addDangerToast: jest.fn(),
addSuccessToast: jest.fn(),
exploreChart: jest.fn(),
@@ -67,9 +67,9 @@ const createProps = () => ({
time_range: 'No filter',
time_range_endpoints: ['inclusive', 'exclusive'],
url_params: {},
- viz_type: 'sunburst',
+ viz_type,
},
- viz_type: 'sunburst',
+ viz_type,
datasource: '58__table',
description: 'test-description',
description_markeddown: '',
@@ -152,25 +152,30 @@ test('Should "export to CSV"', () => {
expect(props.exportCSV).toBeCalledWith(371);
});
+test('Should not show "Export to CSV" if slice is filter box', () => {
+ const props = createProps('filter_box');
+ render(, { useRedux: true });
+ expect(screen.queryByRole('menuitem', { name: 'Export CSV' })).toBe(null);
+});
+
test('Export full CSV is under featureflag', () => {
// @ts-ignore
global.featureFlags = {
[FeatureFlag.ALLOW_FULL_CSV_EXPORT]: false,
};
- const props = createProps();
- props.slice.viz_type = 'table';
+ const props = createProps('table');
render(, { useRedux: true });
expect(screen.queryByRole('menuitem', { name: 'Export full CSV' })).toBe(
null,
);
});
+
test('Should "export full CSV"', () => {
// @ts-ignore
global.featureFlags = {
[FeatureFlag.ALLOW_FULL_CSV_EXPORT]: true,
};
- const props = createProps();
- props.slice.viz_type = 'table';
+ const props = createProps('table');
render(, { useRedux: true });
expect(screen.queryByRole('menuitem', { name: 'Export full CSV' })).not.toBe(
null,
@@ -193,6 +198,18 @@ test('Should not show export full CSV if report is not table', () => {
);
});
+test('Should not show export full CSV if slice is filter box', () => {
+ // @ts-ignore
+ global.featureFlags = {
+ [FeatureFlag.ALLOW_FULL_CSV_EXPORT]: true,
+ };
+ const props = createProps('filter_box');
+ render(, { useRedux: true });
+ expect(screen.queryByRole('menuitem', { name: 'Export full CSV' })).toBe(
+ null,
+ );
+});
+
test('Should "Toggle chart description"', () => {
const props = createProps();
render(, { useRedux: true });
diff --git a/superset-frontend/src/dashboard/components/SliceHeaderControls/index.tsx b/superset-frontend/src/dashboard/components/SliceHeaderControls/index.tsx
index f7a7dd246f11d..5094412855a37 100644
--- a/superset-frontend/src/dashboard/components/SliceHeaderControls/index.tsx
+++ b/superset-frontend/src/dashboard/components/SliceHeaderControls/index.tsx
@@ -328,16 +328,20 @@ class SliceHeaderControls extends React.PureComponent<
{t('Download as image')}
- {this.props.supersetCanCSV && (
-
{t('Export CSV')}
- )}
- {isFeatureEnabled(FeatureFlag.ALLOW_FULL_CSV_EXPORT) &&
+ {this.props.slice.viz_type !== 'filter_box' &&
+ this.props.supersetCanCSV && (
+ {t('Export CSV')}
+ )}
+
+ {this.props.slice.viz_type !== 'filter_box' &&
+ isFeatureEnabled(FeatureFlag.ALLOW_FULL_CSV_EXPORT) &&
this.props.supersetCanCSV &&
isTable && (
{t('Export full CSV')}
)}
+
{isFeatureEnabled(FeatureFlag.DASHBOARD_CROSS_FILTERS) &&
isCrossFilter &&
canEmitCrossFilter && (