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 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';

View File

@ -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 {

View File

@ -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 {

View File

@ -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';

View File

@ -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';
@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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,

View File

@ -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';
@ -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';

View File

@ -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';

View File

@ -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();

View File

@ -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,
@ -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';

View File

@ -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';
@ -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';

View File

@ -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;

View File

@ -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 {

View File

@ -29,6 +29,7 @@ import React, {
import {
addAlpha,
css,
FeatureFlag,
JsonObject,
styled,
t,
@ -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,

View File

@ -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';

View File

@ -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';
@ -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) {
@ -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', () => {
@ -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

View File

@ -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';
@ -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,

View File

@ -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,

View File

@ -26,6 +26,7 @@ import rison from 'rison';
import {
CategoricalColorNamespace,
ensureIsArray,
FeatureFlag,
getCategoricalSchemeRegistry,
getSharedLabelColor,
styled,
@ -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';

View File

@ -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', () => {

View File

@ -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';

View File

@ -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';

View File

@ -24,22 +24,23 @@ import React, {
useState,
} from 'react';
import {
QueryFormData,
SuperChart,
DataMask,
t,
styled,
Behavior,
ChartDataResponseResult,
JsonObject,
Behavior,
DataMask,
FeatureFlag,
getChartMetadataRegistry,
JsonObject,
QueryFormData,
styled,
SuperChart,
t,
} from '@superset-ui/core';
import { useDispatch, useSelector } from 'react-redux';
import { isEqual, isEqualWith } from 'lodash';
import { getChartDataRequest } from 'src/components/Chart/chartAction';
import Loading from 'src/components/Loading';
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 { ClientErrorObject } from 'src/utils/getClientErrorObject';
import { FilterBarOrientation, RootState } from 'src/dashboard/types';

View File

@ -28,10 +28,16 @@ import React, {
createContext,
} from 'react';
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 { AntdTabs } from 'src/components';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags';
import { isFeatureEnabled } from 'src/featureFlags';
import Loading from 'src/components/Loading';
import { EmptyStateSmall } from 'src/components/EmptyState';
import { getFilterBarTestId } from './utils';

View File

@ -27,6 +27,7 @@ import {
Behavior,
ChartDataResponseResult,
Column,
FeatureFlag,
Filter,
GenericDataType,
getChartMetadataRegistry,
@ -69,7 +70,7 @@ import {
} from 'src/dashboard/types';
import DateFilterControl from 'src/explore/components/controls/DateFilterControl';
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 { ClientErrorObject } from 'src/utils/getClientErrorObject';
import { SingleValueType } from 'src/filters/components/Range/SingleValueType';

View File

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

View File

@ -23,10 +23,10 @@ import React, {
useState,
MouseEvent,
} 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 Tabs from 'src/components/Tabs';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags';
import { isFeatureEnabled } from 'src/featureFlags';
import {
getItem,
setItem,

View File

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

View File

@ -19,11 +19,12 @@
import React, { useEffect, useMemo, useRef, useState } from 'react';
import {
css,
styled,
t,
DatasourceType,
FeatureFlag,
Metric,
QueryFormData,
styled,
t,
} from '@superset-ui/core';
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 { Input } from 'src/components/Input';
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 Control from 'src/explore/components/Control';
import DatasourcePanelDragOption from './DatasourcePanelDragOption';

View File

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

View File

@ -25,11 +25,12 @@ import { withRouter, RouteComponentProps } from 'react-router-dom';
import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls';
import {
css,
t,
styled,
DatasourceType,
isDefined,
ensureIsArray,
FeatureFlag,
isDefined,
styled,
t,
} from '@superset-ui/core';
import { Input } from 'src/components/Input';
import { Form, FormItem } from 'src/components/Form';
@ -41,7 +42,7 @@ import { Select } from 'src/components';
import Loading from 'src/components/Loading';
import { setSaveChartModalVisibility } from 'src/explore/actions/saveModalActions';
import { SaveActionType } from 'src/explore/types';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
import { isFeatureEnabled } from 'src/featureFlags';
// Session storage key for 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 { Select } from 'src/components';
import {
t,
SupersetClient,
SupersetTheme,
styled,
FeatureFlag,
hasGenericChartAxes,
isDefined,
styled,
SupersetClient,
SupersetTheme,
t,
} from '@superset-ui/core';
import {
Operators,
@ -42,7 +43,7 @@ import AdhocFilter from 'src/explore/components/controls/FilterControl/AdhocFilt
import { Tooltip } from 'src/components/Tooltip';
import { Input } from 'src/components/Input';
import { optionLabel } from 'src/utils/common';
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags';
import { isFeatureEnabled } from 'src/featureFlags';
import {
ColumnMeta,
Dataset,

View File

@ -18,7 +18,7 @@
*/
import React, { useCallback, useMemo, useState } from 'react';
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 { Menu } from 'src/components/Menu';
import ModalTrigger from 'src/components/ModalTrigger';
@ -29,7 +29,7 @@ import downloadAsImage from 'src/utils/downloadAsImage';
import { getChartPermalink } from 'src/utils/urlUtils';
import copyTextToClipboard from 'src/utils/copy';
import HeaderReportDropDown from 'src/components/ReportModal/HeaderReportDropdown';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
import { isFeatureEnabled } from 'src/featureFlags';
import ViewQueryModal from '../controls/ViewQueryModal';
import EmbedCodeContent from '../EmbedCodeContent';
import DashboardsSubMenu from './DashboardsSubMenu';

View File

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

View File

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

View File

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

View File

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

View File

@ -16,11 +16,11 @@
* specific language governing permissions and limitations
* 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 { Link } from 'react-router-dom';
import rison from 'rison';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
import { isFeatureEnabled } from 'src/featureFlags';
import {
createFetchRelated,
createErrorHandler,

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* 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 rison from 'rison';
import { useSelector } from 'react-redux';
@ -24,7 +24,7 @@ import { useQueryParams, BooleanParam } from 'use-query-params';
import { LocalStorageKeys, setItem } from 'src/utils/localStorageHelpers';
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 { createErrorHandler, uploadUserPerms } from 'src/views/CRUD/utils';
import withToasts from 'src/components/MessageToasts/withToasts';

View File

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

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { SupersetClient, t, styled } from '@superset-ui/core';
import { FeatureFlag, styled, SupersetClient, t } from '@superset-ui/core';
import React, {
FunctionComponent,
useState,
@ -54,7 +54,7 @@ import FacePile from 'src/components/FacePile';
import CertifiedBadge from 'src/components/CertifiedBadge';
import InfoTooltip from 'src/components/InfoTooltip';
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 { isUserAdmin } from 'src/dashboard/util/permissionUtils';
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 dashboardInfoEndpoint = 'glob:*/api/v1/dashboard/_info?*';
const dashboardFavoriteStatusEndpoint =
'glob:*/api/v1/dashboard/favorite_status?*';
'glob:*/api/v1/dashboard/favorite_status/?*';
const savedQueryEndpoint = 'glob:*/api/v1/saved_query/?*';
const savedQueryInfoEndpoint = 'glob:*/api/v1/saved_query/_info?*';
const recentActivityEndpoint = 'glob:*/api/v1/log/recent_activity/*';

View File

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

View File

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

View File

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

View File

@ -24,11 +24,12 @@ import React, {
useCallback,
} from 'react';
import {
styled,
t,
SupersetClient,
css,
FeatureFlag,
styled,
SupersetClient,
SupersetTheme,
t,
} from '@superset-ui/core';
import rison from 'rison';
import { useSingleViewResource } from 'src/views/CRUD/hooks';
@ -39,7 +40,7 @@ import Modal from 'src/components/Modal';
import TimezoneSelector from 'src/components/TimezoneSelector';
import { Radio } from 'src/components/Radio';
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 Owner from 'src/types/Owner';
import { AntdCheckbox, AsyncSelect, Select } from 'src/components';

View File

@ -17,9 +17,9 @@
* under the License.
*/
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 { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
import { isFeatureEnabled } from 'src/featureFlags';
import ConfirmStatusChange from 'src/components/ConfirmStatusChange';
import Icons from 'src/components/Icons';
import Chart from 'src/types/Chart';

View File

@ -18,9 +18,9 @@
*/
import React from 'react';
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 { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
import { AntdDropdown } from 'src/components';
import { Menu } from 'src/components/Menu';
import ListViewCard from 'src/components/ListViewCard';

View File

@ -18,9 +18,9 @@
*/
import React from 'react';
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 { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
import { isFeatureEnabled } from 'src/featureFlags';
import { AntdDropdown } from 'src/components';
import { Menu } from 'src/components/Menu';
import ConfirmStatusChange from 'src/components/ConfirmStatusChange';