Skip to content

Commit

Permalink
chore(welcome): harmonize submenu with other routes (#22803)
Browse files Browse the repository at this point in the history
  • Loading branch information
villebro authored Mar 31, 2023
1 parent db9ca20 commit f6b5b65
Show file tree
Hide file tree
Showing 52 changed files with 257 additions and 212 deletions.
8 changes: 2 additions & 6 deletions superset-frontend/src/SqlLab/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,10 @@ import { createStore, compose, applyMiddleware } from 'redux';
import { Provider } from 'react-redux';
import thunkMiddleware from 'redux-thunk';
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 QueryProvider from 'src/views/QueryProvider';
import {
initFeatureFlags,
isFeatureEnabled,
FeatureFlag,
} from 'src/featureFlags';
import { initFeatureFlags, isFeatureEnabled } from 'src/featureFlags';
import setupExtensions from 'src/setup/setupExtensions';
import getBootstrapData from 'src/utils/getBootstrapData';
import logger from 'src/middleware/loggerMiddleware';
Expand Down
4 changes: 2 additions & 2 deletions superset-frontend/src/SqlLab/actions/sqlLab.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
*/
import shortid from 'shortid';
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 mapKeys from 'lodash/mapKeys';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
import { isFeatureEnabled } from 'src/featureFlags';

import { now } from 'src/utils/dates';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
* under the License.
*/
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 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 { FeatureFlag, isFeatureEnabled } from 'src/featureFlags';
import { isFeatureEnabled } from 'src/featureFlags';
import useQueryEditor from 'src/SqlLab/hooks/useQueryEditor';

interface ShareSqlLabQueryProps {
Expand Down
4 changes: 2 additions & 2 deletions superset-frontend/src/SqlLab/components/SouthPane/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import shortid from 'shortid';
import Alert from 'src/components/Alert';
import Tabs from 'src/components/Tabs';
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 { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
import { isFeatureEnabled } from 'src/featureFlags';

import Label from 'src/components/Label';
import { SqlLabRootState } from 'src/SqlLab/types';
Expand Down
4 changes: 2 additions & 2 deletions superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { CSSTransition } from 'react-transition-group';
import { useDispatch, useSelector } from 'react-redux';
import PropTypes from 'prop-types';
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 throttle from 'lodash/throttle';
import Modal from 'src/components/Modal';
Expand Down Expand Up @@ -78,7 +78,7 @@ import {
LocalStorageKeys,
setItem,
} from 'src/utils/localStorageHelpers';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags';
import { isFeatureEnabled } from 'src/featureFlags';
import { EmptyStateBig } from 'src/components/EmptyState';
import getBootstrapData from 'src/utils/getBootstrapData';
import { isEmpty } from 'lodash';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import { EditableTabs } from 'src/components/Tabs';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import URI from 'urijs';
import { styled, t } from '@superset-ui/core';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
import { FeatureFlag, styled, t } from '@superset-ui/core';
import { isFeatureEnabled } from 'src/featureFlags';
import { Tooltip } from 'src/components/Tooltip';
import { detectOS } from 'src/utils/common';
import * as Actions from 'src/SqlLab/actions/sqlLab';
Expand Down
11 changes: 8 additions & 3 deletions superset-frontend/src/components/Chart/Chart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@
*/
import PropTypes from 'prop-types';
import React from 'react';
import { styled, logging, t, ensureIsArray } from '@superset-ui/core';

import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
import {
ensureIsArray,
FeatureFlag,
logging,
styled,
t,
} from '@superset-ui/core';
import { isFeatureEnabled } from 'src/featureFlags';
import { PLACEHOLDER_DATASOURCE } from 'src/dashboard/constants';
import Loading from 'src/components/Loading';
import { EmptyStateBig } from 'src/components/EmptyState';
Expand Down
4 changes: 2 additions & 2 deletions superset-frontend/src/components/Chart/chartAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
/* eslint no-undef: 'error' */
/* eslint no-param-reassign: ["error", { "props": false }] */
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 { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
import { isFeatureEnabled } from 'src/featureFlags';
import {
getAnnotationJsonUrl,
getExploreUrl,
Expand Down
10 changes: 8 additions & 2 deletions superset-frontend/src/components/Datasource/DatasourceEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ import Card from 'src/components/Card';
import Alert from 'src/components/Alert';
import Badge from 'src/components/Badge';
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 { FormLabel } from 'src/components/Form';
import Button from 'src/components/Button';
Expand All @@ -42,7 +48,7 @@ import TextControl from 'src/explore/components/controls/TextControl';
import TextAreaControl from 'src/explore/components/controls/TextAreaControl';
import SpatialControl from 'src/explore/components/controls/SpatialControl';
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 CollectionTable from './CollectionTable';
import Fieldset from './Fieldset';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
import React, { FunctionComponent, useState, useRef } from 'react';
import Alert from 'src/components/Alert';
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 AsyncEsmComponent from 'src/components/AsyncEsmComponent';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
import { isFeatureEnabled } from 'src/featureFlags';

import { getClientErrorObject } from 'src/utils/getClientErrorObject';
import withToasts from 'src/components/MessageToasts/withToasts';
Expand Down
3 changes: 2 additions & 1 deletion superset-frontend/src/components/DynamicPlugins/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ import React, { useContext, useEffect, useReducer } from 'react';
import {
ChartMetadata,
defineSharedModules,
FeatureFlag,
getChartMetadataRegistry,
logging,
makeApi,
} from '@superset-ui/core';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags';
import { isFeatureEnabled } from 'src/featureFlags';
import { omitBy } from 'lodash';

const metadataRegistry = getChartMetadataRegistry();
Expand Down
7 changes: 4 additions & 3 deletions superset-frontend/src/dashboard/actions/dashboardState.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ import { ActionCreators as UndoActionCreators } from 'redux-undo';
import rison from 'rison';
import {
ensureIsArray,
t,
SupersetClient,
FeatureFlag,
getSharedLabelColor,
SupersetClient,
t,
} from '@superset-ui/core';
import {
addChart,
Expand All @@ -50,7 +51,7 @@ import serializeActiveFilterValues from 'src/dashboard/util/serializeActiveFilte
import serializeFilterScopes from 'src/dashboard/util/serializeFilterScopes';
import { getActiveFilters } from 'src/dashboard/util/activeDashboardFilters';
import { safeStringify } from 'src/utils/safeStringify';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags';
import { isFeatureEnabled } from 'src/featureFlags';
import { logEvent } from 'src/logger/actions';
import { LOG_ACTIONS_CONFIRM_OVERWRITE_DASHBOARD_METADATA } from 'src/logger/LogUtils';
import { UPDATE_COMPONENTS_PARENTS_LIST } from './dashboardLayout';
Expand Down
4 changes: 3 additions & 1 deletion superset-frontend/src/dashboard/actions/hydrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
/* eslint-disable camelcase */
import { FeatureFlag } from '@superset-ui/core';
import { chart } from 'src/components/Chart/chartReducer';
import { initSliceEntities } from 'src/dashboard/reducers/sliceEntities';
import { getInitialState as getInitialNativeFilterState } from 'src/dashboard/reducers/nativeFilters';
Expand Down Expand Up @@ -51,7 +53,7 @@ import { TIME_RANGE } from 'src/visualizations/FilterBox/FilterBox';
import { URL_PARAMS } from 'src/constants';
import { getUrlParam } from 'src/utils/urlUtils';
import { ResourceStatus } from 'src/hooks/apiResources/apiResources';
import { FeatureFlag, isFeatureEnabled } from '../../featureFlags';
import { isFeatureEnabled } from '../../featureFlags';
import extractUrlParams from '../util/extractUrlParams';
import { updateColorSchema } from './dashboardInfo';
import updateComponentParentsList from '../util/updateComponentParentsList';
Expand Down
4 changes: 2 additions & 2 deletions superset-frontend/src/dashboard/actions/sliceEntities.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
* under the License.
*/
/* eslint camelcase: 0 */
import { t, SupersetClient } from '@superset-ui/core';
import { FeatureFlag, SupersetClient, t } from '@superset-ui/core';
import rison from 'rison';

import { addDangerToast } from 'src/components/MessageToasts/actions';
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';
const FETCH_SLICES_PAGE_SIZE = 200;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import React from 'react';
import fetchMock from 'fetch-mock';
import { render } from 'spec/helpers/testing-library';
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 useStoredSidebarWidth from 'src/components/ResizableSidebar/useStoredSidebarWidth';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import React, {
import {
addAlpha,
css,
FeatureFlag,
JsonObject,
styled,
t,
Expand Down Expand Up @@ -57,7 +58,7 @@ import {
setDirectPathToChild,
setEditMode,
} from 'src/dashboard/actions/dashboardState';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags';
import { isFeatureEnabled } from 'src/featureFlags';
import {
deleteTopLevelTabs,
handleComponentDrop,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
* under the License.
*/
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 { URL_PARAMS } from 'src/constants';
import { getUrlParam } from 'src/utils/urlUtils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
import React from 'react';
import { shallow } from 'enzyme';
import { supersetTheme } from '@superset-ui/core';
import { Provider } from 'react-redux';
import { Store } from 'redux';
import * as SupersetUI from '@superset-ui/core';
Expand All @@ -36,7 +35,6 @@ import {
import { sliceId } from 'spec/fixtures/mockChartQueries';
import { dashboardFilters } from 'spec/fixtures/mockDashboardFilters';
import { dashboardWithFilter } from 'spec/fixtures/mockDashboardLayout';
import { FeatureFlag } from 'src/featureFlags';

const defaultStore = getMockStoreWithFilters();
function setup(store: Store = defaultStore) {
Expand All @@ -60,7 +58,9 @@ describe('FiltersBadge', () => {
// shallow rendering in enzyme doesn't propagate contexts correctly,
// so we have to mock the hook.
// 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', () => {
Expand Down Expand Up @@ -135,7 +135,7 @@ describe('FiltersBadge', () => {
it('shows the indicator when filters have been applied', () => {
// @ts-ignore
global.featureFlags = {
[FeatureFlag.DASHBOARD_NATIVE_FILTERS]: true,
[SupersetUI.FeatureFlag.DASHBOARD_NATIVE_FILTERS]: true,
};
const store = getMockStoreWithNativeFilters();
// start with basic dashboard state, dispatch an event to simulate query completion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import React from 'react';
import PropTypes from 'prop-types';
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 { URL_PARAMS } from 'src/constants';
Expand All @@ -37,7 +37,7 @@ import getDashboardUrl from 'src/dashboard/util/getDashboardUrl';
import { getActiveFilters } from 'src/dashboard/util/activeDashboardFilters';
import { getUrlParam } from 'src/utils/urlUtils';
import { LOG_ACTIONS_DASHBOARD_DOWNLOAD_AS_IMAGE } from 'src/logger/LogUtils';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
import { isFeatureEnabled } from 'src/featureFlags';

const propTypes = {
addSuccessToast: PropTypes.func.isRequired,
Expand Down
3 changes: 2 additions & 1 deletion superset-frontend/src/dashboard/components/Header/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ import PropTypes from 'prop-types';
import {
styled,
css,
FeatureFlag,
t,
getSharedLabelColor,
getUiOverrideRegistry,
} from '@superset-ui/core';
import { Global } from '@emotion/react';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
import { isFeatureEnabled } from 'src/featureFlags';
import {
LOG_ACTIONS_PERIODIC_RENDER_DASHBOARD,
LOG_ACTIONS_FORCE_REFRESH_DASHBOARD,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import rison from 'rison';
import {
CategoricalColorNamespace,
ensureIsArray,
FeatureFlag,
getCategoricalSchemeRegistry,
getSharedLabelColor,
styled,
Expand All @@ -40,7 +41,7 @@ import ColorSchemeControlWrapper from 'src/dashboard/components/ColorSchemeContr
import FilterScopeModal from 'src/dashboard/components/filterscope/FilterScopeModal';
import { getClientErrorObject } from 'src/utils/getClientErrorObject';
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 { addTag, deleteTaggedObjects, fetchTags, OBJECT_TYPES } from 'src/tags';
import { loadTags } from 'src/components/Tags/utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import userEvent from '@testing-library/user-event';
import React from 'react';
import { getMockStore } from 'spec/fixtures/mockStore';
import { render, screen } from 'spec/helpers/testing-library';
import { FeatureFlag } from 'src/featureFlags';
import { FeatureFlag } from '@superset-ui/core';
import SliceHeaderControls, { SliceHeaderControlsProps } from '.';

jest.mock('src/components/Dropdown', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,19 @@ import {
withRouter,
} from 'react-router-dom';
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 { NoAnimationDropdown } from 'src/components/Dropdown';
import ShareMenuItems from 'src/dashboard/components/menu/ShareMenuItems';
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 { Tooltip } from 'src/components/Tooltip';
import Icons from 'src/components/Icons';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ import userEvent from '@testing-library/user-event';
import { stateWithoutNativeFilters } from 'spec/fixtures/mockStore';
import * as mockCore from '@superset-ui/core';
import { testWithId } from 'src/utils/testUtils';
import { FeatureFlag } from 'src/featureFlags';
import { Preset } from '@superset-ui/core';
import { FeatureFlag, Preset } from '@superset-ui/core';
import { TimeFilterPlugin, SelectFilterPlugin } from 'src/filters/components';
import { DATE_FILTER_TEST_KEY } from 'src/explore/components/controls/DateFilterControl';
import fetchMock from 'fetch-mock';
Expand Down
Loading

0 comments on commit f6b5b65

Please sign in to comment.