chore(DatasourceEditor): Create Datasource Legacy Editor Feature Flag (#18003)
* a lot of console logs * adding new feature flag for datasource editor
This commit is contained in:
parent
5e84fd19a9
commit
536ca1f62c
|
|
@ -31,6 +31,7 @@ export enum FeatureFlag {
|
|||
SQLLAB_BACKEND_PERSISTENCE = 'SQLLAB_BACKEND_PERSISTENCE',
|
||||
THUMBNAILS = 'THUMBNAILS',
|
||||
LISTVIEWS_DEFAULT_CARD_VIEW = 'LISTVIEWS_DEFAULT_CARD_VIEW',
|
||||
DISABLE_LEGACY_DATASOURCE_EDITOR = 'DISABLE_LEGACY_DATASOURCE_EDITOR',
|
||||
ENABLE_REACT_CRUD_VIEWS = 'ENABLE_REACT_CRUD_VIEWS',
|
||||
DISABLE_DATASET_SOURCE_EDIT = 'DISABLE_DATASET_SOURCE_EDIT',
|
||||
DISPLAY_MARKDOWN_HTML = 'DISPLAY_MARKDOWN_HTML',
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import { Provider } from 'react-redux';
|
|||
import fetchMock from 'fetch-mock';
|
||||
import thunk from 'redux-thunk';
|
||||
import sinon from 'sinon';
|
||||
import { supersetTheme, ThemeProvider } from '@superset-ui/core';
|
||||
import { supersetTheme, ThemeProvider, FeatureFlag } from '@superset-ui/core';
|
||||
|
||||
import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint';
|
||||
import Modal from 'src/components/Modal';
|
||||
|
|
@ -72,7 +72,9 @@ describe('DatasourceModal', () => {
|
|||
beforeEach(async () => {
|
||||
isFeatureEnabledMock = jest
|
||||
.spyOn(featureFlags, 'isFeatureEnabled')
|
||||
.mockReturnValue(true);
|
||||
.mockImplementation(
|
||||
featureFlag => featureFlag === FeatureFlag.ENABLE_REACT_CRUD_VIEWS,
|
||||
);
|
||||
fetchMock.reset();
|
||||
wrapper = await mountAndWait();
|
||||
});
|
||||
|
|
@ -117,6 +119,7 @@ describe('DatasourceModal', () => {
|
|||
});
|
||||
|
||||
it('renders a legacy data source btn', () => {
|
||||
featureFlags.DISABLE_LEGACY_DATASOURCE_EDITOR = false;
|
||||
expect(
|
||||
wrapper.find('button[data-test="datasource-modal-legacy-edit"]'),
|
||||
).toExist();
|
||||
|
|
|
|||
|
|
@ -183,6 +183,10 @@ const DatasourceModal: FunctionComponent<DatasourceModalProps> = ({
|
|||
});
|
||||
};
|
||||
|
||||
const showLegacyDatasourceEditor =
|
||||
isFeatureEnabled(FeatureFlag.ENABLE_REACT_CRUD_VIEWS) &&
|
||||
!isFeatureEnabled(FeatureFlag.DISABLE_LEGACY_DATASOURCE_EDITOR);
|
||||
|
||||
return (
|
||||
<StyledDatasourceModal
|
||||
show={show}
|
||||
|
|
@ -195,7 +199,7 @@ const DatasourceModal: FunctionComponent<DatasourceModalProps> = ({
|
|||
}
|
||||
footer={
|
||||
<>
|
||||
{isFeatureEnabled(FeatureFlag.ENABLE_REACT_CRUD_VIEWS) && (
|
||||
{showLegacyDatasourceEditor && (
|
||||
<Button
|
||||
buttonSize="small"
|
||||
buttonStyle="default"
|
||||
|
|
|
|||
|
|
@ -350,6 +350,10 @@ DEFAULT_FEATURE_FLAGS: Dict[str, bool] = {
|
|||
# When using a recent version of Druid that supports JOINs turn this on
|
||||
"DRUID_JOINS": False,
|
||||
"DYNAMIC_PLUGINS": False,
|
||||
# With Superset 2.0, we are updating the default so that the legacy datasource
|
||||
# editor no longer shows. Currently this is set to false so that the editor
|
||||
# option does show, but we will be depreciating it.
|
||||
"DISABLE_LEGACY_DATASOURCE_EDITOR": False,
|
||||
# For some security concerns, you may need to enforce CSRF protection on
|
||||
# all query request to explore_json endpoint. In Superset, we use
|
||||
# `flask-csrf <https://sjl.bitbucket.io/flask-csrf/>`_ add csrf protection
|
||||
|
|
|
|||
Loading…
Reference in New Issue