You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "betodealmeida (via GitHub)" <gi...@apache.org> on 2023/06/22 19:10:47 UTC

[GitHub] [superset] betodealmeida commented on a diff in pull request #24196: fix: SSH Tunnel creation with dynamic form

betodealmeida commented on code in PR #24196:
URL: https://github.com/apache/superset/pull/24196#discussion_r1238924024


##########
superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/CommonParameters.tsx:
##########
@@ -250,3 +251,34 @@ export const forceSSLField = ({
     />
   </div>
 );
+
+export const SSHTunnelSwitch = ({
+  isEditMode,
+  changeMethods,
+  db,
+}: FieldPropTypes) =>
+  true ? (

Review Comment:
   Why the ternary operator here if the condition is always true?



##########
superset-frontend/src/features/databases/DatabaseModal/index.tsx:
##########
@@ -763,15 +763,18 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
         });
       }
 
-      // make sure that button spinner animates
-      setLoading(true);
-      const errors = await getValidation(dbToUpdate, true);
-      if ((validationErrors && !isEmpty(validationErrors)) || errors) {
+      // only do validation for non ssh tunnel connections
+      if (!dbToUpdate?.ssh_tunnel) {

Review Comment:
   @hughhhh  why can't we run the validation for SSH tunnel connections, assuming the user has provided that info?
   
   I think the logic should be: if the user has enabled SSH, we don't perform any validation until SSH credentials are entered.



##########
superset-frontend/src/views/CRUD/hooks.ts:
##########
@@ -753,6 +753,11 @@ export function useDatabaseValidation() {
         .catch(e => {
           if (typeof e.json === 'function') {
             return e.json().then(({ errors = [] }: JsonObject) => {
+              if (database?.parameters?.ssh) {

Review Comment:
   I don't think this belongs here... if we don't want to show validation errors for some reason, then we shouldn't be running the validation API calls.



-- 
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