Skip to content

Conversation

@DeeprajPandey
Copy link
Contributor

Fixes #2150

Summary

Adds icon-tooltips showing binary units (KiB, MiB, GiB) alongside SI units (KB, MB, GB) throughout the Manager UI. Users familiar with binary units can now view data in their preferred format without changing the primary display.

Changes

Core Utilities (data_formatting.ts)

  • Added formatBinaryBytes() with i18n support via Intl.NumberFormat
  • Added helper functions and binary unit constants (1024-based)

Tooltip Infrastructure (icon_tooltip/index.ts)

  • Added configurable position property (bottom/right/left/top)
  • Implemented auto-positioning to prevent off-screen rendering
  • Applied to metrics to prevent UI overlap

UI Components

  • Extended server-metrics-row-subcard with optional highlightTooltip property
  • Added binary tooltips to bandwidth metrics (current, peak, total, ASN breakdown)
  • Added binary tooltips to access key data usage meters

Note: Uses icon-tooltip component like existing patterns in table headers instead of native title attribute due to Electron Shadow DOM limitations that prevent native tooltips from displaying.

Screenshots

Bandwidth Metrics - Main Display

Screenshot of main bandwidth panel showing total bandwidth usage, current/peak bandwidth values with info icons. Screenshot shows tooltip to the right of the info icon next to total bandwidth value

Tooltip positions for this panel:

  1. total bandwidth: right
  2. current bandwidth: right
  3. peak bandwidth: bottom

ASN Breakdown Inline Tooltips

Screenshot comparing ASN table with info icons inside highlight chips. Comparison shows how the chips look like in default state and when the tooltip appears on click.

Info icons next to bandwidth values inside highlight chip for each AS.

Access Keys Data Usage

image

Binary value as tooltips for usage fractions (e.g., "403.42 MiB / 762.94 MiB")*

Key Design Decisions

  • Tooltips default to bottom position (existing behavior)
  • Use right position for inline values to prevent overlap
  • Auto-adjust when rendering would go off-screen

Testing

  • Verified tooltips display correctly in Electron
  • Tested tooltip positioning with various screen sizes
  • Confirmed i18n formatting works across locales (de, fr, ja, etc.).

Known Issues

  • Binary units (KiB, MiB, GiB) don't appear to have CLDR or Intl.NumberFormat translations. Numbers have been internationalized and units hardcoded. Suggestions for a better way to handle this would be really helpful!
  • Sometimes auto-positioning might overlap on existing UI elements. For instance, current bandwidth tooltip switches from right to left and hides the bytes value on smaller screens.

Add formatBinaryBytes() and related utilities to format byte values using binary units (base-1024) alongside existing SI units (base-1000).

- Add getBinaryDataFormattingParams() for unit selection
- Add formatBinaryBytesParts() for separated value/unit
- Add formatBinaryBytes() for complete formatted strings
- Define binary unit constants (KIBIBYTE, MEBIBYTE, GIBIBYTE, TEBIBYTE)

Functions use Intl.NumberFormat for proper i18n support.
Add optional highlightTooltip property to server-metrics-row-subcard for displaying additional information via icon-tooltip.

- Add highlightTooltip property to subcard component
- Render icon-tooltip inside highlight box when provided
- Pass highlightTooltip through parent server-metrics-row component
- Update CSS for flexbox alignment

Backward compatible. Existing usage continues to work unchanged.
Add icon-tooltips showing binary units (KiB/s, MiB/s, GiB/s) for all bandwidth displays. SI units remain primary display format.

- Add formatBandwidthBinaryTooltip() for rates with "/s" suffix
- Add formatDataAmountBinaryTooltip() for data amounts
- Add tooltips to current/peak bandwidth, data fractions, ASN subcards

Icon-tooltip used instead of native tooltips due to Electron limitations.
Add icon-tooltip to access key usage meter showing binary units (KiB/MiB/GiB) alongside SI unit display.

- Add formatBinaryTooltip() for usage/limit formatting
- Wrap label with icon-tooltip in flex container
- Update CSS selectors for warning state compatibility
Add position property to icon-tooltip to control tooltip placement and prevent UI overlap issues. Includes auto-adjustment when tooltip would render off-screen.

- Add TooltipPosition type for position options (bottom/right/left/top)
- Add position property with 'bottom' default (preserves existing behavior)
- Add calculatePosition() method with auto-adjustment logic
- Apply position="right" to bandwidth metrics and ASN subcards to prevent overlap

Tooltips now intelligently position themselves based on available screen space while respecting the preferred position parameter.
@DeeprajPandey DeeprajPandey requested a review from a team as a code owner October 11, 2025 04:11
@fortuna
Copy link
Collaborator

fortuna commented Oct 13, 2025

I have a few concerns:

  • Isn't the (i) icon intended to explain what the item is? The implemented behavior is surprising because it doesn't align with the expectations. I wonder if removing the (i) would be cleaner.
    • Ideally we would have an app-level unit setting. But we don't currently have affordances for that.
  • I worry about making the UI more complex and add more code we need to maintain for a unit that goes against the current best-practices.

Perhaps removing the (i) and have the tooltip over the number is a good compromise.

Replace icon-based tooltips with clickable text based. Extend icon-tooltip to wrap content via slots, making numbers directly clickable.

- Add slot support to icon-tooltip component
- Wrap bandwidth values, ASN highlights, and access key usage fractions
- Rename formatBinaryTooltip in `access_key_usage_meter/index.ts` to formatDataUsageFractionBinaryTooltip

Tooltip component now supports two modes: icon button (existing) or wrapped content (new), keeping all tooltip logic centralized.
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.

Add a tooltip with total bytes

2 participants