eschutho commented on a change in pull request #12845:
URL: https://github.com/apache/superset/pull/12845#discussion_r572474266



##########
File path: superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx
##########
@@ -250,6 +294,30 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> 
= ({
         typeof target.value === 'string' ? target.value.trim() : target.value;
     }
 
+    if (target.id === 'expose_in_sqllab') {
+      setIsOpen(!isOpen);
+    }
+
+    // Conditional form rendering
+    const checkedTrue = target.checked === true;
+    /* The CTAS & CVAS schema field needs individual setters
+    so that the input will not disappear when one options goes
+    unchecked but the other is still checked */
+    if (target.id.includes('cvas')) {
+      if (!cvas && checkedTrue) {
+        cvasCtasCheck('cvas', true);
+      } else {
+        cvasCtasCheck('cvas', false);
+      }

Review comment:
       shorter: 
   ```
   const { id, checked } = target;
   const check = (!cvas && id.includes('cvas') && 'cvas') || (!ctas && 
id.includes('ctas') && 'ctas');
   cvasCtasCheck( check, checked);
   ```




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