Skip to content

Settings panel: user-selectable size unit, persisted in localStorage #154

Description

@YanivZalach

Motivation

Size values are currently rendered in one hard-coded unit decided by the backend. Users working with small files see long strings of zeros, and users on large tables see huge numbers. The displayed unit should be the user's choice. This is also the first setting, so it establishes the settings mechanism for later ones.

Frontend outcomes

  • A gear button in the navbar opens a Settings panel, presented the same way as the existing Specs panel.
  • The panel contains a Size unit setting. The user picks exactly one unit and all size values across the app render in it: B, KB, MB, GB, TB (decimal, 1000^n) and KiB, MiB, GiB, TiB (binary, 1024^n).
  • Default is GB. Values are shown to 10 decimal places, with the unit next to the number.
  • The choice takes effect immediately, everywhere sizes appear (Metadata, FileTree, Timeline, Graph node detail panel).
  • Exception: the size text rendered inside the graph node label itself is unchanged.
  • The choice survives closing and reopening the browser.
  • The panel is structured so a second, unrelated setting can be added later without reworking it.

Backend

Stop pre-formatting sizes. Emit raw byte counts and let the frontend format.

  • collect_data_files: replace size_gb: str with size_in_bytes: int (the value straight from file_size_in_bytes).
  • collect_snapshots: leave *files-size summary values as raw byte integers instead of "X GB" strings.

Note: today's code divides by 1024**3 but labels the result GB, so current "GB" values are really GiB. Moving to raw bytes removes the mislabel.

Also in scope

  • MSW mock handlers updated to the new byte fields so the GitHub Pages demo stays correct.

Compatibility

This changes the /api/v1/graph-data response shape. A server and frontend at mismatched versions will show wrong or missing sizes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions