You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "Antonio-RiveroMartnez (via GitHub)" <gi...@apache.org> on 2023/01/31 02:54:02 UTC

[GitHub] [superset] Antonio-RiveroMartnez commented on a diff in pull request #22912: fix: fix warning in ssh tunnel

Antonio-RiveroMartnez commented on code in PR #22912:
URL: https://github.com/apache/superset/pull/22912#discussion_r1091374728


##########
superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx:
##########
@@ -374,21 +375,21 @@ export function dbReducer(
       };
     case ActionType.setSSHTunnelLoginMethod:
       if (action.payload.login_method === AuthType.privateKey) {
-        const { password, ...rest } = trimmedState?.ssh_tunnel ?? {};
         return {
           ...trimmedState,
           ssh_tunnel: {
-            ...rest,
+            ...omit(trimmedState?.ssh_tunnel, ['password']),

Review Comment:
   `omit` handles `undefined` and `null` values (will return an empty object) already. About the conditionals, we need the properties to be removed individually so they don't collide, i.e, we shouldn't delete them all at once. The use case for this action is:
   
   `If you select login method === password -> remove any private_key & private_key_password from the tunnel object we send in the payload to the API and vice versa.`
   
   That way the tunnel always has only 1 login method and not the two of them which will cause issues later when trying to connect.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org