Skip to content

#41: Add typed formatBytes utility function - #42

Closed
coderhelm[bot] wants to merge 2 commits into
mainfrom
coderhelm/sbx-e2e-3
Closed

coderhelm[bot] wants to merge 2 commits into
mainfrom
coderhelm/sbx-e2e-3

Conversation

@coderhelm

@coderhelm coderhelm Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Closes #41

Problem

formatBytes exists only as a private inline function in dashboard/src/app/settings/aws/page.tsx, making it unavailable for reuse elsewhere.

Changes

dashboard/src/lib/formatBytes.ts (added)

  • Exports formatBytes(bytes: number, decimals?: number): string
  • Guards against negative and non-finite inputs, returning "N/A"
  • Supports configurable decimal precision, defaulting to 1, clamped to [0, 20]
  • Unit progression: B, KB, MB, GB, TB, PB using base-1024

Risk

Low — purely additive. No existing files modified. No call sites changed.

Verification

  1. cd dashboard && npx tsc --noEmit — expect no errors
  2. Import formatBytes from @/lib/formatBytes in any file and confirm type resolution
  3. Verify formatBytes(1536) returns "1.5 KB" and formatBytes(-1) returns "N/A"

@coderhelm
coderhelm Bot force-pushed the coderhelm/sbx-e2e-3 branch from 3b2ce76 to 1e282f7 Compare July 23, 2026 05:02
@coderhelm
coderhelm Bot marked this pull request as ready for review July 23, 2026 05:06
@nambok nambok closed this Jul 23, 2026
@nambok
nambok deleted the coderhelm/sbx-e2e-3 branch July 23, 2026 05:37
nambok added a commit that referenced this pull request Oct 27, 2026
…lter (#247)

Each row's meta line and the run page's header now say what started the
run, from the `trigger` the runs API sends: "Jira · ABC-123 · by Dana",
"GitHub issue · #42 · by octocat", "Started by Coderhelm · flaky test",
"Alert", "Plan · <plan>", "Dashboard · log finding · by <person>", with
a small icon and a link to the ticket, test, finding, alert or plan.
Internal ticket ids (E2E-FIX-..., LOG-..., ALERT-...) are no longer shown
as the ticket; the run's Details tab lists them as "Internal ID".

A "Started by" select (Jira, GitHub, Coderhelm, Alerts, Plans, Dashboard,
Chat) sits next to the status toggles, is kept in the address as
`started_by`, and is sent to the server. A backend without `trigger`
shows the ticket as before.

openapi-fields.ts is pinned to coderhelm-platform 3d0ddc4 (the PR adding
`trigger`), and api-contract.ts holds RunTrigger to it.
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 typed formatBytes utility

1 participant