From c27fcb1f46a664058536d131ca30778375b24190 Mon Sep 17 00:00:00 2001 From: "Michael S. Molina" <70410625+michael-s-molina@users.noreply.github.com> Date: Tue, 16 Jan 2024 09:29:41 -0300 Subject: [PATCH] refactor: Removes the deprecated DISABLE_DATASET_SOURCE_EDIT feature flag (#26331) --- RESOURCES/FEATURE_FLAGS.md | 1 - UPDATING.md | 2 ++ .../src/utils/featureFlags.ts | 1 - .../Datasource/DatasourceEditor.jsx | 33 ++++++++----------- .../Datasource/DatasourceEditor.test.jsx | 16 --------- superset/config.py | 1 - superset/views/base.py | 1 - 7 files changed, 16 insertions(+), 39 deletions(-) diff --git a/RESOURCES/FEATURE_FLAGS.md b/RESOURCES/FEATURE_FLAGS.md index d029ca6c3cbd6..da0c50deb6733 100644 --- a/RESOURCES/FEATURE_FLAGS.md +++ b/RESOURCES/FEATURE_FLAGS.md @@ -91,7 +91,6 @@ These features flags currently default to True and **will be removed in a future - DASHBOARD_FILTERS_EXPERIMENTAL - DASHBOARD_NATIVE_FILTERS - DASHBOARD_NATIVE_FILTERS_SET -- DISABLE_DATASET_SOURCE_EDIT - ENABLE_EXPLORE_DRAG_AND_DROP - ENABLE_EXPLORE_JSON_CSRF_PROTECTION - ENABLE_TEMPLATE_REMOVE_FILTERS diff --git a/UPDATING.md b/UPDATING.md index 79c2e09286261..ad18b1e0e6be9 100644 --- a/UPDATING.md +++ b/UPDATING.md @@ -29,6 +29,8 @@ assists people when migrating to a new version. ### Breaking Changes +- [26331](https://github.com/apache/superset/issues/26331): Removes the deprecated `DISABLE_DATASET_SOURCE_EDIT` feature flag. The previous value of the feature flag was `False` and now the feature is permanently removed. + ### Potential Downtime - [26416](https://github.com/apache/superset/pull/26416): adds 2 database indexes to report_execution_log and 1 to report_recipient to improve performance, this may cause downtime on large deployments. 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 6bc77e0e87a1a..e3ad0a5d126d6 100644 --- a/superset-frontend/packages/superset-ui-core/src/utils/featureFlags.ts +++ b/superset-frontend/packages/superset-ui-core/src/utils/featureFlags.ts @@ -34,7 +34,6 @@ export enum FeatureFlag { DASHBOARD_VIRTUALIZATION = 'DASHBOARD_VIRTUALIZATION', DASHBOARD_RBAC = 'DASHBOARD_RBAC', DATAPANEL_CLOSED_BY_DEFAULT = 'DATAPANEL_CLOSED_BY_DEFAULT', - DISABLE_DATASET_SOURCE_EDIT = 'DISABLE_DATASET_SOURCE_EDIT', DISABLE_LEGACY_DATASOURCE_EDITOR = 'DISABLE_LEGACY_DATASOURCE_EDITOR', DRILL_TO_DETAIL = 'DRILL_TO_DETAIL', DRILL_BY = 'DRILL_BY', diff --git a/superset-frontend/src/components/Datasource/DatasourceEditor.jsx b/superset-frontend/src/components/Datasource/DatasourceEditor.jsx index 751001297a92a..e4a4d0116a098 100644 --- a/superset-frontend/src/components/Datasource/DatasourceEditor.jsx +++ b/superset-frontend/src/components/Datasource/DatasourceEditor.jsx @@ -629,9 +629,6 @@ class DatasourceEditor extends React.PureComponent { this.setColumns = this.setColumns.bind(this); this.validateAndChange = this.validateAndChange.bind(this); this.handleTabSelect = this.handleTabSelect.bind(this); - this.allowEditSource = !isFeatureEnabled( - FeatureFlag.DISABLE_DATASET_SOURCE_EDIT, - ); this.currencies = ensureIsArray(props.currencies).map(currencyCode => ({ value: currencyCode, label: `${getCurrencySymbol({ @@ -1050,23 +1047,21 @@ class DatasourceEditor extends React.PureComponent { const { datasource } = this.state; return (
- {this.allowEditSource && ( - - - {this.state.isEditMode ? ( - - ) : ( - - )} - - {!this.state.isEditMode && ( -
{t('Click the lock to make changes.')}
- )} - {this.state.isEditMode && ( -
{t('Click the lock to prevent further changes.')}
+ + + {this.state.isEditMode ? ( + + ) : ( + )} - - )} + + {!this.state.isEditMode && ( +
{t('Click the lock to make changes.')}
+ )} + {this.state.isEditMode && ( +
{t('Click the lock to prevent further changes.')}
+ )} +
{DATASOURCE_TYPES_ARR.map(type => ( { expect(virtualRadioBtn).toBeDisabled(); }); }); - - describe('render editor with feature flag false', () => { - beforeAll(() => { - isFeatureEnabledMock = jest - .spyOn(uiCore, 'isFeatureEnabled') - .mockImplementation(() => true); - }); - - it('disable edit Source tab', async () => { - await asyncRender(props); - expect( - screen.queryByRole('img', { name: /lock-locked/i }), - ).not.toBeInTheDocument(); - isFeatureEnabledMock.mockRestore(); - }); - }); }); describe('DatasourceEditor RTL', () => { diff --git a/superset/config.py b/superset/config.py index 348baef5454af..37ed0004fec94 100644 --- a/superset/config.py +++ b/superset/config.py @@ -404,7 +404,6 @@ class D3Format(TypedDict, total=False): DEFAULT_FEATURE_FLAGS: dict[str, bool] = { # Experimental feature introducing a client (browser) cache "CLIENT_CACHE": False, # deprecated - "DISABLE_DATASET_SOURCE_EDIT": False, # deprecated # When using a recent version of Druid that supports JOINs turn this on "DRUID_JOINS": False, "DYNAMIC_PLUGINS": False, diff --git a/superset/views/base.py b/superset/views/base.py index 9149c7ad919ac..db9ee645afc14 100644 --- a/superset/views/base.py +++ b/superset/views/base.py @@ -88,7 +88,6 @@ "SUPERSET_DASHBOARD_POSITION_DATA_LIMIT", "SUPERSET_DASHBOARD_PERIODICAL_REFRESH_LIMIT", "SUPERSET_DASHBOARD_PERIODICAL_REFRESH_WARNING_MESSAGE", - "DISABLE_DATASET_SOURCE_EDIT", "ENABLE_JAVASCRIPT_CONTROLS", "DEFAULT_SQLLAB_LIMIT", "DEFAULT_VIZ_TYPE",