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

   
   ### SUMMARY
   - Report creation from the Explore view fails with a 422 error
     (`"Choose a chart or dashboard not both"`) when the chart being reported 
on was
     opened by navigating into it from a Dashboard. Explore keeps the dashboard 
as
     navigation *context* even for a chart-scoped report, and 
`ReportModal.onSave` was
     sending both `chart` and `dashboard` in the POST body unconditionally, 
which the
     backend rejects whenever both are present.
   - Make the entity fields mutually exclusive in `onSave`, keyed off 
`creationMethod`
     (the same field the backend already uses to determine report scope): 
`charts` sends
     only `chart`, everything else sends only `dashboard`. This affects both 
the create
     and edit paths, since both build on the same `commonFields`.
   - Adds a regression test asserting that with `creationMethod='charts'` and a
     `dashboardId` context prop both set, the POST body contains `chart` and 
omits
     `dashboard`.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   Before: creating a report/alert from a chart opened via a dashboard link 
fails with
   `422 Unprocessable Content` — `{"message": {"chart": "Choose a chart or 
dashboard not
   both"}}`.
   After: the same flow succeeds — the request now sends only `chart`.
   
   ### TESTING INSTRUCTIONS
   1. Open a dashboard and click into one of its charts to open it in Explore.
   2. From Explore, open the report/alert creation modal ("Set up an alert" / 
"Set up a
      report") and save.
   3. Before this change: the request fails with a 422 "Choose a chart or 
dashboard not
      both" error. After: the report is created successfully.
   4. `npm run test -- ReportModal.test.tsx` in `superset-frontend`.
   
   ### 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]

Reply via email to