chore: Remove the ability to add filter-box charts when DASHBOARD_NATIVE_FILTERS feature is enabled (#23142)

This commit is contained in:
John Bodley 2023-03-02 07:30:42 +13:00 committed by GitHub
parent 5f0c320415
commit 134acba99a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 22 deletions

View File

@ -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({

View File

@ -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<SaveModalProps, SaveModalState> {
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<SaveModalProps, SaveModalState> {
/>
</FormItem>
)}
<FormItem
label={t('Add to dashboard')}
data-test="save-chart-modal-select-dashboard-form"
>
<Select
allowClear
allowNewOptions
ariaLabel={t('Select a dashboard')}
options={this.props.dashboards}
onChange={this.onDashboardSelectChange}
value={dashboardSelectValue || undefined}
placeholder={
<div>
<b>{t('Select')}</b>
{t(' a dashboard OR ')}
<b>{t('create')}</b>
{t(' a new one')}
</div>
}
/>
</FormItem>
{!(
isFeatureEnabled(FeatureFlag.DASHBOARD_NATIVE_FILTERS) &&
this.state.vizType === 'filter_box'
) && (
<FormItem
label={t('Add to dashboard')}
data-test="save-chart-modal-select-dashboard-form"
>
<Select
allowClear
allowNewOptions
ariaLabel={t('Select a dashboard')}
options={this.props.dashboards}
onChange={this.onDashboardSelectChange}
value={dashboardSelectValue || undefined}
placeholder={
<div>
<b>{t('Select')}</b>
{t(' a dashboard OR ')}
<b>{t('create')}</b>
{t(' a new one')}
</div>
}
/>
</FormItem>
)}
</Form>
);
};
@ -376,7 +384,9 @@ class SaveModal extends React.Component<SaveModalProps, SaveModalState> {
!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)}
>

View File

@ -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;