This is an automated email from the ASF dual-hosted git repository.

hugh pushed a commit to branch pexdax/db-connection-ui-show-preferred
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to 
refs/heads/pexdax/db-connection-ui-show-preferred by this push:
     new e299bfa  save
e299bfa is described below

commit e299bfab530ad47c9d83ad1909af44698276eee3
Author: hughhhh <[email protected]>
AuthorDate: Tue Jun 1 23:21:25 2021 -0400

    save
---
 .../CRUD/data/database/DatabaseModal/index.tsx     | 29 ++++++++--------------
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git 
a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx 
b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
index d6ec660..e652ea7 100644
--- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
@@ -371,27 +371,13 @@ const DatabaseModal: 
FunctionComponent<DatabaseModalProps> = ({
         <h4>{isEditMode ? t('Edit database') : t('Connect a database')}</h4>
       }
     >
-      {isEditMode ? (
+      {isEditMode && (
         <TabHeader>
           <EditHeaderTitle>{db?.backend}</EditHeaderTitle>
           <EditHeaderSubtitle>{dbName}</EditHeaderSubtitle>
         </TabHeader>
-      ) : (
-        <TabHeader>
-          <CreateHeaderTitle>Enter Primary Credentials</CreateHeaderTitle>
-          <CreateHeaderSubtitle>
-            Need help? Learn how to connect your database{' '}
-            <a
-              href={DOCUMENTATION_LINK}
-              target="_blank"
-              rel="noopener noreferrer"
-            >
-              here
-            </a>
-            .
-          </CreateHeaderSubtitle>
-        </TabHeader>
       )}
+      {/* Add styled header here when not in edit mode*/}
       <hr />
       <Tabs
         defaultActiveKey={DEFAULT_TAB_KEY}
@@ -538,7 +524,8 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> 
= ({
                         setDB({
                           type: ActionType.dbSelected,
                           payload: {
-                            configuration_method: 
CONFIGURATION_METHOD.DYNAMIC_FORM,
+                            configuration_method:
+                              CONFIGURATION_METHOD.DYNAMIC_FORM,
                             engine: database.engine,
                           },
                         });
@@ -553,10 +540,16 @@ const DatabaseModal: 
FunctionComponent<DatabaseModalProps> = ({
               <Select
                 style={{ width: '100%' }}
                 onChange={option => {
+                  // todo: centralize this in function
+                  const isDynamic = availableDbs?.databases.filter(
+                    db => db.engine === option,
+                  )[0].parameters !== undefined;
                   setDB({
                     type: ActionType.dbSelected,
                     payload: {
-                      configuration_method: CONFIGURATION_METHOD.DYNAMIC_FORM,
+                      configuration_method: isDynamic
+                        ? CONFIGURATION_METHOD.DYNAMIC_FORM
+                        : CONFIGURATION_METHOD.SQLALCHEMY_URI,
                       engine: option,
                     },
                   });

Reply via email to