feat(database-modal): add validation loading state and duplicate name check#36880
feat(database-modal): add validation loading state and duplicate name check#36880
Conversation
- Add isValidating prop to TableCatalog, ValidatedInputField, and CommonParameters to show loading spinner during validation - Fix LabeledErrorBoundInput hasFeedback to display spinner while validating, not just on errors - Add duplicate database name validation to validate_parameters endpoint for real-time feedback before form submission
…oint - Remove early return in frontend validation hook when SSH is enabled, allowing backend validation to run for all database parameters - Add SSH tunnel field validation in ValidateDatabaseParametersCommand to validate server_address, server_port, username, and credentials - Add DatabaseSSHTunnelValidation schema for partial SSH tunnel data validation without strict authentication requirements - Add ssh_tunnel field to DatabaseValidateParametersSchema - Parse SSH tunnel errors in frontend and display under ssh_tunnel key - Collect database_name duplicate errors alongside parameter errors
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
759b6ac to
553ae99
Compare
553ae99 to
0bfaf3c
Compare
| # Collect SSH tunnel errors | ||
| ssh_tunnel_errors = self._get_ssh_tunnel_errors() | ||
| errors.extend(ssh_tunnel_errors) | ||
|
|
There was a problem hiding this comment.
Can we check the top line here includes the other ones? I think we must've been doing db name errors at least.
There was a problem hiding this comment.
Hey memo what do you mean with this? I checked validate_parameters in base.py and it only validates connection parameters (host, port, username, database)
There was a problem hiding this comment.
Pinging on this — I checked validate_parameters in base.py and it only validates the connection parameters (host, port, username, database). The display database_name (the user-facing label) was never validated there, so the new _get_database_name_error is the only path checking uniqueness. Happy to refactor differently if you had something else in mind.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #36880 +/- ##
==========================================
- Coverage 63.88% 63.82% -0.07%
==========================================
Files 2583 2583
Lines 136596 136489 -107
Branches 31501 31416 -85
==========================================
- Hits 87271 87119 -152
- Misses 47809 47850 +41
- Partials 1516 1520 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…onses The blur-debounced validation can fire multiple in-flight requests as the user types across fields. Without sequencing, an earlier request that returns later overwrites the result of a newer one, leaving the modal showing stale errors and keeping the Connect button disabled even after the form is fully valid. Track a per-call request id and only update validation state when the response corresponds to the latest request. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
userEvent.type fires keystrokes serially through React's event system, which races with the new debounced validation: ports rendered as number inputs lose values mid-typing, and dynamic-form tests time out at the 20s default while tabbing between five fields. userEvent.paste also no longer supplies a clipboardData object the Select onPaste handler can read. Switch the affected interactions to fireEvent.change/blur (single-shot, no per-key validation churn) and revert the paste case to fireEvent.paste, matching the master form. Behavior under test is unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds unit tests for the duplicate-database-name check (create + update paths, plus the bypass-engine path), the SSH tunnel feature-flag and db-port guards, and the SSH tunnel field-level error collection (missing required fields, missing credentials, private key without password). Brings patch coverage on commands/database/validate.py up from ~44%. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The two ``show error alerts on dynamic form`` cases relied on a single
60s ``should('not.be.disabled')`` after typing five fields, but the
``{ timeout: 60000 }`` option on ``.should()`` is not honoured the way
it is on the query — the assertion still uses the project's 8s default
and times out before the chained validation calls complete.
Match the master cadence: explicitly blur each field and wait for the
``@validateParams`` interception before moving on, so the button-state
assertion only fires once validation is settled.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
When the validate_parameters request failed without a structured error body (e.g. network drop), getValidation returned an empty object that the caller could not distinguish from "validation passed" — and the blur dedup cache was already updated, so the same form state would never revalidate until the user changed a field. Have getValidation return null on unexpected failure and only update the snapshot cache after a usable response. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Three correctness fixes to ValidateDatabaseParametersCommand: 1. Bypass engines (bigquery, datastore, snowflake) now also surface database_name uniqueness errors and SSH tunnel field errors during progressive validation, instead of silently passing. 2. The SSH feature-flag and database-port guards now fire when the UI marks parameters.ssh, not just when the ssh_tunnel payload is non-empty — the form sends an empty tunnel object in early stages. 3. The "parameters are missing" message for SSH tunnel fields now interpolates the %(missing)s placeholder via gettext, so the response surfaces the actual missing fields instead of the literal token. Adds unit tests for each branch and removes the now-unused _validate_database_name helper. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
SUMMARY
Problem
When users fill out the database connection form, they experience two UX issues:
Solution
This PR addresses both issues:
isValidatingprop is now passed toTableCatalog,ValidatedInputField, andCommonParameterscomponents.Additionally, fixed the
LabeledErrorBoundInputcomponent where hasFeedback was only set when there was an error. Changed it, so the Ant Design FormItem displays the loading spinner during validation, not just the error icon when validation fails.ValidateDatabaseParametersCommand.validate()method to check for duplicate database names usingDatabaseDAO.validate_uniqueness()(for new databases) orDatabaseDAO.validate_update_uniqueness()(for existing databases).This provides real-time feedback as users type, preventing wasted time on form submissions that will fail.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
before.mp4
Recording.2026-02-16.161719.mp4
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION
es new feature or API