diff --git a/superset-frontend/spec/javascripts/views/CRUD/data/database/DatabaseList_spec.jsx b/superset-frontend/spec/javascripts/views/CRUD/data/database/DatabaseList_spec.jsx index 96639df9bd642..56455779d06f0 100644 --- a/superset-frontend/spec/javascripts/views/CRUD/data/database/DatabaseList_spec.jsx +++ b/superset-frontend/spec/javascripts/views/CRUD/data/database/DatabaseList_spec.jsx @@ -57,6 +57,11 @@ const mockdatabases = [...new Array(3)].map((_, i) => ({ id: i, })); +jest.mock('react-redux', () => ({ + ...jest.requireActual('react-redux'), + useSelector: jest.fn(), +})); + const mockUser = { userId: 1, }; diff --git a/superset-frontend/spec/javascripts/views/CRUD/data/database/DatabaseModal_spec.jsx b/superset-frontend/spec/javascripts/views/CRUD/data/database/DatabaseModal_spec.jsx index fb1e6e0d020c7..901b18a67e361 100644 --- a/superset-frontend/spec/javascripts/views/CRUD/data/database/DatabaseModal_spec.jsx +++ b/superset-frontend/spec/javascripts/views/CRUD/data/database/DatabaseModal_spec.jsx @@ -43,6 +43,11 @@ const dbProps = { }, }; +jest.mock('react-redux', () => ({ + ...jest.requireActual('react-redux'), + useSelector: jest.fn(), +})); + const DATABASE_ENDPOINT = 'glob:*/api/v1/database/*'; fetchMock.get(DATABASE_ENDPOINT, {}); diff --git a/superset-frontend/src/views/App.tsx b/superset-frontend/src/views/App.tsx index 9e3fcbb3d5b3a..0e8dc243f4d3f 100644 --- a/superset-frontend/src/views/App.tsx +++ b/superset-frontend/src/views/App.tsx @@ -51,6 +51,7 @@ initFeatureFlags(bootstrap.common.feature_flags); const store = createStore( combineReducers({ messageToasts: messageToastReducer, + common: () => common, }), {}, compose(applyMiddleware(thunk), initEnhancer(false)), diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx index 081fb35809c64..f2467def87533 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx @@ -17,6 +17,7 @@ * under the License. */ import React, { FunctionComponent, useState, useEffect } from 'react'; +import { useSelector } from 'react-redux'; import { styled, t, SupersetClient } from '@superset-ui/core'; import InfoTooltip from 'src/common/components/InfoTooltip'; import { useSingleViewResource } from 'src/views/CRUD/hooks'; @@ -39,8 +40,17 @@ interface DatabaseModalProps { database?: DatabaseObject | null; // If included, will go into edit mode } -const DEFAULT_TAB_KEY = '1'; +// todo: define common type fully in types file +interface RootState { + common: { + conf: { + SQLALCHEMY_DOCS_URL: string; + }; + }; + messageToast: Array; +} +const DEFAULT_TAB_KEY = '1'; const StyledIcon = styled(Icon)` margin: auto ${({ theme }) => theme.gridUnit * 2}px auto 0; `; @@ -132,6 +142,7 @@ const DatabaseModal: FunctionComponent = ({ const [db, setDB] = useState(null); const [isHidden, setIsHidden] = useState(true); const [tabKey, setTabKey] = useState(DEFAULT_TAB_KEY); + const conf = useSelector((state: RootState) => state.common.conf); const isEditMode = database !== null; const defaultExtra = @@ -402,7 +413,7 @@ const DatabaseModal: FunctionComponent = ({
{t('Refer to the ')} diff --git a/superset/config.py b/superset/config.py index 79eca21628d31..78e7177c13aa8 100644 --- a/superset/config.py +++ b/superset/config.py @@ -1092,6 +1092,9 @@ class CeleryConfig: # pylint: disable=too-few-public-methods # It will get executed each time when user open a chart's explore view. DATASET_HEALTH_CHECK = None +# SQLalchemy link doc reference +SQLALCHEMY_DOCS_URL = "https://docs.sqlalchemy.org/en/13/core/engines.html" + # ------------------------------------------------------------------- # * WARNING: STOP EDITING HERE * # ------------------------------------------------------------------- diff --git a/superset/views/base.py b/superset/views/base.py index 69c9383ffccc1..e71bb2001cfe1 100644 --- a/superset/views/base.py +++ b/superset/views/base.py @@ -80,6 +80,7 @@ "DISPLAY_MAX_ROW", "GLOBAL_ASYNC_QUERIES_TRANSPORT", "GLOBAL_ASYNC_QUERIES_POLLING_DELAY", + "SQLALCHEMY_DOCS_URL", ) logger = logging.getLogger(__name__)