mikebridge opened a new pull request, #45902: URL: https://github.com/apache/superset/pull/45902
### SUMMARY **TL;DR:** When someone selects more semantic views than the server allows in one request, the Add Semantic View modal now tells them so, using the server's own message with the configured limit, instead of a generic "An error occurred" toast. The selection stays in place so they can trim it and retry. **Background.** Bulk semantic view creation refuses an oversized batch up front, before it looks up any view with the provider, and answers with HTTP 400 and a message such as "Too many views in one request: 101 provided, at most 100 allowed." The limit is operator-configurable, so the UI cannot hard-code it. **Problem.** The modal only parsed HTTP 422 responses (the per-view partial-success shape). A 400 fell through to the generic failure path, so the user never saw why the batch was refused or what the limit is. **Changes.** - `creationResult.ts`: a small `batchRefusalMessage` helper that accepts only a plain string `message` from the 400 body; anything else yields the generic message rather than echoing an unexpected body. - `AddSemanticViewModal.tsx`: the save handler shows that message inline (in the existing failure list) and as a danger toast, leaves the selected views untouched, and does not call the success or hide callbacks. HTTP 422 handling and every other status are unchanged. - Tests: four new cases covering the default limit, a non-default limit (no hard-coded number in the UI), and two malformed 400 bodies that must keep the generic text. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF Before: selecting more views than the limit and clicking Add shows the toast "An error occurred while adding semantic views". After: the toast and the inline failure list read "Too many views in one request: 101 provided, at most 100 allowed." and the selection is kept. ### TESTING INSTRUCTIONS 1. Set `SEMANTIC_VIEW_BULK_CREATE_MAX_VIEWS = 2` in `superset_config.py` and restart. 2. Open a semantic layer that exposes at least three views, open Add Semantic View, select three views and click Add. 3. Expect the limit message inline and as a toast, with the three views still selected. Deselect one and click Add again; the two views are created as before. 4. Automated: `cd superset-frontend && npx jest src/features/semanticViews`. ### 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)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] 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]
