feat: Move SQLAlchemy url reference to config (#13182)

This commit is contained in:
Hugh A. Miles II
2021-02-18 12:42:15 -05:00
committed by GitHub
parent 1e17ef3410
commit 3c58fc5ef5
6 changed files with 28 additions and 2 deletions

View File

@@ -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<Object>;
}
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<DatabaseModalProps> = ({
const [db, setDB] = useState<DatabaseObject | null>(null);
const [isHidden, setIsHidden] = useState<boolean>(true);
const [tabKey, setTabKey] = useState<string>(DEFAULT_TAB_KEY);
const conf = useSelector((state: RootState) => state.common.conf);
const isEditMode = database !== null;
const defaultExtra =
@@ -402,7 +413,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
<div className="helper">
{t('Refer to the ')}
<a
href="https://docs.sqlalchemy.org/en/rel_1_2/core/engines.html#"
href={conf?.SQLALCHEMY_DOCS_URL ?? ''}
target="_blank"
rel="noopener noreferrer"
>