hughhhh commented on a change in pull request #15242:
URL: https://github.com/apache/superset/pull/15242#discussion_r656598248



##########
File path: superset-frontend/src/views/CRUD/hooks.ts
##########
@@ -648,35 +648,11 @@ export function useDatabaseValidation() {
           setValidationErrors(null);
         })
         .catch(e => {
+          console.log('check Params', checkParams);
           if (typeof e.json === 'function') {
             e.json().then(({ errors = [] }: JsonObject) => {
-              const parsedErrors = errors

Review comment:
       replace this with the following code snippet
   ```suggestion
                 const parsedErrors = errors
                                 .filter(
                                   (error: { error_type: string }) =>
                                     error.error_type !==
                                       'CONNECTION_MISSING_PARAMETERS_ERROR' || 
onCreate,
                                 )
                                 .reduce(
                                   (
                                     obj: {},
                                     {
                                       extra,
                                       message,
                                     }: {
                                       extra: { invalid?: string[]; missing?: 
string[] };
                                       message: string;
                                     },
                                   ) => {
                                     // if extra.invalid doesn't exist then the
                                     // error can't be mapped to a parameter
                                     // so leave it alone
                                     if (extra.invalid) {
                                       return { ...obj, [extra.invalid[0]]: 
message };
                                     }
                                     if (extra.missing) {
                                       const missingFields = {};
                                       extra.missing.map(d => {
                                         missingFields[d] = 'This is a required 
field';
                                       });
                                       return { ...obj, ...missingFields };
                                     }
                                     return obj;
                                   },
                                   {},
                                 );
   
   ```

##########
File path: superset-frontend/src/views/CRUD/hooks.ts
##########
@@ -648,35 +648,11 @@ export function useDatabaseValidation() {
           setValidationErrors(null);
         })
         .catch(e => {
+          console.log('check Params', checkParams);

Review comment:
       remove console.log




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

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to