From c54e2d1e37ac222a4d4e56d3d0af6f5756f3351f Mon Sep 17 00:00:00 2001 From: Phillip Kelley-Dotson Date: Fri, 4 Feb 2022 13:41:23 -0800 Subject: [PATCH 1/2] chore: allow sqla docs to use supersettext --- .../database/DatabaseModal/SqlAlchemyForm.tsx | 137 ++++++++++-------- 1 file changed, 74 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..5076ab78a0ea2 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,8 @@ */ import React, { EventHandler, ChangeEvent, MouseEvent } from 'react'; import { t, SupersetTheme } from '@superset-ui/core'; +import SupersetText from 'src/utils/textUtils'; +// import SupersetText, { SupersetTextType, st } from 'src/utils/textUtils'; import Button from 'src/components/Button'; import { StyledInputContainer, wideButton } from './styles'; @@ -37,67 +39,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; From 1cd1d32fbf9804980fcceb27c287d388af61a797 Mon Sep 17 00:00:00 2001 From: Phillip Kelley-Dotson Date: Mon, 7 Feb 2022 11:21:39 -0800 Subject: [PATCH 2/2] Update SqlAlchemyForm.tsx --- .../views/CRUD/data/database/DatabaseModal/SqlAlchemyForm.tsx | 1 - 1 file changed, 1 deletion(-) 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 5076ab78a0ea2..7226efdcb4b37 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/SqlAlchemyForm.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/SqlAlchemyForm.tsx @@ -19,7 +19,6 @@ import React, { EventHandler, ChangeEvent, MouseEvent } from 'react'; import { t, SupersetTheme } from '@superset-ui/core'; import SupersetText from 'src/utils/textUtils'; -// import SupersetText, { SupersetTextType, st } from 'src/utils/textUtils'; import Button from 'src/components/Button'; import { StyledInputContainer, wideButton } from './styles';