diff --git a/superset-frontend/src/dashboard/actions/sliceEntities.js b/superset-frontend/src/dashboard/actions/sliceEntities.js index 53a681de818a6..13d7ce45bfc04 100644 --- a/superset-frontend/src/dashboard/actions/sliceEntities.js +++ b/superset-frontend/src/dashboard/actions/sliceEntities.js @@ -22,6 +22,7 @@ import rison from 'rison'; import { addDangerToast } from 'src/components/MessageToasts/actions'; import { getClientErrorObject } from 'src/utils/getClientErrorObject'; +import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; export const SET_ALL_SLICES = 'SET_ALL_SLICES'; const FETCH_SLICES_PAGE_SIZE = 200; @@ -55,6 +56,14 @@ export function fetchSlices( ? [{ col: 'slice_name', opr: 'chart_all_text', value: filter_value }] : []; + if (isFeatureEnabled(FeatureFlag.DASHBOARD_NATIVE_FILTERS)) { + additional_filters.push({ + col: 'viz_type', + opr: 'neq', + value: 'filter_box', + }); + } + const cloneSlices = { ...slices }; return SupersetClient.get({ diff --git a/superset-frontend/src/explore/components/SaveModal.tsx b/superset-frontend/src/explore/components/SaveModal.tsx index d62cb4d898c6c..8d7bd2d895547 100644 --- a/superset-frontend/src/explore/components/SaveModal.tsx +++ b/superset-frontend/src/explore/components/SaveModal.tsx @@ -41,6 +41,7 @@ import { Select } from 'src/components'; import Loading from 'src/components/Loading'; import { setSaveChartModalVisibility } from 'src/explore/actions/saveModalActions'; import { SaveActionType } from 'src/explore/types'; +import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; // Session storage key for recent dashboard const SK_DASHBOARD_ID = 'save_chart_recent_dashboard'; @@ -69,6 +70,7 @@ type SaveModalState = { action: SaveActionType; isLoading: boolean; saveStatus?: string | null; + vizType?: string; }; export const StyledModal = styled(Modal)` @@ -92,6 +94,7 @@ class SaveModal extends React.Component { alert: null, action: this.canOverwriteSlice() ? 'overwrite' : 'saveas', isLoading: false, + vizType: props.form_data?.viz_type, }; this.onDashboardSelectChange = this.onDashboardSelectChange.bind(this); this.onSliceNameChange = this.onSliceNameChange.bind(this); @@ -339,27 +342,32 @@ class SaveModal extends React.Component { /> )} - - + {t('Select')} + {t(' a dashboard OR ')} + {t('create')} + {t(' a new one')} + + } + /> + + )} ); }; @@ -376,7 +384,9 @@ class SaveModal extends React.Component { !this.state.newSliceName || (!this.state.saveToDashboardId && !this.state.newDashboardName) || (this.props.datasource?.type !== DatasourceType.Table && - !this.state.datasetName) + !this.state.datasetName) || + (isFeatureEnabled(FeatureFlag.DASHBOARD_NATIVE_FILTERS) && + this.state.vizType === 'filter_box') } onClick={() => this.saveOrOverwrite(true)} > diff --git a/superset-frontend/src/pages/ChartCreation/index.tsx b/superset-frontend/src/pages/ChartCreation/index.tsx index 2a01a9123af12..baa0c78f1a08d 100644 --- a/superset-frontend/src/pages/ChartCreation/index.tsx +++ b/superset-frontend/src/pages/ChartCreation/index.tsx @@ -33,6 +33,7 @@ import Button from 'src/components/Button'; import { AsyncSelect, Steps } from 'src/components'; import { Tooltip } from 'src/components/Tooltip'; import withToasts from 'src/components/MessageToasts/withToasts'; +import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; import VizTypeGallery, { MAX_ADVISABLE_VIZ_GALLERY_WIDTH, @@ -66,6 +67,13 @@ const ELEMENTS_EXCEPT_VIZ_GALLERY = ESTIMATED_NAV_HEIGHT + 250; const bootstrapData = getBootstrapData(); const denyList: string[] = bootstrapData.common.conf.VIZ_TYPE_DENYLIST || []; +if ( + isFeatureEnabled(FeatureFlag.DASHBOARD_NATIVE_FILTERS) && + !('filter_box' in denyList) +) { + denyList.push('filter_box'); +} + const StyledContainer = styled.div` ${({ theme }) => ` flex: 1 1 auto;