From 4e2bdd49c4f23ace04ccde652fc6dfc8a4a24b0d Mon Sep 17 00:00:00 2001 From: Phillip Kelley-Dotson Date: Mon, 7 Feb 2022 12:45:42 -0800 Subject: [PATCH] chore: allow sqla docs to use supersettext (#18585) * chore: allow sqla docs to use supersettext * Update SqlAlchemyForm.tsx --- .../database/DatabaseModal/SqlAlchemyForm.tsx | 136 ++++++++++-------- 1 file changed, 73 insertions(+), 63 deletions(-) diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/SqlAlchemyForm.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/SqlAlchemyForm.tsx index a48cea33e4132..7226efdcb4b37 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/SqlAlchemyForm.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/SqlAlchemyForm.tsx @@ -18,6 +18,7 @@ */ import React, { EventHandler, ChangeEvent, MouseEvent } from 'react'; import { t, SupersetTheme } from '@superset-ui/core'; +import SupersetText from 'src/utils/textUtils'; import Button from 'src/components/Button'; import { StyledInputContainer, wideButton } from './styles'; @@ -37,67 +38,76 @@ const SqlAlchemyTab = ({ conf: { SQLALCHEMY_DOCS_URL: string; SQLALCHEMY_DISPLAY_TEXT: string }; isEditMode?: boolean; testInProgress?: boolean; -}) => ( - <> - -
- {t('Display Name')} - * -
-
- -
-
- {t('Pick a name to help you identify this database.')} -
-
- -
- {t('SQLAlchemy URI')} - * -
-
- -
-
- {t('Refer to the')}{' '} - - {conf?.SQLALCHEMY_DISPLAY_TEXT ?? ''} - {' '} - {t('for more information on how to structure your URI.')} -
-
- - -); - +}) => { + let fallbackDocsUrl; + let fallbackDisplayText; + if (SupersetText) { + fallbackDocsUrl = + SupersetText.DB_MODAL_SQLALCHEMY_FORM?.SQLALCHEMY_DOCS_URL; + fallbackDisplayText = + SupersetText.DB_MODAL_SQLALCHEMY_FORM?.SQLALCHEMY_DOCS_URL; + } + return ( + <> + +
+ {t('Display Name')} + * +
+
+ +
+
+ {t('Pick a name to help you identify this database.')} +
+
+ +
+ {t('SQLAlchemy URI')} + * +
+
+ +
+
+ {t('Refer to the')}{' '} + + {fallbackDisplayText || conf?.SQLALCHEMY_DISPLAY_TEXT || ''} + {' '} + {t('for more information on how to structure your URI.')} +
+
+ + + ); +}; export default SqlAlchemyTab;