Skip to content

Commit 69b5701

Browse files
refactor: Removes the deprecated DASHBOARD_NATIVE_FILTERS feature flag (#26329)
1 parent 3acda14 commit 69b5701

File tree

22 files changed

+110
-289
lines changed

22 files changed

+110
-289
lines changed

RESOURCES/FEATURE_FLAGS.md

-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ These features flags currently default to True and **will be removed in a future
8484
[//]: # "PLEASE KEEP THE LIST SORTED ALPHABETICALLY"
8585

8686
- DASHBOARD_CROSS_FILTERS
87-
- DASHBOARD_NATIVE_FILTERS
8887
- ENABLE_JAVASCRIPT_CONTROLS
8988
- GENERIC_CHART_AXES
9089
- KV_STORE

UPDATING.md

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ assists people when migrating to a new version.
4343
- [26637](https://github.com/apache/superset/issues/26637): Sets the `DRILL_BY` feature flag to `True` by default given that the feature has been tested for a while and reached a stable state.
4444
- [26462](https://github.com/apache/superset/issues/26462): Removes the Profile feature given that it's not actively maintained and not widely used.
4545
- [26377](https://github.com/apache/superset/pull/26377): Removes the deprecated Redirect API that supported short URLs used before the permalink feature.
46+
- [26329](https://github.com/apache/superset/issues/26329): Removes the deprecated `DASHBOARD_NATIVE_FILTERS` feature flag. The previous value of the feature flag was `True` and now the feature is permanently enabled.
4647

4748
### Potential Downtime
4849

superset-frontend/packages/superset-ui-core/src/utils/featureFlags.ts

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export enum FeatureFlag {
2929
CONFIRM_DASHBOARD_DIFF = 'CONFIRM_DASHBOARD_DIFF',
3030
/** @deprecated */
3131
DASHBOARD_CROSS_FILTERS = 'DASHBOARD_CROSS_FILTERS',
32-
DASHBOARD_NATIVE_FILTERS = 'DASHBOARD_NATIVE_FILTERS',
3332
DASHBOARD_VIRTUALIZATION = 'DASHBOARD_VIRTUALIZATION',
3433
DASHBOARD_RBAC = 'DASHBOARD_RBAC',
3534
DATAPANEL_CLOSED_BY_DEFAULT = 'DATAPANEL_CLOSED_BY_DEFAULT',

superset-frontend/plugins/plugin-chart-handlebars/src/plugin/controls/pagination.tsx

+14-18
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,22 @@ import {
2121
ControlSetItem,
2222
ControlSetRow,
2323
} from '@superset-ui/chart-controls';
24-
import { FeatureFlag, isFeatureEnabled, t } from '@superset-ui/core';
24+
import { t } from '@superset-ui/core';
2525
import { PAGE_SIZE_OPTIONS } from '../../consts';
2626

27-
export const serverPaginationControlSetRow: ControlSetRow =
28-
isFeatureEnabled(FeatureFlag.DASHBOARD_CROSS_FILTERS) ||
29-
isFeatureEnabled(FeatureFlag.DASHBOARD_NATIVE_FILTERS)
30-
? [
31-
{
32-
name: 'server_pagination',
33-
config: {
34-
type: 'CheckboxControl',
35-
label: t('Server pagination'),
36-
description: t(
37-
'Enable server side pagination of results (experimental feature)',
38-
),
39-
default: false,
40-
},
41-
},
42-
]
43-
: [];
27+
export const serverPaginationControlSetRow: ControlSetRow = [
28+
{
29+
name: 'server_pagination',
30+
config: {
31+
type: 'CheckboxControl',
32+
label: t('Server pagination'),
33+
description: t(
34+
'Enable server side pagination of results (experimental feature)',
35+
),
36+
default: false,
37+
},
38+
},
39+
];
4440

4541
export const serverPageLengthControlSetItem: ControlSetItem = {
4642
name: 'server_page_length',

superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx

+13-18
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ import React from 'react';
2121
import {
2222
ChartDataResponseResult,
2323
ensureIsArray,
24-
FeatureFlag,
2524
GenericDataType,
2625
hasGenericChartAxes,
2726
isAdhocColumn,
28-
isFeatureEnabled,
2927
isPhysicalColumn,
3028
QueryFormColumn,
3129
QueryMode,
@@ -290,22 +288,19 @@ const config: ControlPanelConfig = {
290288
},
291289
},
292290
],
293-
isFeatureEnabled(FeatureFlag.DASHBOARD_CROSS_FILTERS) ||
294-
isFeatureEnabled(FeatureFlag.DASHBOARD_NATIVE_FILTERS)
295-
? [
296-
{
297-
name: 'server_pagination',
298-
config: {
299-
type: 'CheckboxControl',
300-
label: t('Server pagination'),
301-
description: t(
302-
'Enable server side pagination of results (experimental feature)',
303-
),
304-
default: false,
305-
},
306-
},
307-
]
308-
: [],
291+
[
292+
{
293+
name: 'server_pagination',
294+
config: {
295+
type: 'CheckboxControl',
296+
label: t('Server pagination'),
297+
description: t(
298+
'Enable server side pagination of results (experimental feature)',
299+
),
300+
default: false,
301+
},
302+
},
303+
],
309304
[
310305
{
311306
name: 'row_limit',

superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.test.tsx

+14-30
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import React from 'react';
2020
import fetchMock from 'fetch-mock';
2121
import { render } from 'spec/helpers/testing-library';
2222
import { fireEvent, within } from '@testing-library/react';
23-
import * as uiCore from '@superset-ui/core';
2423
import DashboardBuilder from 'src/dashboard/components/DashboardBuilder/DashboardBuilder';
2524
import useStoredSidebarWidth from 'src/components/ResizableSidebar/useStoredSidebarWidth';
2625
import {
@@ -247,35 +246,20 @@ describe('DashboardBuilder', () => {
247246
expect(await findByAltText('Loading...')).toBeVisible();
248247
});
249248

250-
describe('when nativeFiltersEnabled', () => {
251-
let isFeatureEnabledMock: jest.MockInstance<boolean, [string]>;
252-
beforeAll(() => {
253-
isFeatureEnabledMock = jest
254-
.spyOn(uiCore, 'isFeatureEnabled')
255-
.mockImplementation(
256-
flag => flag === uiCore.FeatureFlag.DASHBOARD_NATIVE_FILTERS,
257-
);
258-
});
259-
260-
afterAll(() => {
261-
isFeatureEnabledMock.mockRestore();
262-
});
263-
264-
it('should set FilterBar width by useStoredSidebarWidth', () => {
265-
const expectedValue = 200;
266-
const setter = jest.fn();
267-
(useStoredSidebarWidth as jest.Mock).mockImplementation(() => [
268-
expectedValue,
269-
setter,
270-
]);
271-
const { getByTestId } = setup({
272-
dashboardInfo: {
273-
...mockState.dashboardInfo,
274-
dash_edit_perm: true,
275-
},
276-
});
277-
const filterbar = getByTestId('dashboard-filters-panel');
278-
expect(filterbar).toHaveStyleRule('width', `${expectedValue}px`);
249+
it('should set FilterBar width by useStoredSidebarWidth', () => {
250+
const expectedValue = 200;
251+
const setter = jest.fn();
252+
(useStoredSidebarWidth as jest.Mock).mockImplementation(() => [
253+
expectedValue,
254+
setter,
255+
]);
256+
const { getByTestId } = setup({
257+
dashboardInfo: {
258+
...mockState.dashboardInfo,
259+
dash_edit_perm: true,
260+
},
279261
});
262+
const filterbar = getByTestId('dashboard-filters-panel');
263+
expect(filterbar).toHaveStyleRule('width', `${expectedValue}px`);
280264
});
281265
});

superset-frontend/src/dashboard/components/DashboardBuilder/DashboardContainer.tsx

+1-6
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@
2121
import React, { FC, useCallback, useEffect, useMemo, useRef } from 'react';
2222
import { useDispatch, useSelector } from 'react-redux';
2323
import {
24-
FeatureFlag,
2524
Filter,
2625
Filters,
2726
getCategoricalSchemeRegistry,
28-
isFeatureEnabled,
2927
SupersetClient,
3028
useComponentDidUpdate,
3129
} from '@superset-ui/core';
@@ -104,10 +102,7 @@ const DashboardContainer: FC<DashboardContainerProps> = ({ topLevelTabs }) => {
104102
}, [dashboardLayout, directPathToChild]);
105103

106104
useEffect(() => {
107-
if (
108-
!isFeatureEnabled(FeatureFlag.DASHBOARD_NATIVE_FILTERS) ||
109-
nativeFilterScopes.length === 0
110-
) {
105+
if (nativeFilterScopes.length === 0) {
111106
return;
112107
}
113108
const scopes = nativeFilterScopes.map(filterScope => {

superset-frontend/src/dashboard/components/DashboardBuilder/state.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
* under the License.
1818
*/
1919
import { useSelector } from 'react-redux';
20-
import { isFeatureEnabled, FeatureFlag } from '@superset-ui/core';
2120
import { useCallback, useEffect, useState } from 'react';
2221
import { URL_PARAMS } from 'src/constants';
2322
import { getUrlParam } from 'src/utils/urlUtils';
@@ -42,8 +41,7 @@ export const useNativeFilters = () => {
4241
);
4342

4443
const nativeFiltersEnabled =
45-
isFeatureEnabled(FeatureFlag.DASHBOARD_NATIVE_FILTERS) &&
46-
(canEdit || (!canEdit && filterValues.length !== 0));
44+
canEdit || (!canEdit && filterValues.length !== 0);
4745

4846
const requiredFirstFilter = filterValues.filter(
4947
filter => filter.requiredFirst,

superset-frontend/src/dashboard/components/FiltersBadge/FiltersBadge.test.tsx

-4
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,6 @@ describe('FiltersBadge', () => {
133133
});
134134

135135
it('shows the indicator when filters have been applied', () => {
136-
// @ts-ignore
137-
global.featureFlags = {
138-
[SupersetUI.FeatureFlag.DASHBOARD_NATIVE_FILTERS]: true,
139-
};
140136
const store = getMockStoreWithNativeFilters();
141137
// start with basic dashboard state, dispatch an event to simulate query completion
142138
store.dispatch({

superset-frontend/src/dashboard/components/Header/HeaderActionsDropdown/HeaderActionsDropdown.test.tsx

+7-53
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,8 @@ import userEvent from '@testing-library/user-event';
2424
import fetchMock from 'fetch-mock';
2525
import { HeaderDropdownProps } from 'src/dashboard/components/Header/types';
2626
import injectCustomCss from 'src/dashboard/util/injectCustomCss';
27-
import { FeatureFlag } from '@superset-ui/core';
28-
import * as uiCore from '@superset-ui/core';
2927
import HeaderActionsDropdown from '.';
3028

31-
let isFeatureEnabledMock: jest.MockInstance<boolean, [feature: FeatureFlag]>;
32-
3329
const createProps = () => ({
3430
addSuccessToast: jest.fn(),
3531
addDangerToast: jest.fn(),
@@ -135,7 +131,7 @@ test('should render the menu items', async () => {
135131

136132
test('should render the menu items in edit mode', async () => {
137133
setup(editModeOnProps);
138-
expect(screen.getAllByRole('menuitem')).toHaveLength(5);
134+
expect(screen.getAllByRole('menuitem')).toHaveLength(4);
139135
expect(screen.getByText('Set auto-refresh interval')).toBeInTheDocument();
140136
expect(screen.getByText('Edit properties')).toBeInTheDocument();
141137
expect(screen.getByText('Edit CSS')).toBeInTheDocument();
@@ -150,56 +146,14 @@ test('should render the menu items in Embedded mode', async () => {
150146
expect(screen.getByText('Set auto-refresh interval')).toBeInTheDocument();
151147
});
152148

153-
describe('with native filters feature flag disabled', () => {
154-
beforeAll(() => {
155-
isFeatureEnabledMock = jest
156-
.spyOn(uiCore, 'isFeatureEnabled')
157-
.mockImplementation(
158-
(featureFlag: FeatureFlag) =>
159-
featureFlag !== FeatureFlag.DASHBOARD_NATIVE_FILTERS,
160-
);
161-
});
162-
163-
afterAll(() => {
164-
// @ts-ignore
165-
isFeatureEnabledMock.restore();
166-
});
167-
168-
it('should render filter mapping in edit mode if explicit filter scopes undefined', async () => {
169-
setup(editModeOnProps);
170-
expect(screen.getByText('Set filter mapping')).toBeInTheDocument();
171-
});
172-
173-
it('should render filter mapping in edit mode if explicit filter scopes defined', async () => {
174-
setup(editModeOnWithFilterScopesProps);
175-
expect(screen.getByText('Set filter mapping')).toBeInTheDocument();
176-
});
149+
test('should not render filter mapping in edit mode if explicit filter scopes undefined', async () => {
150+
setup(editModeOnProps);
151+
expect(screen.queryByText('Set filter mapping')).not.toBeInTheDocument();
177152
});
178153

179-
describe('with native filters feature flag enabled', () => {
180-
beforeAll(() => {
181-
isFeatureEnabledMock = jest
182-
.spyOn(uiCore, 'isFeatureEnabled')
183-
.mockImplementation(
184-
(featureFlag: FeatureFlag) =>
185-
featureFlag === FeatureFlag.DASHBOARD_NATIVE_FILTERS,
186-
);
187-
});
188-
189-
afterAll(() => {
190-
// @ts-ignore
191-
isFeatureEnabledMock.restore();
192-
});
193-
194-
it('should not render filter mapping in edit mode if explicit filter scopes undefined', async () => {
195-
setup(editModeOnProps);
196-
expect(screen.queryByText('Set filter mapping')).not.toBeInTheDocument();
197-
});
198-
199-
it('should render filter mapping in edit mode if explicit filter scopes defined', async () => {
200-
setup(editModeOnWithFilterScopesProps);
201-
expect(screen.getByText('Set filter mapping')).toBeInTheDocument();
202-
});
154+
test('should render filter mapping in edit mode if explicit filter scopes defined', async () => {
155+
setup(editModeOnWithFilterScopesProps);
156+
expect(screen.getByText('Set filter mapping')).toBeInTheDocument();
203157
});
204158

205159
test('should show the share actions', async () => {

superset-frontend/src/dashboard/components/Header/HeaderActionsDropdown/index.jsx

+9-18
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@
1919
import React from 'react';
2020
import PropTypes from 'prop-types';
2121
import { isEmpty } from 'lodash';
22-
import {
23-
isFeatureEnabled,
24-
FeatureFlag,
25-
SupersetClient,
26-
t,
27-
} from '@superset-ui/core';
22+
import { SupersetClient, t } from '@superset-ui/core';
2823
import { Menu } from 'src/components/Menu';
2924
import { URL_PARAMS } from 'src/constants';
3025
import ShareMenuItems from 'src/dashboard/components/menu/ShareMenuItems';
@@ -361,18 +356,14 @@ class HeaderActionsDropdown extends React.PureComponent {
361356
</Menu>
362357
)
363358
) : null}
364-
{editMode &&
365-
!(
366-
isFeatureEnabled(FeatureFlag.DASHBOARD_NATIVE_FILTERS) &&
367-
isEmpty(dashboardInfo?.metadata?.filter_scopes)
368-
) && (
369-
<Menu.Item key={MENU_KEYS.SET_FILTER_MAPPING}>
370-
<FilterScopeModal
371-
className="m-r-5"
372-
triggerNode={t('Set filter mapping')}
373-
/>
374-
</Menu.Item>
375-
)}
359+
{editMode && !isEmpty(dashboardInfo?.metadata?.filter_scopes) && (
360+
<Menu.Item key={MENU_KEYS.SET_FILTER_MAPPING}>
361+
<FilterScopeModal
362+
className="m-r-5"
363+
triggerNode={t('Set filter mapping')}
364+
/>
365+
</Menu.Item>
366+
)}
376367

377368
<Menu.Item key={MENU_KEYS.AUTOREFRESH_MODAL}>
378369
<RefreshIntervalModal

superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterBar.test.tsx

+1-10
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import userEvent from '@testing-library/user-event';
2323
import { stateWithoutNativeFilters } from 'spec/fixtures/mockStore';
2424
import * as mockCore from '@superset-ui/core';
2525
import { testWithId } from 'src/utils/testUtils';
26-
import { FeatureFlag, Preset } from '@superset-ui/core';
26+
import { Preset } from '@superset-ui/core';
2727
import { TimeFilterPlugin, SelectFilterPlugin } from 'src/filters/components';
2828
import fetchMock from 'fetch-mock';
2929
import { FilterBarOrientation } from 'src/dashboard/types';
@@ -73,11 +73,6 @@ const getModalTestId = testWithId<string>(FILTERS_CONFIG_MODAL_TEST_ID, true);
7373

7474
const FILTER_NAME = 'Time filter 1';
7575

76-
// @ts-ignore
77-
global.featureFlags = {
78-
[FeatureFlag.DASHBOARD_NATIVE_FILTERS]: true,
79-
};
80-
8176
const addFilterFlow = async () => {
8277
// open filter config modal
8378
userEvent.click(screen.getByTestId(getTestId('collapsable')));
@@ -291,10 +286,6 @@ describe('FilterBar', () => {
291286
});
292287

293288
it('create filter and apply it flow', async () => {
294-
// @ts-ignore
295-
global.featureFlags = {
296-
[FeatureFlag.DASHBOARD_NATIVE_FILTERS]: true,
297-
};
298289
renderWrapper(openedBarProps, stateWithoutNativeFilters);
299290
expect(screen.getByTestId(getTestId('apply-button'))).toBeDisabled();
300291

0 commit comments

Comments
 (0)