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

lyndsi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new ddd8d17aa4 fix(ssh_tunnel): Fix bug on database edition for databases 
with ssh tunnels (#23006)
ddd8d17aa4 is described below

commit ddd8d17aa4785918afc5395312678d206a2f100a
Author: Antonio Rivero Martinez 
<[email protected]>
AuthorDate: Wed Feb 8 17:58:42 2023 -0300

    fix(ssh_tunnel): Fix bug on database edition for databases with ssh tunnels 
(#23006)
    
    Co-authored-by: Lyndsi Kay Williams 
<[email protected]>
---
 .../CRUD/data/database/DatabaseModal/index.test.tsx | 21 +++++++++++++++++++++
 .../CRUD/data/database/DatabaseModal/index.tsx      |  4 ++--
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git 
a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.test.tsx 
b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.test.tsx
index d644b2f3e1..c957258e91 100644
--- 
a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.test.tsx
+++ 
b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.test.tsx
@@ -1510,6 +1510,27 @@ describe('DatabaseModal', () => {
       expect(allowFileUploadText).not.toBeInTheDocument();
       expect(schemasForFileUploadText).not.toBeInTheDocument();
     });
+
+    it('if the SSH Tunneling toggle is not displayed, nothing should get 
displayed', async () => {
+      const SSHTunnelingToggle = screen.queryByTestId('ssh-tunnel-switch');
+      expect(SSHTunnelingToggle).not.toBeInTheDocument();
+      const SSHTunnelServerAddressInput = screen.queryByTestId(
+        'ssh-tunnel-server_address-input',
+      );
+      expect(SSHTunnelServerAddressInput).not.toBeInTheDocument();
+      const SSHTunnelServerPortInput = screen.queryByTestId(
+        'ssh-tunnel-server_port-input',
+      );
+      expect(SSHTunnelServerPortInput).not.toBeInTheDocument();
+      const SSHTunnelUsernameInput = screen.queryByTestId(
+        'ssh-tunnel-username-input',
+      );
+      expect(SSHTunnelUsernameInput).not.toBeInTheDocument();
+      const SSHTunnelPasswordInput = screen.queryByTestId(
+        'ssh-tunnel-password-input',
+      );
+      expect(SSHTunnelPasswordInput).not.toBeInTheDocument();
+    });
   });
 
   describe('DatabaseModal w errors as objects', () => {
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 418b14f113..35151598e0 100644
--- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
@@ -1154,10 +1154,10 @@ const DatabaseModal: 
FunctionComponent<DatabaseModalProps> = ({
   }, [passwordsNeeded]);
 
   useEffect(() => {
-    if (db) {
+    if (db && isSSHTunneling) {
       setUseSSHTunneling(!isEmpty(db?.ssh_tunnel));
     }
-  }, [db]);
+  }, [db, isSSHTunneling]);
 
   const onDbImport = async (info: UploadChangeParam) => {
     setImportingErrorMessage('');

Reply via email to