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

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


The following commit(s) were added to refs/heads/hugh/db-connection-ui-r2 by 
this push:
     new 47cd118  fix json file upload
47cd118 is described below

commit 47cd118cb233f6bbd56efd7a9bc2c03867c90f69
Author: hughhhh <[email protected]>
AuthorDate: Thu Jun 17 11:28:42 2021 -0400

    fix json file upload
---
 .../CRUD/data/database/DatabaseModal/DatabaseConnectionForm.tsx   | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm.tsx
 
b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm.tsx
index ad8039d..7e5d8eb 100644
--- 
a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm.tsx
+++ 
b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm.tsx
@@ -49,8 +49,6 @@ export const FormFieldOrder = [
   'encryption',
 ];
 
-const selectedFile = document.getElementById('selectedFile');
-
 interface FieldPropTypes {
   required: boolean;
   onParametersChange: (value: any) => string;
@@ -68,7 +66,7 @@ interface FieldPropTypes {
 
 const CredentialsInfo = ({ changeMethods, isEditMode, db }: FieldPropTypes) => 
{
   const [uploadOption, setUploadOption] = useState<number>(
-    CredentialInfoOptions.copyPaste.valueOf(),
+    CredentialInfoOptions.jsonUpload.valueOf(),
   );
   const [fileToUpload, setFileToUpload] = useState<string | null | undefined>(
     null,
@@ -153,7 +151,9 @@ const CredentialsInfo = ({ changeMethods, isEditMode, db }: 
FieldPropTypes) => {
                   checked: false,
                 },
               });
-              (selectedFile as HTMLInputElement).value = null as any;
+              (document.getElementById(
+                'selectedFile',
+              ) as HTMLInputElement).value = null as any;
             }}
           />
         </div>

Reply via email to