msyavuz opened a new pull request, #43967:
URL: https://github.com/apache/superset/pull/43967

   ### SUMMARY
   Deleting a single dataset names the charts and dashboards that depend on it 
before asking for confirmation. Bulk delete showed only a generic "type DELETE 
to confirm" dialog, so the one flow with the largest blast radius had no 
warning at all.
   
   This adds `GET /api/v1/dataset/related_objects/?q=!(ids)`, returning the 
union of dependent charts and dashboards across the requested datasets, 
de-duplicated and filtered to what the current user can access (ids are scoped 
through the DAO base filter; 404 when none are visible). The bulk confirm calls 
it once when the action fires, keeps the Delete button disabled until the 
lookup resolves, and renders the same Affected Charts / Affected Dashboards 
lists the single-row modal uses. A failed lookup is stated explicitly so 
"unknown" is never read as "nothing depends on these". Semantic views are 
skipped since they delete through their own endpoint.
   
   `ConfirmStatusChange` gains a `disablePrimaryButton` passthrough to its 
`DeleteModal`. The affected-objects list markup is extracted into a component 
shared by both delete paths.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   Before: bulk dialog reads only "Are you sure you want to delete the selected 
datasets? Type DELETE to confirm."
   After: same dialog also shows "The selected datasets are linked to N charts 
that appear on M dashboards" followed by the named charts and dashboards, or 
"No charts or dashboards depend on the selected datasets."
   
   ### TESTING INSTRUCTIONS
   1. Have one dataset with a chart on a dashboard and one dataset with no 
dependents.
   2. Datasets list, Bulk select, tick both, click Delete.
   3. The dialog names the affected chart and dashboard and counts them; Delete 
stays disabled until the lookup finishes.
   4. Select only the clean dataset: the dialog says nothing depends on it.
   5. Block `/api/v1/dataset/related_objects/` (devtools) and repeat: the 
dialog says the check could not be done; Delete still works after typing DELETE.
   
   Automated: `pytest tests/integration_tests/datasets/api_tests.py -k 
related_objects` and `npm run test -- ConfirmStatusChange 
DatasetList.integration`.
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue: No
   - [ ] Required feature flags: None
   - [x] Changes UI
   - [ ] Includes DB Migration: No
   - [x] Introduces new feature or API: `GET /api/v1/dataset/related_objects/`
   - [ ] Removes existing feature or API: No


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

Reply via email to