Skip to content

[SPARK-55767][UI] Use Bootstrap 5 Offcanvas for executor detail panels#54589

Closed
yaooqinn wants to merge 1 commit intoapache:masterfrom
yaooqinn:SPARK-55767
Closed

[SPARK-55767][UI] Use Bootstrap 5 Offcanvas for executor detail panels#54589
yaooqinn wants to merge 1 commit intoapache:masterfrom
yaooqinn:SPARK-55767

Conversation

@yaooqinn
Copy link
Member

@yaooqinn yaooqinn commented Mar 3, 2026

What changes were proposed in this pull request?

Replace full-page navigation for Thread Dump and Heap Histogram on the Executors page with Bootstrap 5 Offcanvas slide-out panels.

Key features:

  • Thread Dump and Heap Histogram open in a right-side slide-out panel instead of navigating away
  • Flamegraph renders correctly inside the offcanvas (d3/d3-flamegraph loaded dynamically)
  • Panel is resizable — drag the left edge to adjust width
  • "Open in new tab" button for full-page access
  • Loading spinner while content fetches
  • Fallback link on fetch failure

Why are the changes needed?

Part of SPARK-55760 (Spark Web UI Modernization). Keeping users on the Executors list while viewing details improves navigation flow.

Does this PR introduce any user-facing change?

Yes. Thread Dump / Heap Histogram links now open slide-out panels. Direct URL access to the detail pages still works.

How was this patch tested?

Scalastyle, JS lint, compilation pass. Manually verified with live Spark UI.

Was this patch authored or co-authored using generative AI tooling?

Yes, GitHub Copilot CLI was used.

Screenshots

Thread dump in offcanvas panel

Thread Dump opened in offcanvas panel

Flamegraph rendering in offcanvas

Flamegraph renders inside the offcanvas

Heap histogram in offcanvas

Heap Histogram in offcanvas panel

Resized offcanvas panel

Panel resized wider by dragging the left edge

Copy link
Member

@sarutak sarutak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except for two minor comments.

data: function (row) { return row.isActive ? row.id : '' },
render: function (data, type) {
return data != '' && type === 'display' ? ("<a href='threadDump/?executorId=" + data + "'>Thread Dump</a>" ) : data;
return data != '' && type === 'display' ? ("<a href='javascript:void(0)' class='offcanvas-link' data-detail-url='threadDump/?executorId=" + encodeURIComponent(data) + "' data-detail-title='Thread Dump for Executor " + data + "'>Thread Dump</a>" ) : data;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

javascript:void(0) seems not actually evaluated by popular browsers so this part doesn't cause a problem but how about relpace href='void(0) to href='#' here and the other place to comply with CSP?

if (fgChart) {
fgChart.querySelectorAll('script, link').forEach(function(el) { el.remove(); });
}
offcanvasBody.innerHTML = container.innerHTML;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about sanitizing whole container rather thanfgChart which is a part of container ?

### What changes were proposed in this pull request?

Replace full-page navigation for Thread Dump and Heap Histogram executor details with Bootstrap 5 Offcanvas slide-out panels on the Executors page.

**Changes:**
- **ExecutorsTab.scala**: Added BS5 Offcanvas markup (60vw wide, right-side slide-out panel)
- **executorspage.js**: Added `openDetailOffcanvas(url, title)` function that:
  - Shows a loading spinner while fetching content
  - AJAX-fetches the existing detail page HTML
  - Extracts the content via DOMParser
  - Injects it into the offcanvas body
  - Re-initializes BS5 tooltips and sorttable for injected content
  - Falls back to an error message with link to open in new page
- Changed Thread Dump and Heap Histogram links from `<a href>` to `onclick` offcanvas triggers

### Why are the changes needed?

Part of the Spark Web UI Modernization (SPARK-55760). The executor detail pages (Thread Dump, Heap Histogram) currently navigate away from the Executors list page. Using BS5 Offcanvas panels keeps the user in context:
1. No page navigation - detail info slides in from the right
2. Quick comparison between executors without navigating back and forth
3. Modern UX pattern consistent with BS5 adoption
4. The existing detail pages remain accessible via direct URLs

### Does this PR introduce _any_ user-facing change?

Yes. Clicking "Thread Dump" or "Heap Histogram" on the Executors page now opens a slide-out panel instead of navigating to a separate page. The detail pages remain accessible via direct URL.

### How was this patch tested?

- Scalastyle checks pass
- JS lint checks pass
- Compilation succeeds

### Was this patch authored or co-authored using generative AI tooling?

Yes, GitHub Copilot CLI was used.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@yaooqinn
Copy link
Member Author

yaooqinn commented Mar 4, 2026

Thanks @sarutak for the review! Both addressed:

  1. javascript:void(0)#: Changed both thread dump and heap histogram links. The click handler already has e.preventDefault() so href="#" won't scroll to top.

  2. Sanitize whole container: Now stripping all script and link tags from the entire fetched container before injecting, not just from fgChart.

@yaooqinn yaooqinn closed this in e3dd094 Mar 4, 2026
@yaooqinn yaooqinn deleted the SPARK-55767 branch March 4, 2026 01:42
@yaooqinn
Copy link
Member Author

yaooqinn commented Mar 4, 2026

Merged to master, thank you @dongjoon-hyun @sarutak

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants