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

   ### SUMMARY
   
   Fixes two issues in the **Add annotation layer** modal that occur after 
selecting a chart as the annotation source.
   
   #### Annotation Slice Configuration fields not rendering
   
   `fetchSliceData` and `fetchAppliedChart` read the source chart's form data 
from:
   
   `JSON.parse(result.query_context).form_data`
   
   However, `query_context` is a derived cache that is only populated after a 
chart has been opened in Explore. For charts that have never been opened there, 
`query_context` can therefore be `null`.
   
   Although `JSON.parse(null)` returns `null`, accessing `.form_data` then 
throws. The promise rejection was not handled, `slice` was never set, and the 
**Annotation Slice Configuration** fields remained hidden, leaving Apply/OK 
disabled.
   
   Form data is now resolved through a helper that:
   
   * prefers `query_context.form_data` when available;
   * falls back to the chart's saved `params`, which contain the persisted form 
data;
   * guards parsing failures; and
   * handles request rejections instead of failing silently.
   
   #### Modal overflowing the viewport
   
   The modal could overflow narrow viewports, particularly when Superset is 
embedded in an iframe, causing the **Display configuration** section and 
Apply/OK actions to become unreachable.
   
   The sections were rendered in an unbounded, non-wrapping flex row. In 
addition, Ant Design only enables `shiftX`/`shiftY` for the four base 
placements, while `ControlPopover` uses corner placements that only received `{ 
adjustX, adjustY }`. These options can flip the popup relative to its trigger, 
but cannot shift it back inside the viewport when neither side has enough space.
   
   `ControlPopover` now explicitly enables shifting.
   
   Because rc-trigger's shift calculation discounts `popupOffsetX`, shifting 
alone is not sufficient. The section row is therefore also capped to the 
available space beside the control panel and allowed to wrap when necessary.
   
   The control panel edge is used as the sizing anchor rather than the popover 
itself, avoiding unstable measurements while the popover width is still 
responding to its content.
   
   The width constraint only takes effect when space is limited. At normal 
desktop widths, the natural width remains unchanged and the existing 
three-column layout is preserved.
   
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   <!-- attach before-overflow.mp4 / after-overflow.mp4 and
        before-missing-fields.mp4 / after-missing-fields.mp4 -->
   
   Measured in a 1160×859 iframe:
   
   - Before
   <img width="1440" height="900" alt="before-missing-fields" 
src="https://github.com/user-attachments/assets/1494e66c-73bc-4efb-94e3-96923673253a";
 />
   
   
https://github.com/user-attachments/assets/2708fc62-cf62-426d-b13e-4d0d04d764e7
   
   
   - After
   
   <img width="1440" height="900" alt="after-missing-fields" 
src="https://github.com/user-attachments/assets/c352ad18-1952-4fce-90d2-d8453f65190b";
 />
   
   
https://github.com/user-attachments/assets/7625e7b6-1449-4921-9e5a-7668ec5fbe95
   
   - Before
   
   <img width="1440" height="900" alt="before-overflow" 
src="https://github.com/user-attachments/assets/effc93f9-bd17-4b7d-a48f-d4c2efb09430";
 />
   
   
   
https://github.com/user-attachments/assets/e06ac33b-73f0-4a72-945e-ae3381e179ad
   
   
   - After
   
   <img width="1440" height="900" alt="after-overflow" 
src="https://github.com/user-attachments/assets/7dac9c17-e8b4-44c3-a884-6bbdd13f7a48";
 />
   
   
   
https://github.com/user-attachments/assets/1aa7d8c9-b387-4234-ad85-874445383ee7
   
   
   ### TESTING INSTRUCTIONS
   
   Missing slice configuration fields:
   
   1. Pick a chart that has never been opened in Explore, so its 
`query_context` is  still `NULL` (`select id from slices where query_context is 
null`). It must be a viz type that can be an annotation source Table or Table 
V2 and be owned, created or favourited by you, since the Chart dropdown filters 
on `chart_owned_created_favored_by_me`.
   2. Open a Line chart in Explore, expand **Annotations and Layers**, click 
**Add annotation layer**.
   3. Set Annotation layer type to **Event** and Annotation source to 
**Table**, thenselect the chart from step 1.
   4. The Annotation Slice Configuration fields render, with the column list 
taken from the chart's saved `params`, and Apply/OK enable once a time column 
is set. On master the fields never appear and Apply/OK stay disabled.
   
   Viewport overflow:
   
   5. Embed Superset in an iframe narrower than the browser window (a host page 
with a sidebar), and repeat steps 2–3 with a source chart that *does* have a 
`query_context`, so the third section appears.
   6. The popover stays inside the iframe on both axes and Apply/OK remain 
clickable. On master the Display configuration column and Apply/OK are pushed 
off the right edge.
   7. Repeat at a full desktop width and confirm the three-column layout is 
unchanged.
   
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] 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