chore: Removes duplicated featureFlags.ts (#24935)

(cherry picked from commit 284c12697b)
This commit is contained in:
Michael S. Molina
2023-08-10 10:55:44 -03:00
committed by Michael S. Molina
parent 1e20c0bf8a
commit 2574e11544
71 changed files with 224 additions and 202 deletions

View File

@@ -20,9 +20,13 @@ import React from 'react';
import persistState from 'redux-localstorage';
import { Provider } from 'react-redux';
import { hot } from 'react-hot-loader/root';
import { FeatureFlag, ThemeProvider } from '@superset-ui/core';
import {
FeatureFlag,
ThemeProvider,
initFeatureFlags,
isFeatureEnabled,
} from '@superset-ui/core';
import { GlobalStyles } from 'src/GlobalStyles';
import { initFeatureFlags, isFeatureEnabled } from 'src/featureFlags';
import { setupStore } from 'src/views/store';
import setupExtensions from 'src/setup/setupExtensions';
import getBootstrapData from 'src/utils/getBootstrapData';

View File

@@ -18,10 +18,14 @@
*/
import shortid from 'shortid';
import rison from 'rison';
import { FeatureFlag, SupersetClient, t } from '@superset-ui/core';
import {
FeatureFlag,
SupersetClient,
t,
isFeatureEnabled,
} from '@superset-ui/core';
import invert from 'lodash/invert';
import mapKeys from 'lodash/mapKeys';
import { isFeatureEnabled } from 'src/featureFlags';
import { now } from 'src/utils/dates';
import {

View File

@@ -22,7 +22,7 @@ import fetchMock from 'fetch-mock';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import shortid from 'shortid';
import * as featureFlags from 'src/featureFlags';
import * as uiCore from '@superset-ui/core';
import * as actions from 'src/SqlLab/actions/sqlLab';
import { LOG_EVENT } from 'src/logger/actions';
import {
@@ -492,7 +492,7 @@ describe('async actions', () => {
beforeEach(() => {
isFeatureEnabledMock = jest
.spyOn(featureFlags, 'isFeatureEnabled')
.spyOn(uiCore, 'isFeatureEnabled')
.mockImplementation(
feature => feature === 'SQLLAB_BACKEND_PERSISTENCE',
);
@@ -758,7 +758,7 @@ describe('async actions', () => {
describe('with backend persistence flag off', () => {
it('does not update the tab state in the backend', () => {
const backendPersistenceOffMock = jest
.spyOn(featureFlags, 'isFeatureEnabled')
.spyOn(uiCore, 'isFeatureEnabled')
.mockImplementation(
feature => !(feature === 'SQLLAB_BACKEND_PERSISTENCE'),
);

View File

@@ -20,7 +20,7 @@ import React from 'react';
import configureStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import fetchMock from 'fetch-mock';
import * as featureFlags from 'src/featureFlags';
import * as uiCore from '@superset-ui/core';
import { Provider } from 'react-redux';
import { supersetTheme, ThemeProvider } from '@superset-ui/core';
import { render, screen, act } from '@testing-library/react';
@@ -108,7 +108,7 @@ describe('ShareSqlLabQuery', () => {
describe('via /kv/store', () => {
beforeAll(() => {
isFeatureEnabledMock = jest
.spyOn(featureFlags, 'isFeatureEnabled')
.spyOn(uiCore, 'isFeatureEnabled')
.mockImplementation(() => true);
});
@@ -150,7 +150,7 @@ describe('ShareSqlLabQuery', () => {
describe('via saved query', () => {
beforeAll(() => {
isFeatureEnabledMock = jest
.spyOn(featureFlags, 'isFeatureEnabled')
.spyOn(uiCore, 'isFeatureEnabled')
.mockImplementation(() => false);
});

View File

@@ -17,14 +17,19 @@
* under the License.
*/
import React from 'react';
import { FeatureFlag, styled, t, useTheme } from '@superset-ui/core';
import {
FeatureFlag,
styled,
t,
useTheme,
isFeatureEnabled,
} from '@superset-ui/core';
import Button from 'src/components/Button';
import Icons from 'src/components/Icons';
import withToasts from 'src/components/MessageToasts/withToasts';
import CopyToClipboard from 'src/components/CopyToClipboard';
import { storeQuery } from 'src/utils/common';
import { getClientErrorObject } from 'src/utils/getClientErrorObject';
import { isFeatureEnabled } from 'src/featureFlags';
import useQueryEditor from 'src/SqlLab/hooks/useQueryEditor';
interface ShareSqlLabQueryProps {

View File

@@ -22,10 +22,9 @@ import shortid from 'shortid';
import Alert from 'src/components/Alert';
import Tabs from 'src/components/Tabs';
import { EmptyStateMedium } from 'src/components/EmptyState';
import { FeatureFlag, styled, t } from '@superset-ui/core';
import { FeatureFlag, styled, t, isFeatureEnabled } from '@superset-ui/core';
import { setActiveSouthPaneTab } from 'src/SqlLab/actions/sqlLab';
import { isFeatureEnabled } from 'src/featureFlags';
import Label from 'src/components/Label';
import { SqlLabRootState } from 'src/SqlLab/types';

View File

@@ -33,6 +33,7 @@ import Split from 'react-split';
import {
css,
FeatureFlag,
isFeatureEnabled,
styled,
t,
useTheme,
@@ -84,7 +85,6 @@ import {
LocalStorageKeys,
setItem,
} from 'src/utils/localStorageHelpers';
import { isFeatureEnabled } from 'src/featureFlags';
import { EmptyStateBig } from 'src/components/EmptyState';
import getBootstrapData from 'src/utils/getBootstrapData';
import { isEmpty } from 'lodash';

View File

@@ -23,8 +23,7 @@ import { EditableTabs } from 'src/components/Tabs';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import URI from 'urijs';
import { FeatureFlag, styled, t } from '@superset-ui/core';
import { isFeatureEnabled } from 'src/featureFlags';
import { FeatureFlag, styled, t, isFeatureEnabled } from '@superset-ui/core';
import { Tooltip } from 'src/components/Tooltip';
import { detectOS } from 'src/utils/common';
import * as Actions from 'src/SqlLab/actions/sqlLab';

View File

@@ -18,7 +18,7 @@
*/
import React from 'react';
import fetchMock from 'fetch-mock';
import * as featureFlags from 'src/featureFlags';
import * as uiCore from '@superset-ui/core';
import { FeatureFlag } from '@superset-ui/core';
import TableElement, { Column } from 'src/SqlLab/components/TableElement';
import { table, initialState } from 'src/SqlLab/fixtures';
@@ -140,7 +140,7 @@ test('removes the table', async () => {
const updateTableSchemaEndpoint = 'glob:*/tableschemaview/*';
fetchMock.delete(updateTableSchemaEndpoint, {});
const isFeatureEnabledMock = jest
.spyOn(featureFlags, 'isFeatureEnabled')
.spyOn(uiCore, 'isFeatureEnabled')
.mockImplementation(
featureFlag => featureFlag === FeatureFlag.SQLLAB_BACKEND_PERSISTENCE,
);