chore(welcome): harmonize submenu with other routes (#22803)

This commit is contained in:
Ville Brofeldt 2023-03-31 11:34:10 +03:00 committed by GitHub
parent db9ca20737
commit f6b5b658e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
52 changed files with 261 additions and 216 deletions

View File

@ -21,14 +21,10 @@ import { createStore, compose, applyMiddleware } from 'redux';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import thunkMiddleware from 'redux-thunk'; import thunkMiddleware from 'redux-thunk';
import { hot } from 'react-hot-loader/root'; import { hot } from 'react-hot-loader/root';
import { ThemeProvider } from '@superset-ui/core'; import { FeatureFlag, ThemeProvider } from '@superset-ui/core';
import { GlobalStyles } from 'src/GlobalStyles'; import { GlobalStyles } from 'src/GlobalStyles';
import QueryProvider from 'src/views/QueryProvider'; import QueryProvider from 'src/views/QueryProvider';
import { import { initFeatureFlags, isFeatureEnabled } from 'src/featureFlags';
initFeatureFlags,
isFeatureEnabled,
FeatureFlag,
} from 'src/featureFlags';
import setupExtensions from 'src/setup/setupExtensions'; import setupExtensions from 'src/setup/setupExtensions';
import getBootstrapData from 'src/utils/getBootstrapData'; import getBootstrapData from 'src/utils/getBootstrapData';
import logger from 'src/middleware/loggerMiddleware'; import logger from 'src/middleware/loggerMiddleware';

View File

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

View File

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

View File

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

View File

@ -29,7 +29,7 @@ import { CSSTransition } from 'react-transition-group';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import Split from 'react-split'; import Split from 'react-split';
import { css, t, styled, useTheme } from '@superset-ui/core'; import { css, FeatureFlag, styled, t, useTheme } from '@superset-ui/core';
import debounce from 'lodash/debounce'; import debounce from 'lodash/debounce';
import throttle from 'lodash/throttle'; import throttle from 'lodash/throttle';
import Modal from 'src/components/Modal'; import Modal from 'src/components/Modal';
@ -78,7 +78,7 @@ import {
LocalStorageKeys, LocalStorageKeys,
setItem, setItem,
} from 'src/utils/localStorageHelpers'; } from 'src/utils/localStorageHelpers';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import { EmptyStateBig } from 'src/components/EmptyState'; import { EmptyStateBig } from 'src/components/EmptyState';
import getBootstrapData from 'src/utils/getBootstrapData'; import getBootstrapData from 'src/utils/getBootstrapData';
import { isEmpty } from 'lodash'; import { isEmpty } from 'lodash';

View File

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

View File

@ -18,9 +18,14 @@
*/ */
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React from 'react'; import React from 'react';
import { styled, logging, t, ensureIsArray } from '@superset-ui/core'; import {
ensureIsArray,
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; FeatureFlag,
logging,
styled,
t,
} from '@superset-ui/core';
import { isFeatureEnabled } from 'src/featureFlags';
import { PLACEHOLDER_DATASOURCE } from 'src/dashboard/constants'; import { PLACEHOLDER_DATASOURCE } from 'src/dashboard/constants';
import Loading from 'src/components/Loading'; import Loading from 'src/components/Loading';
import { EmptyStateBig } from 'src/components/EmptyState'; import { EmptyStateBig } from 'src/components/EmptyState';

View File

@ -19,9 +19,9 @@
/* eslint no-undef: 'error' */ /* eslint no-undef: 'error' */
/* eslint no-param-reassign: ["error", { "props": false }] */ /* eslint no-param-reassign: ["error", { "props": false }] */
import moment from 'moment'; import moment from 'moment';
import { t, SupersetClient, isDefined } from '@superset-ui/core'; import { FeatureFlag, isDefined, SupersetClient, t } from '@superset-ui/core';
import { getControlsState } from 'src/explore/store'; import { getControlsState } from 'src/explore/store';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import { import {
getAnnotationJsonUrl, getAnnotationJsonUrl,
getExploreUrl, getExploreUrl,

View File

@ -24,7 +24,13 @@ import Card from 'src/components/Card';
import Alert from 'src/components/Alert'; import Alert from 'src/components/Alert';
import Badge from 'src/components/Badge'; import Badge from 'src/components/Badge';
import shortid from 'shortid'; import shortid from 'shortid';
import { styled, SupersetClient, t, withTheme } from '@superset-ui/core'; import {
FeatureFlag,
styled,
SupersetClient,
t,
withTheme,
} from '@superset-ui/core';
import { Select, AsyncSelect, Row, Col } from 'src/components'; import { Select, AsyncSelect, Row, Col } from 'src/components';
import { FormLabel } from 'src/components/Form'; import { FormLabel } from 'src/components/Form';
import Button from 'src/components/Button'; import Button from 'src/components/Button';
@ -42,7 +48,7 @@ import TextControl from 'src/explore/components/controls/TextControl';
import TextAreaControl from 'src/explore/components/controls/TextAreaControl'; import TextAreaControl from 'src/explore/components/controls/TextAreaControl';
import SpatialControl from 'src/explore/components/controls/SpatialControl'; import SpatialControl from 'src/explore/components/controls/SpatialControl';
import withToasts from 'src/components/MessageToasts/withToasts'; import withToasts from 'src/components/MessageToasts/withToasts';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import Icons from 'src/components/Icons'; import Icons from 'src/components/Icons';
import CollectionTable from './CollectionTable'; import CollectionTable from './CollectionTable';
import Fieldset from './Fieldset'; import Fieldset from './Fieldset';

View File

@ -19,11 +19,11 @@
import React, { FunctionComponent, useState, useRef } from 'react'; import React, { FunctionComponent, useState, useRef } from 'react';
import Alert from 'src/components/Alert'; import Alert from 'src/components/Alert';
import Button from 'src/components/Button'; import Button from 'src/components/Button';
import { styled, t, SupersetClient } from '@superset-ui/core'; import { FeatureFlag, styled, SupersetClient, t } from '@superset-ui/core';
import Modal from 'src/components/Modal'; import Modal from 'src/components/Modal';
import AsyncEsmComponent from 'src/components/AsyncEsmComponent'; import AsyncEsmComponent from 'src/components/AsyncEsmComponent';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import { getClientErrorObject } from 'src/utils/getClientErrorObject'; import { getClientErrorObject } from 'src/utils/getClientErrorObject';
import withToasts from 'src/components/MessageToasts/withToasts'; import withToasts from 'src/components/MessageToasts/withToasts';

View File

@ -20,11 +20,12 @@ import React, { useContext, useEffect, useReducer } from 'react';
import { import {
ChartMetadata, ChartMetadata,
defineSharedModules, defineSharedModules,
FeatureFlag,
getChartMetadataRegistry, getChartMetadataRegistry,
logging, logging,
makeApi, makeApi,
} from '@superset-ui/core'; } from '@superset-ui/core';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import { omitBy } from 'lodash'; import { omitBy } from 'lodash';
const metadataRegistry = getChartMetadataRegistry(); const metadataRegistry = getChartMetadataRegistry();

View File

@ -21,9 +21,10 @@ import { ActionCreators as UndoActionCreators } from 'redux-undo';
import rison from 'rison'; import rison from 'rison';
import { import {
ensureIsArray, ensureIsArray,
t, FeatureFlag,
SupersetClient,
getSharedLabelColor, getSharedLabelColor,
SupersetClient,
t,
} from '@superset-ui/core'; } from '@superset-ui/core';
import { import {
addChart, addChart,
@ -50,7 +51,7 @@ import serializeActiveFilterValues from 'src/dashboard/util/serializeActiveFilte
import serializeFilterScopes from 'src/dashboard/util/serializeFilterScopes'; import serializeFilterScopes from 'src/dashboard/util/serializeFilterScopes';
import { getActiveFilters } from 'src/dashboard/util/activeDashboardFilters'; import { getActiveFilters } from 'src/dashboard/util/activeDashboardFilters';
import { safeStringify } from 'src/utils/safeStringify'; import { safeStringify } from 'src/utils/safeStringify';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import { logEvent } from 'src/logger/actions'; import { logEvent } from 'src/logger/actions';
import { LOG_ACTIONS_CONFIRM_OVERWRITE_DASHBOARD_METADATA } from 'src/logger/LogUtils'; import { LOG_ACTIONS_CONFIRM_OVERWRITE_DASHBOARD_METADATA } from 'src/logger/LogUtils';
import { UPDATE_COMPONENTS_PARENTS_LIST } from './dashboardLayout'; import { UPDATE_COMPONENTS_PARENTS_LIST } from './dashboardLayout';

View File

@ -16,6 +16,8 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
/* eslint-disable camelcase */
import { FeatureFlag } from '@superset-ui/core';
import { chart } from 'src/components/Chart/chartReducer'; import { chart } from 'src/components/Chart/chartReducer';
import { initSliceEntities } from 'src/dashboard/reducers/sliceEntities'; import { initSliceEntities } from 'src/dashboard/reducers/sliceEntities';
import { getInitialState as getInitialNativeFilterState } from 'src/dashboard/reducers/nativeFilters'; import { getInitialState as getInitialNativeFilterState } from 'src/dashboard/reducers/nativeFilters';
@ -51,7 +53,7 @@ import { TIME_RANGE } from 'src/visualizations/FilterBox/FilterBox';
import { URL_PARAMS } from 'src/constants'; import { URL_PARAMS } from 'src/constants';
import { getUrlParam } from 'src/utils/urlUtils'; import { getUrlParam } from 'src/utils/urlUtils';
import { ResourceStatus } from 'src/hooks/apiResources/apiResources'; import { ResourceStatus } from 'src/hooks/apiResources/apiResources';
import { FeatureFlag, isFeatureEnabled } from '../../featureFlags'; import { isFeatureEnabled } from '../../featureFlags';
import extractUrlParams from '../util/extractUrlParams'; import extractUrlParams from '../util/extractUrlParams';
import { updateColorSchema } from './dashboardInfo'; import { updateColorSchema } from './dashboardInfo';
import updateComponentParentsList from '../util/updateComponentParentsList'; import updateComponentParentsList from '../util/updateComponentParentsList';

View File

@ -17,12 +17,12 @@
* under the License. * under the License.
*/ */
/* eslint camelcase: 0 */ /* eslint camelcase: 0 */
import { t, SupersetClient } from '@superset-ui/core'; import { FeatureFlag, SupersetClient, t } from '@superset-ui/core';
import rison from 'rison'; import rison from 'rison';
import { addDangerToast } from 'src/components/MessageToasts/actions'; import { addDangerToast } from 'src/components/MessageToasts/actions';
import { getClientErrorObject } from 'src/utils/getClientErrorObject'; import { getClientErrorObject } from 'src/utils/getClientErrorObject';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
export const SET_ALL_SLICES = 'SET_ALL_SLICES'; export const SET_ALL_SLICES = 'SET_ALL_SLICES';
const FETCH_SLICES_PAGE_SIZE = 200; const FETCH_SLICES_PAGE_SIZE = 200;

View File

@ -21,7 +21,8 @@ import React from 'react';
import fetchMock from 'fetch-mock'; import fetchMock from 'fetch-mock';
import { render } from 'spec/helpers/testing-library'; import { render } from 'spec/helpers/testing-library';
import { fireEvent, within } from '@testing-library/react'; import { fireEvent, within } from '@testing-library/react';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; import { FeatureFlag } from '@superset-ui/core';
import { isFeatureEnabled } from 'src/featureFlags';
import DashboardBuilder from 'src/dashboard/components/DashboardBuilder/DashboardBuilder'; import DashboardBuilder from 'src/dashboard/components/DashboardBuilder/DashboardBuilder';
import useStoredSidebarWidth from 'src/components/ResizableSidebar/useStoredSidebarWidth'; import useStoredSidebarWidth from 'src/components/ResizableSidebar/useStoredSidebarWidth';
import { import {

View File

@ -29,6 +29,7 @@ import React, {
import { import {
addAlpha, addAlpha,
css, css,
FeatureFlag,
JsonObject, JsonObject,
styled, styled,
t, t,
@ -57,7 +58,7 @@ import {
setDirectPathToChild, setDirectPathToChild,
setEditMode, setEditMode,
} from 'src/dashboard/actions/dashboardState'; } from 'src/dashboard/actions/dashboardState';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import { import {
deleteTopLevelTabs, deleteTopLevelTabs,
handleComponentDrop, handleComponentDrop,

View File

@ -17,7 +17,8 @@
* under the License. * under the License.
*/ */
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; import { FeatureFlag } from '@superset-ui/core';
import { isFeatureEnabled } from 'src/featureFlags';
import { useCallback, useEffect, useState } from 'react'; import { useCallback, useEffect, useState } from 'react';
import { URL_PARAMS } from 'src/constants'; import { URL_PARAMS } from 'src/constants';
import { getUrlParam } from 'src/utils/urlUtils'; import { getUrlParam } from 'src/utils/urlUtils';

View File

@ -18,7 +18,6 @@
*/ */
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import { supersetTheme } from '@superset-ui/core';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import { Store } from 'redux'; import { Store } from 'redux';
import * as SupersetUI from '@superset-ui/core'; import * as SupersetUI from '@superset-ui/core';
@ -36,7 +35,6 @@ import {
import { sliceId } from 'spec/fixtures/mockChartQueries'; import { sliceId } from 'spec/fixtures/mockChartQueries';
import { dashboardFilters } from 'spec/fixtures/mockDashboardFilters'; import { dashboardFilters } from 'spec/fixtures/mockDashboardFilters';
import { dashboardWithFilter } from 'spec/fixtures/mockDashboardLayout'; import { dashboardWithFilter } from 'spec/fixtures/mockDashboardLayout';
import { FeatureFlag } from 'src/featureFlags';
const defaultStore = getMockStoreWithFilters(); const defaultStore = getMockStoreWithFilters();
function setup(store: Store = defaultStore) { function setup(store: Store = defaultStore) {
@ -60,7 +58,9 @@ describe('FiltersBadge', () => {
// shallow rendering in enzyme doesn't propagate contexts correctly, // shallow rendering in enzyme doesn't propagate contexts correctly,
// so we have to mock the hook. // so we have to mock the hook.
// See https://medium.com/7shifts-engineering-blog/testing-usecontext-react-hook-with-enzyme-shallow-da062140fc83 // See https://medium.com/7shifts-engineering-blog/testing-usecontext-react-hook-with-enzyme-shallow-da062140fc83
jest.spyOn(SupersetUI, 'useTheme').mockImplementation(() => supersetTheme); jest
.spyOn(SupersetUI, 'useTheme')
.mockImplementation(() => SupersetUI.supersetTheme);
}); });
describe('for dashboard filters', () => { describe('for dashboard filters', () => {
@ -135,7 +135,7 @@ describe('FiltersBadge', () => {
it('shows the indicator when filters have been applied', () => { it('shows the indicator when filters have been applied', () => {
// @ts-ignore // @ts-ignore
global.featureFlags = { global.featureFlags = {
[FeatureFlag.DASHBOARD_NATIVE_FILTERS]: true, [SupersetUI.FeatureFlag.DASHBOARD_NATIVE_FILTERS]: true,
}; };
const store = getMockStoreWithNativeFilters(); const store = getMockStoreWithNativeFilters();
// start with basic dashboard state, dispatch an event to simulate query completion // start with basic dashboard state, dispatch an event to simulate query completion

View File

@ -20,7 +20,7 @@ import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { isEmpty } from 'lodash'; import { isEmpty } from 'lodash';
import { SupersetClient, t } from '@superset-ui/core'; import { FeatureFlag, SupersetClient, t } from '@superset-ui/core';
import { Menu } from 'src/components/Menu'; import { Menu } from 'src/components/Menu';
import { URL_PARAMS } from 'src/constants'; import { URL_PARAMS } from 'src/constants';
@ -37,7 +37,7 @@ import getDashboardUrl from 'src/dashboard/util/getDashboardUrl';
import { getActiveFilters } from 'src/dashboard/util/activeDashboardFilters'; import { getActiveFilters } from 'src/dashboard/util/activeDashboardFilters';
import { getUrlParam } from 'src/utils/urlUtils'; import { getUrlParam } from 'src/utils/urlUtils';
import { LOG_ACTIONS_DASHBOARD_DOWNLOAD_AS_IMAGE } from 'src/logger/LogUtils'; import { LOG_ACTIONS_DASHBOARD_DOWNLOAD_AS_IMAGE } from 'src/logger/LogUtils';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
const propTypes = { const propTypes = {
addSuccessToast: PropTypes.func.isRequired, addSuccessToast: PropTypes.func.isRequired,

View File

@ -23,12 +23,13 @@ import PropTypes from 'prop-types';
import { import {
styled, styled,
css, css,
FeatureFlag,
t, t,
getSharedLabelColor, getSharedLabelColor,
getUiOverrideRegistry, getUiOverrideRegistry,
} from '@superset-ui/core'; } from '@superset-ui/core';
import { Global } from '@emotion/react'; import { Global } from '@emotion/react';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import { import {
LOG_ACTIONS_PERIODIC_RENDER_DASHBOARD, LOG_ACTIONS_PERIODIC_RENDER_DASHBOARD,
LOG_ACTIONS_FORCE_REFRESH_DASHBOARD, LOG_ACTIONS_FORCE_REFRESH_DASHBOARD,

View File

@ -26,6 +26,7 @@ import rison from 'rison';
import { import {
CategoricalColorNamespace, CategoricalColorNamespace,
ensureIsArray, ensureIsArray,
FeatureFlag,
getCategoricalSchemeRegistry, getCategoricalSchemeRegistry,
getSharedLabelColor, getSharedLabelColor,
styled, styled,
@ -40,7 +41,7 @@ import ColorSchemeControlWrapper from 'src/dashboard/components/ColorSchemeContr
import FilterScopeModal from 'src/dashboard/components/filterscope/FilterScopeModal'; import FilterScopeModal from 'src/dashboard/components/filterscope/FilterScopeModal';
import { getClientErrorObject } from 'src/utils/getClientErrorObject'; import { getClientErrorObject } from 'src/utils/getClientErrorObject';
import withToasts from 'src/components/MessageToasts/withToasts'; import withToasts from 'src/components/MessageToasts/withToasts';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import TagType from 'src/types/TagType'; import TagType from 'src/types/TagType';
import { addTag, deleteTaggedObjects, fetchTags, OBJECT_TYPES } from 'src/tags'; import { addTag, deleteTaggedObjects, fetchTags, OBJECT_TYPES } from 'src/tags';
import { loadTags } from 'src/components/Tags/utils'; import { loadTags } from 'src/components/Tags/utils';

View File

@ -21,7 +21,7 @@ import userEvent from '@testing-library/user-event';
import React from 'react'; import React from 'react';
import { getMockStore } from 'spec/fixtures/mockStore'; import { getMockStore } from 'spec/fixtures/mockStore';
import { render, screen } from 'spec/helpers/testing-library'; import { render, screen } from 'spec/helpers/testing-library';
import { FeatureFlag } from 'src/featureFlags'; import { FeatureFlag } from '@superset-ui/core';
import SliceHeaderControls, { SliceHeaderControlsProps } from '.'; import SliceHeaderControls, { SliceHeaderControlsProps } from '.';
jest.mock('src/components/Dropdown', () => { jest.mock('src/components/Dropdown', () => {

View File

@ -30,12 +30,19 @@ import {
withRouter, withRouter,
} from 'react-router-dom'; } from 'react-router-dom';
import moment from 'moment'; import moment from 'moment';
import { css, QueryFormData, styled, t, useTheme } from '@superset-ui/core'; import {
css,
FeatureFlag,
QueryFormData,
styled,
t,
useTheme,
} from '@superset-ui/core';
import { Menu } from 'src/components/Menu'; import { Menu } from 'src/components/Menu';
import { NoAnimationDropdown } from 'src/components/Dropdown'; import { NoAnimationDropdown } from 'src/components/Dropdown';
import ShareMenuItems from 'src/dashboard/components/menu/ShareMenuItems'; import ShareMenuItems from 'src/dashboard/components/menu/ShareMenuItems';
import downloadAsImage from 'src/utils/downloadAsImage'; import downloadAsImage from 'src/utils/downloadAsImage';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import { getSliceHeaderTooltip } from 'src/dashboard/util/getSliceHeaderTooltip'; import { getSliceHeaderTooltip } from 'src/dashboard/util/getSliceHeaderTooltip';
import { Tooltip } from 'src/components/Tooltip'; import { Tooltip } from 'src/components/Tooltip';
import Icons from 'src/components/Icons'; import Icons from 'src/components/Icons';

View File

@ -23,8 +23,7 @@ import userEvent from '@testing-library/user-event';
import { stateWithoutNativeFilters } from 'spec/fixtures/mockStore'; import { stateWithoutNativeFilters } from 'spec/fixtures/mockStore';
import * as mockCore from '@superset-ui/core'; import * as mockCore from '@superset-ui/core';
import { testWithId } from 'src/utils/testUtils'; import { testWithId } from 'src/utils/testUtils';
import { FeatureFlag } from 'src/featureFlags'; import { FeatureFlag, Preset } from '@superset-ui/core';
import { Preset } from '@superset-ui/core';
import { TimeFilterPlugin, SelectFilterPlugin } from 'src/filters/components'; import { TimeFilterPlugin, SelectFilterPlugin } from 'src/filters/components';
import { DATE_FILTER_TEST_KEY } from 'src/explore/components/controls/DateFilterControl'; import { DATE_FILTER_TEST_KEY } from 'src/explore/components/controls/DateFilterControl';
import fetchMock from 'fetch-mock'; import fetchMock from 'fetch-mock';

View File

@ -24,22 +24,23 @@ import React, {
useState, useState,
} from 'react'; } from 'react';
import { import {
QueryFormData,
SuperChart,
DataMask,
t,
styled,
Behavior,
ChartDataResponseResult, ChartDataResponseResult,
JsonObject, Behavior,
DataMask,
FeatureFlag,
getChartMetadataRegistry, getChartMetadataRegistry,
JsonObject,
QueryFormData,
styled,
SuperChart,
t,
} from '@superset-ui/core'; } from '@superset-ui/core';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { isEqual, isEqualWith } from 'lodash'; import { isEqual, isEqualWith } from 'lodash';
import { getChartDataRequest } from 'src/components/Chart/chartAction'; import { getChartDataRequest } from 'src/components/Chart/chartAction';
import Loading from 'src/components/Loading'; import Loading from 'src/components/Loading';
import BasicErrorAlert from 'src/components/ErrorMessage/BasicErrorAlert'; import BasicErrorAlert from 'src/components/ErrorMessage/BasicErrorAlert';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import { waitForAsyncData } from 'src/middleware/asyncEvent'; import { waitForAsyncData } from 'src/middleware/asyncEvent';
import { ClientErrorObject } from 'src/utils/getClientErrorObject'; import { ClientErrorObject } from 'src/utils/getClientErrorObject';
import { FilterBarOrientation, RootState } from 'src/dashboard/types'; import { FilterBarOrientation, RootState } from 'src/dashboard/types';

View File

@ -28,10 +28,16 @@ import React, {
createContext, createContext,
} from 'react'; } from 'react';
import cx from 'classnames'; import cx from 'classnames';
import { HandlerFunction, styled, t, isNativeFilter } from '@superset-ui/core'; import {
FeatureFlag,
HandlerFunction,
isNativeFilter,
styled,
t,
} from '@superset-ui/core';
import Icons from 'src/components/Icons'; import Icons from 'src/components/Icons';
import { AntdTabs } from 'src/components'; import { AntdTabs } from 'src/components';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import Loading from 'src/components/Loading'; import Loading from 'src/components/Loading';
import { EmptyStateSmall } from 'src/components/EmptyState'; import { EmptyStateSmall } from 'src/components/EmptyState';
import { getFilterBarTestId } from './utils'; import { getFilterBarTestId } from './utils';

View File

@ -27,6 +27,7 @@ import {
Behavior, Behavior,
ChartDataResponseResult, ChartDataResponseResult,
Column, Column,
FeatureFlag,
Filter, Filter,
GenericDataType, GenericDataType,
getChartMetadataRegistry, getChartMetadataRegistry,
@ -69,7 +70,7 @@ import {
} from 'src/dashboard/types'; } from 'src/dashboard/types';
import DateFilterControl from 'src/explore/components/controls/DateFilterControl'; import DateFilterControl from 'src/explore/components/controls/DateFilterControl';
import AdhocFilterControl from 'src/explore/components/controls/FilterControl/AdhocFilterControl'; import AdhocFilterControl from 'src/explore/components/controls/FilterControl/AdhocFilterControl';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import { waitForAsyncData } from 'src/middleware/asyncEvent'; import { waitForAsyncData } from 'src/middleware/asyncEvent';
import { ClientErrorObject } from 'src/utils/getClientErrorObject'; import { ClientErrorObject } from 'src/utils/getClientErrorObject';
import { SingleValueType } from 'src/filters/components/Range/SingleValueType'; import { SingleValueType } from 'src/filters/components/Range/SingleValueType';

View File

@ -16,8 +16,13 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
import { DataMask, FilterConfiguration, Filters } from '@superset-ui/core'; import {
import { FeatureFlag, isFeatureEnabled } from '../featureFlags'; DataMask,
FeatureFlag,
FilterConfiguration,
Filters,
} from '@superset-ui/core';
import { isFeatureEnabled } from '../featureFlags';
import { getInitialDataMask } from './reducer'; import { getInitialDataMask } from './reducer';
export const CLEAR_DATA_MASK_STATE = 'CLEAR_DATA_MASK_STATE'; export const CLEAR_DATA_MASK_STATE = 'CLEAR_DATA_MASK_STATE';

View File

@ -23,10 +23,10 @@ import React, {
useState, useState,
MouseEvent, MouseEvent,
} from 'react'; } from 'react';
import { styled, t, useTheme } from '@superset-ui/core'; import { FeatureFlag, styled, t, useTheme } from '@superset-ui/core';
import Icons from 'src/components/Icons'; import Icons from 'src/components/Icons';
import Tabs from 'src/components/Tabs'; import Tabs from 'src/components/Tabs';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import { import {
getItem, getItem,
setItem, setItem,

View File

@ -19,7 +19,7 @@
import React from 'react'; import React from 'react';
import userEvent from '@testing-library/user-event'; import userEvent from '@testing-library/user-event';
import fetchMock from 'fetch-mock'; import fetchMock from 'fetch-mock';
import { FeatureFlag } from 'src/featureFlags'; import { FeatureFlag } from '@superset-ui/core';
import * as copyUtils from 'src/utils/copy'; import * as copyUtils from 'src/utils/copy';
import { import {
render, render,

View File

@ -19,11 +19,12 @@
import React, { useEffect, useMemo, useRef, useState } from 'react'; import React, { useEffect, useMemo, useRef, useState } from 'react';
import { import {
css, css,
styled,
t,
DatasourceType, DatasourceType,
FeatureFlag,
Metric, Metric,
QueryFormData, QueryFormData,
styled,
t,
} from '@superset-ui/core'; } from '@superset-ui/core';
import { ControlConfig, ColumnMeta } from '@superset-ui/chart-controls'; import { ControlConfig, ColumnMeta } from '@superset-ui/chart-controls';
@ -36,7 +37,7 @@ import { SaveDatasetModal } from 'src/SqlLab/components/SaveDatasetModal';
import { getDatasourceAsSaveableDataset } from 'src/utils/datasourceUtils'; import { getDatasourceAsSaveableDataset } from 'src/utils/datasourceUtils';
import { Input } from 'src/components/Input'; import { Input } from 'src/components/Input';
import { FAST_DEBOUNCE } from 'src/constants'; import { FAST_DEBOUNCE } from 'src/constants';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import { ExploreActions } from 'src/explore/actions/exploreActions'; import { ExploreActions } from 'src/explore/actions/exploreActions';
import Control from 'src/explore/components/Control'; import Control from 'src/explore/components/Control';
import DatasourcePanelDragOption from './DatasourcePanelDragOption'; import DatasourcePanelDragOption from './DatasourcePanelDragOption';

View File

@ -21,18 +21,19 @@ import PropTypes from 'prop-types';
import Split from 'react-split'; import Split from 'react-split';
import { import {
css, css,
DatasourceType,
ensureIsArray, ensureIsArray,
FeatureFlag,
getChartMetadataRegistry,
styled, styled,
SupersetClient, SupersetClient,
t, t,
useTheme, useTheme,
getChartMetadataRegistry,
DatasourceType,
} from '@superset-ui/core'; } from '@superset-ui/core';
import { useResizeDetector } from 'react-resize-detector'; import { useResizeDetector } from 'react-resize-detector';
import { chartPropShape } from 'src/dashboard/util/propShapes'; import { chartPropShape } from 'src/dashboard/util/propShapes';
import ChartContainer from 'src/components/Chart/ChartContainer'; import ChartContainer from 'src/components/Chart/ChartContainer';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import { import {
getItem, getItem,
setItem, setItem,

View File

@ -25,11 +25,12 @@ import { withRouter, RouteComponentProps } from 'react-router-dom';
import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls'; import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls';
import { import {
css, css,
t,
styled,
DatasourceType, DatasourceType,
isDefined,
ensureIsArray, ensureIsArray,
FeatureFlag,
isDefined,
styled,
t,
} from '@superset-ui/core'; } from '@superset-ui/core';
import { Input } from 'src/components/Input'; import { Input } from 'src/components/Input';
import { Form, FormItem } from 'src/components/Form'; import { Form, FormItem } from 'src/components/Form';
@ -41,7 +42,7 @@ import { Select } from 'src/components';
import Loading from 'src/components/Loading'; import Loading from 'src/components/Loading';
import { setSaveChartModalVisibility } from 'src/explore/actions/saveModalActions'; import { setSaveChartModalVisibility } from 'src/explore/actions/saveModalActions';
import { SaveActionType } from 'src/explore/types'; import { SaveActionType } from 'src/explore/types';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
// Session storage key for recent dashboard // Session storage key for recent dashboard
const SK_DASHBOARD_ID = 'save_chart_recent_dashboard'; const SK_DASHBOARD_ID = 'save_chart_recent_dashboard';

View File

@ -20,12 +20,13 @@ import React, { useEffect, useState } from 'react';
import FormItem from 'src/components/Form/FormItem'; import FormItem from 'src/components/Form/FormItem';
import { Select } from 'src/components'; import { Select } from 'src/components';
import { import {
t, FeatureFlag,
SupersetClient,
SupersetTheme,
styled,
hasGenericChartAxes, hasGenericChartAxes,
isDefined, isDefined,
styled,
SupersetClient,
SupersetTheme,
t,
} from '@superset-ui/core'; } from '@superset-ui/core';
import { import {
Operators, Operators,
@ -42,7 +43,7 @@ import AdhocFilter from 'src/explore/components/controls/FilterControl/AdhocFilt
import { Tooltip } from 'src/components/Tooltip'; import { Tooltip } from 'src/components/Tooltip';
import { Input } from 'src/components/Input'; import { Input } from 'src/components/Input';
import { optionLabel } from 'src/utils/common'; import { optionLabel } from 'src/utils/common';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import { import {
ColumnMeta, ColumnMeta,
Dataset, Dataset,

View File

@ -18,7 +18,7 @@
*/ */
import React, { useCallback, useMemo, useState } from 'react'; import React, { useCallback, useMemo, useState } from 'react';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { css, styled, t, useTheme } from '@superset-ui/core'; import { css, FeatureFlag, styled, t, useTheme } from '@superset-ui/core';
import Icons from 'src/components/Icons'; import Icons from 'src/components/Icons';
import { Menu } from 'src/components/Menu'; import { Menu } from 'src/components/Menu';
import ModalTrigger from 'src/components/ModalTrigger'; import ModalTrigger from 'src/components/ModalTrigger';
@ -29,7 +29,7 @@ import downloadAsImage from 'src/utils/downloadAsImage';
import { getChartPermalink } from 'src/utils/urlUtils'; import { getChartPermalink } from 'src/utils/urlUtils';
import copyTextToClipboard from 'src/utils/copy'; import copyTextToClipboard from 'src/utils/copy';
import HeaderReportDropDown from 'src/components/ReportModal/HeaderReportDropdown'; import HeaderReportDropDown from 'src/components/ReportModal/HeaderReportDropdown';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import ViewQueryModal from '../controls/ViewQueryModal'; import ViewQueryModal from '../controls/ViewQueryModal';
import EmbedCodeContent from '../EmbedCodeContent'; import EmbedCodeContent from '../EmbedCodeContent';
import DashboardsSubMenu from './DashboardsSubMenu'; import DashboardsSubMenu from './DashboardsSubMenu';

View File

@ -16,10 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
import { FeatureFlagMap, FeatureFlag } from '@superset-ui/core'; import { FeatureFlag, FeatureFlagMap } from '@superset-ui/core';
export { FeatureFlag } from '@superset-ui/core';
export type { FeatureFlagMap } from '@superset-ui/core';
export function initFeatureFlags(featureFlags?: FeatureFlagMap) { export function initFeatureFlags(featureFlags?: FeatureFlagMap) {
if (!window.featureFlags) { if (!window.featureFlags) {

View File

@ -18,13 +18,14 @@
*/ */
import { import {
ensureIsArray, ensureIsArray,
FeatureFlag,
makeApi, makeApi,
SupersetClient, SupersetClient,
logging, logging,
} from '@superset-ui/core'; } from '@superset-ui/core';
import { SupersetError } from 'src/components/ErrorMessage/types'; import { SupersetError } from 'src/components/ErrorMessage/types';
import getBootstrapData from 'src/utils/getBootstrapData'; import getBootstrapData from 'src/utils/getBootstrapData';
import { FeatureFlag, isFeatureEnabled } from '../featureFlags'; import { isFeatureEnabled } from '../featureFlags';
import { import {
getClientErrorObject, getClientErrorObject,
parseErrorJson, parseErrorJson,

View File

@ -20,11 +20,12 @@ import React, { ReactNode } from 'react';
import rison from 'rison'; import rison from 'rison';
import querystring from 'query-string'; import querystring from 'query-string';
import { import {
styled, FeatureFlag,
t,
SupersetClient,
JsonResponse,
isDefined, isDefined,
JsonResponse,
styled,
SupersetClient,
t,
} from '@superset-ui/core'; } from '@superset-ui/core';
import { getUrlParam } from 'src/utils/urlUtils'; import { getUrlParam } from 'src/utils/urlUtils';
import { URL_PARAMS } from 'src/constants'; import { URL_PARAMS } from 'src/constants';
@ -33,7 +34,7 @@ import Button from 'src/components/Button';
import { AsyncSelect, Steps } from 'src/components'; import { AsyncSelect, Steps } from 'src/components';
import { Tooltip } from 'src/components/Tooltip'; import { Tooltip } from 'src/components/Tooltip';
import withToasts from 'src/components/MessageToasts/withToasts'; import withToasts from 'src/components/MessageToasts/withToasts';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import VizTypeGallery, { import VizTypeGallery, {
MAX_ADVISABLE_VIZ_GALLERY_WIDTH, MAX_ADVISABLE_VIZ_GALLERY_WIDTH,

View File

@ -18,6 +18,7 @@
*/ */
import { import {
ensureIsArray, ensureIsArray,
FeatureFlag,
getChartMetadataRegistry, getChartMetadataRegistry,
JsonResponse, JsonResponse,
styled, styled,
@ -28,7 +29,7 @@ import React, { useState, useMemo, useCallback } from 'react';
import rison from 'rison'; import rison from 'rison';
import { uniqBy } from 'lodash'; import { uniqBy } from 'lodash';
import moment from 'moment'; import moment from 'moment';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import { import {
createErrorHandler, createErrorHandler,
createFetchRelated, createFetchRelated,

View File

@ -16,11 +16,11 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
import { styled, SupersetClient, t } from '@superset-ui/core'; import { FeatureFlag, styled, SupersetClient, t } from '@superset-ui/core';
import React, { useState, useMemo, useCallback } from 'react'; import React, { useState, useMemo, useCallback } from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import rison from 'rison'; import rison from 'rison';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import { import {
createFetchRelated, createFetchRelated,
createErrorHandler, createErrorHandler,

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
import { SupersetClient, t, styled } from '@superset-ui/core'; import { FeatureFlag, styled, SupersetClient, t } from '@superset-ui/core';
import React, { useState, useMemo, useEffect } from 'react'; import React, { useState, useMemo, useEffect } from 'react';
import rison from 'rison'; import rison from 'rison';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
@ -24,7 +24,7 @@ import { useQueryParams, BooleanParam } from 'use-query-params';
import { LocalStorageKeys, setItem } from 'src/utils/localStorageHelpers'; import { LocalStorageKeys, setItem } from 'src/utils/localStorageHelpers';
import Loading from 'src/components/Loading'; import Loading from 'src/components/Loading';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import { useListViewResource } from 'src/views/CRUD/hooks'; import { useListViewResource } from 'src/views/CRUD/hooks';
import { createErrorHandler, uploadUserPerms } from 'src/views/CRUD/utils'; import { createErrorHandler, uploadUserPerms } from 'src/views/CRUD/utils';
import withToasts from 'src/components/MessageToasts/withToasts'; import withToasts from 'src/components/MessageToasts/withToasts';

View File

@ -23,6 +23,7 @@ import fetchMock from 'fetch-mock';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import { styledMount as mount } from 'spec/helpers/theming'; import { styledMount as mount } from 'spec/helpers/theming';
import { render, screen, cleanup } from 'spec/helpers/testing-library'; import { render, screen, cleanup } from 'spec/helpers/testing-library';
import { FeatureFlag } from '@superset-ui/core';
import userEvent from '@testing-library/user-event'; import userEvent from '@testing-library/user-event';
import { QueryParamProvider } from 'use-query-params'; import { QueryParamProvider } from 'use-query-params';
import * as featureFlags from 'src/featureFlags'; import * as featureFlags from 'src/featureFlags';
@ -255,10 +256,7 @@ describe('RTL', () => {
return mounted; return mounted;
} }
let isFeatureEnabledMock: jest.SpyInstance< let isFeatureEnabledMock: jest.SpyInstance<boolean, [feature: FeatureFlag]>;
boolean,
[feature: featureFlags.FeatureFlag]
>;
beforeEach(async () => { beforeEach(async () => {
isFeatureEnabledMock = jest isFeatureEnabledMock = jest
.spyOn(featureFlags, 'isFeatureEnabled') .spyOn(featureFlags, 'isFeatureEnabled')

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
import { SupersetClient, t, styled } from '@superset-ui/core'; import { FeatureFlag, styled, SupersetClient, t } from '@superset-ui/core';
import React, { import React, {
FunctionComponent, FunctionComponent,
useState, useState,
@ -54,7 +54,7 @@ import FacePile from 'src/components/FacePile';
import CertifiedBadge from 'src/components/CertifiedBadge'; import CertifiedBadge from 'src/components/CertifiedBadge';
import InfoTooltip from 'src/components/InfoTooltip'; import InfoTooltip from 'src/components/InfoTooltip';
import ImportModelsModal from 'src/components/ImportModal/index'; import ImportModelsModal from 'src/components/ImportModal/index';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import WarningIconWithTooltip from 'src/components/WarningIconWithTooltip'; import WarningIconWithTooltip from 'src/components/WarningIconWithTooltip';
import { isUserAdmin } from 'src/dashboard/util/permissionUtils'; import { isUserAdmin } from 'src/dashboard/util/permissionUtils';
import { GenericLink } from 'src/components/GenericLink/GenericLink'; import { GenericLink } from 'src/components/GenericLink/GenericLink';

View File

@ -40,7 +40,7 @@ const chartFavoriteStatusEndpoint = 'glob:*/api/v1/chart/favorite_status?*';
const dashboardsEndpoint = 'glob:*/api/v1/dashboard/?*'; const dashboardsEndpoint = 'glob:*/api/v1/dashboard/?*';
const dashboardInfoEndpoint = 'glob:*/api/v1/dashboard/_info?*'; const dashboardInfoEndpoint = 'glob:*/api/v1/dashboard/_info?*';
const dashboardFavoriteStatusEndpoint = const dashboardFavoriteStatusEndpoint =
'glob:*/api/v1/dashboard/favorite_status?*'; 'glob:*/api/v1/dashboard/favorite_status/?*';
const savedQueryEndpoint = 'glob:*/api/v1/saved_query/?*'; const savedQueryEndpoint = 'glob:*/api/v1/saved_query/?*';
const savedQueryInfoEndpoint = 'glob:*/api/v1/saved_query/_info?*'; const savedQueryInfoEndpoint = 'glob:*/api/v1/saved_query/_info?*';
const recentActivityEndpoint = 'glob:*/api/v1/log/recent_activity/*'; const recentActivityEndpoint = 'glob:*/api/v1/log/recent_activity/*';

View File

@ -18,6 +18,7 @@
*/ */
import React, { useEffect, useMemo, useState } from 'react'; import React, { useEffect, useMemo, useState } from 'react';
import { import {
FeatureFlag,
getExtensionsRegistry, getExtensionsRegistry,
JsonObject, JsonObject,
styled, styled,
@ -28,26 +29,27 @@ import Collapse from 'src/components/Collapse';
import { User } from 'src/types/bootstrapTypes'; import { User } from 'src/types/bootstrapTypes';
import { reject } from 'lodash'; import { reject } from 'lodash';
import { import {
getItem,
dangerouslyGetItemDoNotUse, dangerouslyGetItemDoNotUse,
setItem,
dangerouslySetItemDoNotUse, dangerouslySetItemDoNotUse,
getItem,
LocalStorageKeys, LocalStorageKeys,
setItem,
} from 'src/utils/localStorageHelpers'; } from 'src/utils/localStorageHelpers';
import ListViewCard from 'src/components/ListViewCard'; import ListViewCard from 'src/components/ListViewCard';
import withToasts from 'src/components/MessageToasts/withToasts'; import withToasts from 'src/components/MessageToasts/withToasts';
import { import {
CardContainer,
createErrorHandler, createErrorHandler,
getRecentActivityObjs, getRecentActivityObjs,
mq,
CardContainer,
getUserOwnedObjects, getUserOwnedObjects,
loadingCardCount, loadingCardCount,
mq,
} from 'src/views/CRUD/utils'; } from 'src/views/CRUD/utils';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import { AntdSwitch } from 'src/components'; import { AntdSwitch } from 'src/components';
import getBootstrapData from 'src/utils/getBootstrapData'; import getBootstrapData from 'src/utils/getBootstrapData';
import { TableTab } from 'src/views/CRUD/types'; import { TableTab } from 'src/views/CRUD/types';
import SubMenu, { SubMenuProps } from 'src/views/components/SubMenu';
import { canUserAccessSqlLab } from 'src/dashboard/util/permissionUtils'; import { canUserAccessSqlLab } from 'src/dashboard/util/permissionUtils';
import { WelcomePageLastTab } from 'src/views/CRUD/welcome/types'; import { WelcomePageLastTab } from 'src/views/CRUD/welcome/types';
import ActivityTable from 'src/views/CRUD/welcome/ActivityTable'; import ActivityTable from 'src/views/CRUD/welcome/ActivityTable';
@ -125,23 +127,14 @@ const WelcomeContainer = styled.div`
const WelcomeNav = styled.div` const WelcomeNav = styled.div`
${({ theme }) => ` ${({ theme }) => `
display: flex;
justify-content: space-between;
height: 50px;
background-color: ${theme.colors.grayscale.light5};
.welcome-header {
font-size: ${theme.typography.sizes.l}px;
padding: ${theme.gridUnit * 4}px ${theme.gridUnit * 2 + 2}px;
margin: 0 ${theme.gridUnit * 2}px;
}
.switch { .switch {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
margin: ${theme.gridUnit * 4}px; margin: ${theme.gridUnit * 4}px;
span { span {
display: block; display: block;
margin: ${theme.gridUnit * 1}px; margin: ${theme.gridUnit}px;
line-height: 1; line-height: ${theme.gridUnit * 3.5}px;
} }
} }
`} `}
@ -171,7 +164,8 @@ function Welcome({ user, addDangerToast }: WelcomeProps) {
const [activeChild, setActiveChild] = useState('Loading'); const [activeChild, setActiveChild] = useState('Loading');
const userKey = dangerouslyGetItemDoNotUse(id, null); const userKey = dangerouslyGetItemDoNotUse(id, null);
let defaultChecked = false; let defaultChecked = false;
if (isFeatureEnabled(FeatureFlag.THUMBNAILS)) { const isThumbnailsEnabled = isFeatureEnabled(FeatureFlag.THUMBNAILS);
if (isThumbnailsEnabled) {
defaultChecked = defaultChecked =
userKey?.thumbnails === undefined ? true : userKey?.thumbnails; userKey?.thumbnails === undefined ? true : userKey?.thumbnails;
} }
@ -334,91 +328,107 @@ function Welcome({ user, addDangerToast }: WelcomeProps) {
const isRecentActivityLoading = const isRecentActivityLoading =
!activityData?.[TableTab.Other] && !activityData?.[TableTab.Viewed]; !activityData?.[TableTab.Other] && !activityData?.[TableTab.Viewed];
return ( const menuData: SubMenuProps = {
<WelcomeContainer> activeChild: 'Home',
{WelcomeMessageExtension && <WelcomeMessageExtension />} name: t('Home'),
{WelcomeTopExtension && <WelcomeTopExtension />} };
{WelcomeMainExtension && <WelcomeMainExtension />}
{(!WelcomeTopExtension || !WelcomeMainExtension) && ( if (isThumbnailsEnabled) {
<> menuData.buttons = [
{
name: (
<WelcomeNav> <WelcomeNav>
<h1 className="welcome-header">{t('Home')}</h1> <div className="switch">
{isFeatureEnabled(FeatureFlag.THUMBNAILS) ? ( <AntdSwitch checked={checked} onClick={handleToggle} />
<div className="switch"> <span>{t('Thumbnails')}</span>
<AntdSwitch checked={checked} onChange={handleToggle} /> </div>
<span>{t('Thumbnails')}</span>
</div>
) : null}
</WelcomeNav> </WelcomeNav>
<Collapse ),
activeKey={activeState} onClick: handleToggle,
onChange={handleCollapse} buttonStyle: 'link',
ghost },
bigger ];
> }
<Collapse.Panel header={t('Recents')} key="1">
{activityData && return (
(activityData[TableTab.Viewed] || <>
activityData[TableTab.Other] || <SubMenu {...menuData} />
activityData[TableTab.Created]) && <WelcomeContainer>
activeChild !== 'Loading' ? ( {WelcomeMessageExtension && <WelcomeMessageExtension />}
<ActivityTable {WelcomeTopExtension && <WelcomeTopExtension />}
user={{ userId: user.userId! }} // user is definitely not a guest user on this page {WelcomeMainExtension && <WelcomeMainExtension />}
activeChild={activeChild} {(!WelcomeTopExtension || !WelcomeMainExtension) && (
setActiveChild={setActiveChild} <>
activityData={activityData} <Collapse
isFetchingActivityData={isFetchingActivityData} activeKey={activeState}
/> onChange={handleCollapse}
) : ( ghost
<LoadingCards /> bigger
)} >
</Collapse.Panel> <Collapse.Panel header={t('Recents')} key="1">
<Collapse.Panel header={t('Dashboards')} key="2"> {activityData &&
{!dashboardData || isRecentActivityLoading ? ( (activityData[TableTab.Viewed] ||
<LoadingCards cover={checked} /> activityData[TableTab.Other] ||
) : ( activityData[TableTab.Created]) &&
<DashboardTable activeChild !== 'Loading' ? (
user={user} <ActivityTable
mine={dashboardData} user={{ userId: user.userId! }} // user is definitely not a guest user on this page
showThumbnails={checked} activeChild={activeChild}
otherTabData={activityData?.[TableTab.Other]} setActiveChild={setActiveChild}
otherTabFilters={otherTabFilters} activityData={activityData}
otherTabTitle={otherTabTitle} isFetchingActivityData={isFetchingActivityData}
/> />
)} ) : (
</Collapse.Panel> <LoadingCards />
<Collapse.Panel header={t('Charts')} key="3"> )}
{!chartData || isRecentActivityLoading ? ( </Collapse.Panel>
<LoadingCards cover={checked} /> <Collapse.Panel header={t('Dashboards')} key="2">
) : ( {!dashboardData || isRecentActivityLoading ? (
<ChartTable
showThumbnails={checked}
user={user}
mine={chartData}
otherTabData={activityData?.[TableTab.Other]}
otherTabFilters={otherTabFilters}
otherTabTitle={otherTabTitle}
/>
)}
</Collapse.Panel>
{canAccessSqlLab && (
<Collapse.Panel header={t('Saved queries')} key="4">
{!queryData ? (
<LoadingCards cover={checked} /> <LoadingCards cover={checked} />
) : ( ) : (
<SavedQueries <DashboardTable
showThumbnails={checked}
user={user} user={user}
mine={queryData} mine={dashboardData}
featureFlag={isFeatureEnabled(FeatureFlag.THUMBNAILS)} showThumbnails={checked}
otherTabData={activityData?.[TableTab.Other]}
otherTabFilters={otherTabFilters}
otherTabTitle={otherTabTitle}
/> />
)} )}
</Collapse.Panel> </Collapse.Panel>
)} <Collapse.Panel header={t('Charts')} key="3">
</Collapse> {!chartData || isRecentActivityLoading ? (
</> <LoadingCards cover={checked} />
)} ) : (
</WelcomeContainer> <ChartTable
showThumbnails={checked}
user={user}
mine={chartData}
otherTabData={activityData?.[TableTab.Other]}
otherTabFilters={otherTabFilters}
otherTabTitle={otherTabTitle}
/>
)}
</Collapse.Panel>
{canAccessSqlLab && (
<Collapse.Panel header={t('Saved queries')} key="4">
{!queryData ? (
<LoadingCards cover={checked} />
) : (
<SavedQueries
showThumbnails={checked}
user={user}
mine={queryData}
featureFlag={isThumbnailsEnabled}
/>
)}
</Collapse.Panel>
)}
</Collapse>
</>
)}
</WelcomeContainer>
</>
); );
} }

View File

@ -17,7 +17,7 @@
* under the License. * under the License.
*/ */
import { SupersetClient, t, styled } from '@superset-ui/core'; import { FeatureFlag, styled, SupersetClient, t } from '@superset-ui/core';
import React, { useState, useMemo, useCallback } from 'react'; import React, { useState, useMemo, useCallback } from 'react';
import rison from 'rison'; import rison from 'rison';
import moment from 'moment'; import moment from 'moment';
@ -49,7 +49,7 @@ import { commonMenuData } from 'src/views/CRUD/data/common';
import { SavedQueryObject } from 'src/views/CRUD/types'; import { SavedQueryObject } from 'src/views/CRUD/types';
import copyTextToClipboard from 'src/utils/copy'; import copyTextToClipboard from 'src/utils/copy';
import Tag from 'src/types/TagType'; import Tag from 'src/types/TagType';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import ImportModelsModal from 'src/components/ImportModal/index'; import ImportModelsModal from 'src/components/ImportModal/index';
import Icons from 'src/components/Icons'; import Icons from 'src/components/Icons';
import { BootstrapUser } from 'src/types/bootstrapTypes'; import { BootstrapUser } from 'src/types/bootstrapTypes';

View File

@ -16,9 +16,9 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
import { t } from '@superset-ui/core'; import { FeatureFlag, t } from '@superset-ui/core';
import React, { useMemo, useCallback } from 'react'; import React, { useMemo, useCallback } from 'react';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import { import {
createFetchRelated, createFetchRelated,
createErrorHandler, createErrorHandler,

View File

@ -16,11 +16,8 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
import { import { FeatureFlag } from '@superset-ui/core';
initFeatureFlags, import { initFeatureFlags, isFeatureEnabled } from 'src/featureFlags';
isFeatureEnabled,
FeatureFlag,
} from 'src/featureFlags';
import getBootstrapData from './getBootstrapData'; import getBootstrapData from './getBootstrapData';
function getDomainsConfig() { function getDomainsConfig() {

View File

@ -24,11 +24,12 @@ import React, {
useCallback, useCallback,
} from 'react'; } from 'react';
import { import {
styled,
t,
SupersetClient,
css, css,
FeatureFlag,
styled,
SupersetClient,
SupersetTheme, SupersetTheme,
t,
} from '@superset-ui/core'; } from '@superset-ui/core';
import rison from 'rison'; import rison from 'rison';
import { useSingleViewResource } from 'src/views/CRUD/hooks'; import { useSingleViewResource } from 'src/views/CRUD/hooks';
@ -39,7 +40,7 @@ import Modal from 'src/components/Modal';
import TimezoneSelector from 'src/components/TimezoneSelector'; import TimezoneSelector from 'src/components/TimezoneSelector';
import { Radio } from 'src/components/Radio'; import { Radio } from 'src/components/Radio';
import { propertyComparator } from 'src/components/Select/utils'; import { propertyComparator } from 'src/components/Select/utils';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import withToasts from 'src/components/MessageToasts/withToasts'; import withToasts from 'src/components/MessageToasts/withToasts';
import Owner from 'src/types/Owner'; import Owner from 'src/types/Owner';
import { AntdCheckbox, AsyncSelect, Select } from 'src/components'; import { AntdCheckbox, AsyncSelect, Select } from 'src/components';

View File

@ -17,9 +17,9 @@
* under the License. * under the License.
*/ */
import React from 'react'; import React from 'react';
import { t, useTheme } from '@superset-ui/core'; import { FeatureFlag, t, useTheme } from '@superset-ui/core';
import { Link, useHistory } from 'react-router-dom'; import { Link, useHistory } from 'react-router-dom';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; import ConfirmStatusChange from 'src/components/ConfirmStatusChange';
import Icons from 'src/components/Icons'; import Icons from 'src/components/Icons';
import Chart from 'src/types/Chart'; import Chart from 'src/types/Chart';

View File

@ -18,9 +18,9 @@
*/ */
import React from 'react'; import React from 'react';
import { Link, useHistory } from 'react-router-dom'; import { Link, useHistory } from 'react-router-dom';
import { t, useTheme } from '@superset-ui/core'; import { FeatureFlag, t, useTheme } from '@superset-ui/core';
import { isFeatureEnabled } from 'src/featureFlags';
import { CardStyles } from 'src/views/CRUD/utils'; import { CardStyles } from 'src/views/CRUD/utils';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
import { AntdDropdown } from 'src/components'; import { AntdDropdown } from 'src/components';
import { Menu } from 'src/components/Menu'; import { Menu } from 'src/components/Menu';
import ListViewCard from 'src/components/ListViewCard'; import ListViewCard from 'src/components/ListViewCard';

View File

@ -18,9 +18,9 @@
*/ */
import React from 'react'; import React from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { t, useTheme } from '@superset-ui/core'; import { FeatureFlag, t, useTheme } from '@superset-ui/core';
import { CardStyles } from 'src/views/CRUD/utils'; import { CardStyles } from 'src/views/CRUD/utils';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; import { isFeatureEnabled } from 'src/featureFlags';
import { AntdDropdown } from 'src/components'; import { AntdDropdown } from 'src/components';
import { Menu } from 'src/components/Menu'; import { Menu } from 'src/components/Menu';
import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; import ConfirmStatusChange from 'src/components/ConfirmStatusChange';