kgabryje opened a new pull request, #40466:
URL: https://github.com/apache/superset/pull/40466
### SUMMARY
Restores the **Type of Google Sheets allowed** dropdown on the Google Sheets
database-connection form. The dropdown was originally introduced to let users
opt out of service-account / OAuth2 credential UI when they only intend to
query publicly shared sheets, and was removed in commit `e2a9e0c6bb` (PR
#32048) during the OAuth2 rework. User feedback since then has flagged the
missing toggle: the credential upload and helper text show by default even for
public-only setups, which is confusing.
This PR brings the dropdown back with two options:
- **Publicly shared sheets only** (default for new connections)
- **Public and privately shared sheets**
When "public" is selected, the service-account credential input, the OAuth2
client information panel, and the credentials helper text in the table catalog
are all hidden. They reappear when "private" is selected.
Edit-mode default: the dropdown shows "private" when the connection has any
of `masked_encrypted_extra !== '{}'`, `parameters.service_account_info`, or
stored OAuth2 client info — otherwise it defaults to "public".
Toggling private → public clears in-flight `service_account_info` and
`oauth2_client_info` from parameters so stale values aren't submitted.
**`isPublic` is UI-only** — no schema change, migration, or API change.
State lives in `DatabaseConnectionForm/index.tsx` and is threaded to
`EncryptedField`, `TableCatalog`, and `OAuth2ClientField` via the existing
field-props bag.
#### Bundled validation fix
The same flow has had an over-eager validation issue on the catalog **Sheet
Name** and **URL** inputs: clicking into Name and tabbing to URL (or clicking
the modal background) fired \`getValidation\`, the backend returned
\`CONNECTION_MISSING_PARAMETERS_ERROR\` for both empty required fields, and the
inputs lit up red before the user had typed anything.
Fix: drop \`CONNECTION_MISSING_PARAMETERS_ERROR\` from the on-blur
allow-list at \`superset-frontend/src/views/CRUD/hooks.ts\`. Required-field
errors now surface on submit only. Other live-on-blur checks
(\`INVALID_PAYLOAD_SCHEMA_ERROR\` for malformed URLs,
\`CONNECTION_ACCESS_DENIED_ERROR\` for credential rejection) are unchanged.
This is a one-line change in \`useDatabaseValidation\` and affects all engines.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
_Not included — restoring previously shipped UI; see PR #32048 for the
original look of the dropdown._
### TESTING INSTRUCTIONS
1. Add a new database connection → pick **Google Sheets**.
2. Confirm the **Type of Google Sheets allowed** dropdown appears. Default =
**Publicly shared sheets only**.
3. With "public" selected: no service-account upload UI, no OAuth2 client
panel, no helper text in the table catalog.
4. Switch to **Public and privately shared sheets**: service-account upload
UI + OAuth2 client panel + helper text all appear.
5. Add a sheet row, click into **Name**, then tab to **URL** without typing
— confirm no "required" error flashes.
6. Click **Connect** with empty rows — confirm required-field errors do
appear at submit time.
7. Edit an existing gsheets connection that has service-account credentials
→ dropdown defaults to **Public and privately shared sheets**.
8. Toggle private → public → submit; confirm stored params don't include
stale \`service_account_info\` / \`oauth2_client_info\`.
Plus Jest unit tests:
\`\`\`
npm test -- EncryptedField TableCatalog OAuth2ClientField hooks
\`\`\`
New / updated tests cover:
- dropdown renders for gsheets, not for bigquery / datastore
- credential UI hidden in public mode, visible in private mode (both create
and edit)
- toggling public clears stale \`service_account_info\` and
\`oauth2_client_info\`
- \`OAuth2ClientField\` returns null when gsheets + public
- \`TableCatalog\` hides credentials helper text when gsheets + public
- \`useDatabaseValidation\` filters \`CONNECTION_MISSING_PARAMETERS_ERROR\`
on blur but surfaces it on submit
- \`INVALID_PAYLOAD_SCHEMA_ERROR\` still surfaces on blur
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [x] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]