Skip to content

[SPARK-55779][UI] Add tooltip helper utilities for Spark Web UI#54588

Open
yaooqinn wants to merge 1 commit intoapache:masterfrom
yaooqinn:SPARK-55779
Open

[SPARK-55779][UI] Add tooltip helper utilities for Spark Web UI#54588
yaooqinn wants to merge 1 commit intoapache:masterfrom
yaooqinn:SPARK-55779

Conversation

@yaooqinn
Copy link
Member

@yaooqinn yaooqinn commented Mar 3, 2026

What changes were proposed in this pull request?

This PR introduces helper utilities for tooltip markup generation in the Spark Web UI:

Scala helpers in UIUtils.scala:

  • tooltipSpan(content, text, placement) — wraps content in a <span> with BS5 tooltip attributes
  • tooltipLink(content, text, placement) — wraps content in an <a> with BS5 tooltip attributes

JS helper in stagepage.js:

  • setTooltip(selector, text) — sets BS5 tooltip attributes on a jQuery element

These helpers replace 21 inline tooltip patterns across 10 Scala files and 12 .attr() call chains in stagepage.js, reducing boilerplate and ensuring consistent tooltip markup.

Why are the changes needed?

Part of the Bootstrap 5 migration (SPARK-55760). Tooltip markup was duplicated across many files with slight variations. Centralizing it:

  1. Reduces code duplication
  2. Ensures consistent BS5 tooltip attributes (data-bs-toggle, data-bs-placement, title)
  3. Makes future tooltip-related changes easier (single point of change)

Does this PR introduce any user-facing change?

No. The rendered HTML is functionally identical — tooltips now consistently include data-bs-placement="top".

How was this patch tested?

  • Updated UIUtilsSuite to match new tooltip markup
  • All existing tests pass
  • Scalastyle and JS lint checks pass

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

Yes, GitHub Copilot CLI was used.

Add `UIUtils.tooltipSpan()` and `UIUtils.tooltipLink()` helper methods to centralize Bootstrap 5 tooltip markup generation, and a `setTooltip()` JS helper in stagepage.js.

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

This PR introduces helper utilities for tooltip markup generation in the Spark Web UI:

**Scala helpers in UIUtils.scala:**
- `tooltipSpan(content, text, placement)` - wraps content in a `<span>` with BS5 tooltip attributes
- `tooltipLink(content, text, placement)` - wraps content in an `<a>` with BS5 tooltip attributes

**JS helper in stagepage.js:**
- `setTooltip(selector, text)` - sets BS5 tooltip attributes on a jQuery element

These helpers replace 21 inline tooltip patterns across 10 Scala files and 12 `.attr()` call chains in stagepage.js, reducing boilerplate and ensuring consistent tooltip markup.

### Why are the changes needed?

Part of the Bootstrap 5 migration (SPARK-55760). Tooltip markup was duplicated across many files with slight variations. Centralizing it:
1. Reduces code duplication
2. Ensures consistent BS5 tooltip attributes (`data-bs-toggle`, `data-bs-placement`, `title`)
3. Makes future tooltip-related changes easier (single point of change)

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

No. The rendered HTML is functionally identical - tooltips now consistently include `data-bs-placement="top"`.

### How was this patch tested?

- Updated `UIUtilsSuite` to match new tooltip markup
- All existing tests pass
- Scalastyle and JS lint checks pass

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

2 participants