Repository navigation
feat(cloud-usage): customer page to its design - #9977
Draft
saddlepaddle wants to merge 17 commits into
Draft
saddlepaddle wants to merge 17 commits into
saddlepaddle wants to merge 17 commits into
Conversation
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Contributor
🚀 Preview Deployment🔗 Preview Links
Preview updates automatically with new commits |
|
Preview update published for development build |
saddlepaddle
force-pushed
the
superset/ui-c-customer-usage-page-to-the-mock-b6fd5e80
branch
from
November 18, 2026 18:21
a5cda8c to
412e767
Compare
Move the machine size display names out of the desktop size picker into @superset/shared/machine-size-names, so the cloud usage views can use the same translated names. No behaviour change: the message ids and contexts are the same. Co-Authored-By: Claude <noreply@anthropic.com>
…sign The customer cloud usage settings page, in the shared views so web and desktop change together: - Overview: the title and a period stepper (the period is in the URL), an allowance card for owners and admins (a summary card for members), By day and By person as full-width rows, and the top 8 workspaces with View all. No subtitle and no totals tiles. - A Workspaces page and a Workspace detail page with their own URLs, which replace the side sheet. The detail page has the four tiles, the boots table (started, duration, size, ended, GB-hours, usage) and, on desktop, Open workspace. - Dollars are the main figure wherever the router gives usageUsd, with GB-hours second; without a rate (billing off) GB-hours take their place. - Status pills use the design's words; size names are the product's machine size names. By person rows have avatars and link to that person's workspaces. The Billing link shows for owners and admins. - Columns fold by the page's width (container queries), so both shells fold at the same content width. Until cloud.usage.query filters by person, the Workspaces page loads every page and filters on the client when a person is chosen. The allowance lines stay in GB-hours until the periods output carries dollars. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
… reason Fills the parts of the customer cloud usage pages that waited for the router fields added in #9978: - Allowance card: "$used of $X included", or "of $X limit" when there is an extra-usage cap, and the design's lines: included with N seats, free credits, bought credits and extra usage, each "$used of $total", with a segmented bar. A "Usage limit reached" banner shows when the router says the open period hit its limit. - Workspaces page: search, person, size and status filters and sortable headers, all kept in the URL, with chips to remove a filter and a pager with the row count. The person filter now runs in the router, so the page no longer loads every page to filter on the client. - Workspace rows: "usage limit" beside Asleep when the last boot stopped at the limit. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
25 or 50 rows, kept in the URL like the filters. Co-Authored-By: Claude <noreply@anthropic.com>
The allowance card reads each period's unavailable list and says, once per reason, what it cannot show: a closed period's breakdown, values cached before seats, credits and the cap were read, the amount of a percentage cap, and a limit that is not tracked. Co-Authored-By: Claude <noreply@anthropic.com>
- The allowance card's "used" is the sum of its lines, and usage the billing lines do not hold shows as its own "Beyond the included total" line, so the headline and the lines always agree. - With no known cap the bar keeps its end open, so a full bar always means the cap. - The notes come from one record keyed by the router's reason. - One rule for GB-hours: whole numbers everywhere, "<1" for a small amount. - By day ticks every five days; with no billing periods the range is the last 30 UTC days, today included, not 30 x 24 hours. - Workspaces page: the page number is in the URL (?page=2), reached by loading the cursor pages before it; 15 or 50 rows per page, 15 by default; search is full width on narrow pages and has a clear button; "Clear all" is a chip; the last crumb reads "Workspaces" for members too. - GB-hours stays in the tables from 448 px of content width, and the size keeps its separator when it wraps. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
It is neither free nor paid, so it gets an "Other" group. Co-Authored-By: Claude <noreply@anthropic.com>
- The desktop Settings nav hides Cloud usage only when the router says FORBIDDEN (the flag is off), the same check as the page's gate; any other error leaves the page reachable so it can offer a retry. - By day: days that have not come yet have no value and no tooltip. - The person chip names the person from the rows' owner when the person has no usage row of their own, and shows no value when neither knows. Co-Authored-By: Claude <noreply@anthropic.com>
Co-located stories for the overview, the Workspaces page, the Workspace page and the allowance card, one per state, fed by seeded fixtures in the router's output shapes. A "shell" toolbar global puts each story in the web or desktop Settings content box, so it folds at the app's content width. Co-Authored-By: Claude <noreply@anthropic.com>
The pages show usage in dollars, with GB-hours next to them. When the router returns usage, boots or an allowance without dollars, the page shows its one error state, "Failed to load usage" with Retry, instead of a GB-hours-only layout. The check is pricedQuery/pricedPages in the shared view; the tables, chart, allowance card and summaries now take priced types, and the no-price note, branches and stories are gone.
No behaviour change. allowanceOf and creditLine move from the cloud router to router/cloud/allowance.ts, exported as @superset/trpc/cloud-allowance, and gbMinutesUsd moves to @superset/shared/billing (packages/db re-exports it). The billing reader's cloudUsageFromBalances is exported as @superset/auth/billing/cloud-usage. Neither module reads the database or the environment, so the cloud usage stories can build their data with the same arithmetic as the router.
- Tables: the owner truncates (with a title), and the workspace name takes the width left over, from a minimum, clamped to two lines. The Usage column stays on screen at every width. - Stories: each allowance is built from an Autumn balance through the billing reader and the router's own mapping, so a story holds only states the router can return. The states and numbers follow the design's organizations. Each period story has By day for its own range, boots come from the usage rows, and stories run on a fixed clock. "Open workspace" is only in the desktop stories. - Allowance card: with extra usage off, the included total is the cap, so the bar is not left open. What each line holds is written once, on AllowanceLine, and tested on the story data. Figures shown together use one money precision. - Priced types are one mapped type over the router's output, checked by one function. - The Workspaces page walks cursor pages only up to the last page there is, and shows its progress. - The workspace page keeps the workspace's name and status when the period has no usage row, from its usage over all time. - A boot with no recorded end says "Unknown". - Avatar and bar segment colours are fixed hues, the same in both themes. The size no longer starts with a stray separator when it wraps.
The line holds usage the period's events have and billing has not counted yet, so it reads "Not counted by billing yet" instead of "Beyond the included total".
- Allowance card: "Not counted by billing yet" is now only usage the period's events hold past billing's own total (its monthly usage plus each credit's usage). When a credit is not read, what the lines cannot place is "Not broken down yet", never unbilled. The lines always add up to the headline. Tested on story data and on hand-built values: all read, credits not read, everything not read. - Stories: boots and workspace states come from the billing state. "Usage limit" endings only in the state that reached its limit, where no workspace is awake; a boot that could not start runs 48 s and bills nothing; boot lengths vary. Rows are priced from their GB-hours at one rate, as the router prices them, so the GB-hours order is the Usage order. Tests hold the fixtures to these rules. - Tables: below 896 px of content the owner is at most 8rem, and a long workspace name is cut in the middle so its end stays visible. - The pager says "0 rows" when there are none. - UsageByDay takes today as a prop; the stories pass a fixed day instead of replacing Date for every story. - allowanceOf moves from packages/trpc to packages/auth, next to the billing reader whose output it maps, with no behaviour change. packages/trpc no longer has a subpath for it. The gbMinutesUsd re-export in packages/db sits after the imports.
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
The customer cloud usage settings page (behind the
cloud-usageflag, web and desktop) did not follow its design. This rebuilds it in the shared views (@superset/ui/cloud-usage-page), so web and desktop change together, and uses the router fields added in #9978./settings/cloud-usage): the title and a ‹ › period stepper (the period is in the URL as?period=). Owners and admins get an allowance card: "$used of $X included" (or "of $X limit" with an extra-usage cap), a segmented bar, and the lines included with N seats, free credits, bought credits and extra usage, each "$used of $total". Members get a summary card. Then By day and By person as full-width rows, and the top 8 workspaces with "View all". The card's "used" is the sum of its lines; usage the billing lines do not hold shows as its own "Beyond the included total" line, so the card always adds up. A "Usage limit reached" banner shows when the open period hit its limit. When the router cannot give a value (a closed period, data cached before these fields, a percentage cap, a limit it does not track), the card leaves the value out and says why, once per reason./settings/cloud-usage/workspaces): search, person, size and status filters, sortable headers, rows per page (15 or 50, 15 by default) and a pager with the row count, all in the URL, including the page (?page=2, reached by loading the cursor pages before it). Chips remove one filter at a time. Members get the search box only. By person rows link here, filtered by that person./settings/cloud-usage/workspaces/:id): replaces the side sheet. Four tiles (usage, GB-hours, hours, boots) and the boots table (started, duration, size, ended, GB-hours, usage). On desktop it also has "Open workspace".pricedQuery/pricedPagesin the shared view, and the views below it take priced types.Stories (
*.stories.tsx, co-located) cover every state of the overview, the Workspaces page, the Workspace page and the allowance card, in the web and desktop Settings shells, on a fixed clock. Each allowance in them comes from an Autumn balance through the billing reader and the router's mapping, so a story holds only states the router can return.A local dev environment with billing off shows the "Failed to load usage" state on these pages.
Preparation commit: the machine size names move to
@superset/shared/machine-size-names(no behaviour change, same message ids).No procedure, input or output changes. A no-behaviour-change commit moves the router's allowance mapping to
router/cloud/allowance.ts(exported as@superset/trpc/cloud-allowance) andgbMinutesUsdto@superset/shared/billing, and exports the billing reader'scloudUsageFromBalancesas@superset/auth/billing/cloud-usage, so the stories build their data with the router's own arithmetic. The workspace page adds one usage query over all time for the workspace's name when the period has no row.What breaks, for whom
Nothing for released clients: no procedure, input or output changed. Inside the flag, the side sheet is replaced by the Workspace page, and the period picker by the stepper.
Evidence
Mock | stories in the web shell, with the differences left (only deviations with a stated reason), and the web and desktop smoke passes: https://app.superset.sh/page/ui-c-customer-cloud-usage-page-against-the-mock-samkwc
Mock | stories in the desktop shell at 1024, 1280 and 1536 px, same view numbers: light https://app.superset.sh/page/ui-c-desktop-captures-light-sy2a3a, dark https://app.superset.sh/page/ui-c-desktop-captures-in-dark-29mn81
Design: https://app.superset.sh/page/admin-cloud-workspace-cost-and-health-design-8z3d4d
Checks
tsc --noEmitin packages/ui, apps/web, apps/desktopbun testin packages/ui (cloud usage, including the priced check), packages/i18n, packages/sharedbun run check:i18n(no missing messages, strict compile, React Compiler id check)