From ae0eb4b8d9bb3a34c69ff08b02bbe55fcefd4e4f Mon Sep 17 00:00:00 2001 From: "Michael S. Molina" <70410625+michael-s-molina@users.noreply.github.com> Date: Thu, 18 Jan 2024 13:24:25 -0300 Subject: [PATCH] refactor: Removes the deprecated DASHBOARD_FILTERS_EXPERIMENTAL feature flag (#26330) --- RESOURCES/FEATURE_FLAGS.md | 1 - UPDATING.md | 1 + .../src/utils/featureFlags.ts | 1 - .../components/nativeFilters/utils.test.ts | 5 +- .../components/nativeFilters/utils.ts | 3 +- .../GroupBy/GroupByFilterPlugin.tsx | 130 ------------------ .../filters/components/GroupBy/buildQuery.ts | 45 ------ .../components/GroupBy/controlPanel.ts | 86 ------------ .../components/GroupBy/images/thumbnail.png | Bin 5658 -> 0 bytes .../src/filters/components/GroupBy/index.ts | 43 ------ .../components/GroupBy/transformProps.ts | 60 -------- .../src/filters/components/GroupBy/types.ts | 49 ------- .../src/filters/components/index.ts | 1 - .../src/visualizations/presets/MainPreset.js | 10 +- superset/config.py | 1 - 15 files changed, 4 insertions(+), 432 deletions(-) delete mode 100644 superset-frontend/src/filters/components/GroupBy/GroupByFilterPlugin.tsx delete mode 100644 superset-frontend/src/filters/components/GroupBy/buildQuery.ts delete mode 100644 superset-frontend/src/filters/components/GroupBy/controlPanel.ts delete mode 100644 superset-frontend/src/filters/components/GroupBy/images/thumbnail.png delete mode 100644 superset-frontend/src/filters/components/GroupBy/index.ts delete mode 100644 superset-frontend/src/filters/components/GroupBy/transformProps.ts delete mode 100644 superset-frontend/src/filters/components/GroupBy/types.ts diff --git a/RESOURCES/FEATURE_FLAGS.md b/RESOURCES/FEATURE_FLAGS.md index 5c286ffa96..6ce8c1c1ee 100644 --- a/RESOURCES/FEATURE_FLAGS.md +++ b/RESOURCES/FEATURE_FLAGS.md @@ -84,7 +84,6 @@ These features flags currently default to True and **will be removed in a future [//]: # "PLEASE KEEP THE LIST SORTED ALPHABETICALLY" - DASHBOARD_CROSS_FILTERS -- DASHBOARD_FILTERS_EXPERIMENTAL - DASHBOARD_NATIVE_FILTERS - ENABLE_JAVASCRIPT_CONTROLS - GENERIC_CHART_AXES diff --git a/UPDATING.md b/UPDATING.md index 7e5e2ea472..05d56bdc3f 100644 --- a/UPDATING.md +++ b/UPDATING.md @@ -30,6 +30,7 @@ assists people when migrating to a new version. ### Breaking Changes +- [26330](https://github.com/apache/superset/issues/26330): Removes the deprecated `DASHBOARD_FILTERS_EXPERIMENTAL` feature flag. The previous value of the feature flag was `False` and now the feature is permanently removed. - [26344](https://github.com/apache/superset/issues/26344): Removes the deprecated `ENABLE_EXPLORE_JSON_CSRF_PROTECTION` feature flag. The previous value of the feature flag was `False` and now the feature is permanently removed. - [26345](https://github.com/apache/superset/issues/26345): Removes the deprecated `ENABLE_TEMPLATE_REMOVE_FILTERS` feature flag. The previous value of the feature flag was `True` and now the feature is permanently enabled. - [26346](https://github.com/apache/superset/issues/26346): Removes the deprecated `REMOVE_SLICE_LEVEL_LABEL_COLORS` feature flag. The previous value of the feature flag was `False` and now the feature is permanently removed. diff --git a/superset-frontend/packages/superset-ui-core/src/utils/featureFlags.ts b/superset-frontend/packages/superset-ui-core/src/utils/featureFlags.ts index b2001ec4c1..6d5935f04e 100644 --- a/superset-frontend/packages/superset-ui-core/src/utils/featureFlags.ts +++ b/superset-frontend/packages/superset-ui-core/src/utils/featureFlags.ts @@ -29,7 +29,6 @@ export enum FeatureFlag { CONFIRM_DASHBOARD_DIFF = 'CONFIRM_DASHBOARD_DIFF', /** @deprecated */ DASHBOARD_CROSS_FILTERS = 'DASHBOARD_CROSS_FILTERS', - DASHBOARD_FILTERS_EXPERIMENTAL = 'DASHBOARD_FILTERS_EXPERIMENTAL', DASHBOARD_NATIVE_FILTERS = 'DASHBOARD_NATIVE_FILTERS', DASHBOARD_VIRTUALIZATION = 'DASHBOARD_VIRTUALIZATION', DASHBOARD_RBAC = 'DASHBOARD_RBAC', diff --git a/superset-frontend/src/dashboard/components/nativeFilters/utils.test.ts b/superset-frontend/src/dashboard/components/nativeFilters/utils.test.ts index 7219ae360b..0388565595 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/utils.test.ts +++ b/superset-frontend/src/dashboard/components/nativeFilters/utils.test.ts @@ -94,10 +94,7 @@ describe('nativeFilterGate', () => { isFeatureEnabledMock = jest .spyOn(uiCore, 'isFeatureEnabled') .mockImplementation((featureFlag: FeatureFlag) => - [ - FeatureFlag.DASHBOARD_CROSS_FILTERS, - FeatureFlag.DASHBOARD_FILTERS_EXPERIMENTAL, - ].includes(featureFlag), + [FeatureFlag.DASHBOARD_CROSS_FILTERS].includes(featureFlag), ); }); diff --git a/superset-frontend/src/dashboard/components/nativeFilters/utils.ts b/superset-frontend/src/dashboard/components/nativeFilters/utils.ts index 9e1108366d..12f6d33e20 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/utils.ts +++ b/superset-frontend/src/dashboard/components/nativeFilters/utils.ts @@ -151,8 +151,7 @@ export function getExtraFormData( export function nativeFilterGate(behaviors: Behavior[]): boolean { return ( !behaviors.includes(Behavior.NATIVE_FILTER) || - (isFeatureEnabled(FeatureFlag.DASHBOARD_FILTERS_EXPERIMENTAL) && - isFeatureEnabled(FeatureFlag.DASHBOARD_CROSS_FILTERS) && + (isFeatureEnabled(FeatureFlag.DASHBOARD_CROSS_FILTERS) && behaviors.includes(Behavior.INTERACTIVE_CHART)) ); } diff --git a/superset-frontend/src/filters/components/GroupBy/GroupByFilterPlugin.tsx b/superset-frontend/src/filters/components/GroupBy/GroupByFilterPlugin.tsx deleted file mode 100644 index dfc314024e..0000000000 --- a/superset-frontend/src/filters/components/GroupBy/GroupByFilterPlugin.tsx +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -import { - ensureIsArray, - ExtraFormData, - getColumnLabel, - t, - tn, -} from '@superset-ui/core'; -import React, { useEffect, useState } from 'react'; -import { FormItemProps } from 'antd/lib/form'; -import { Select } from 'src/components'; -import { FilterPluginStyle, StyledFormItem, StatusMessage } from '../common'; -import { PluginFilterGroupByProps } from './types'; - -export default function PluginFilterGroupBy(props: PluginFilterGroupByProps) { - const { - data, - formData, - height, - width, - setDataMask, - setHoveredFilter, - unsetHoveredFilter, - setFocusedFilter, - unsetFocusedFilter, - setFilterActive, - filterState, - inputRef, - } = props; - const { defaultValue, multiSelect } = formData; - - const [value, setValue] = useState(defaultValue ?? []); - - const handleChange = (value?: string[] | string | null) => { - const resultValue: string[] = ensureIsArray(value); - setValue(resultValue); - const extraFormData: ExtraFormData = {}; - if (resultValue.length) { - extraFormData.interactive_groupby = resultValue; - } - - setDataMask({ - filterState: { value: resultValue.length ? resultValue : null }, - extraFormData, - }); - }; - - useEffect(() => { - handleChange(filterState.value); - }, [JSON.stringify(filterState.value), multiSelect]); - - useEffect(() => { - handleChange(defaultValue ?? null); - // I think after Config Modal update some filter it re-creates default value for all other filters - // so we can process it like this `JSON.stringify` or start to use `Immer` - }, [JSON.stringify(defaultValue), multiSelect]); - - const groupbys = ensureIsArray(formData.groupby).map(getColumnLabel); - const groupby = groupbys[0]?.length ? groupbys[0] : null; - - const withData = groupby - ? data.filter(row => groupby.includes(row.column_name as string)) - : data; - - const columns = data ? withData : []; - - const placeholderText = - columns.length === 0 - ? t('No columns') - : tn('%s option', '%s options', columns.length, columns.length); - - const formItemData: FormItemProps = {}; - if (filterState.validateMessage) { - formItemData.extra = ( - - {filterState.validateMessage} - - ); - } - const options = columns.map( - (row: { column_name: string; verbose_name: string | null }) => { - const { column_name: columnName, verbose_name: verboseName } = row; - return { - label: verboseName ?? columnName, - value: columnName, - }; - }, - ); - return ( - - -