Commit Graph
1 Commits
Author SHA1 Message Date
Drew McLellan 4c4112fa1f feat(studio): select a usage project by clicking its name (#53671)
## Problem

On the organization usage page, the per-project breakdowns list project
names, but there's no way to jump to that project's usage. You have to
find it in the project dropdown instead. Resolves FE-5153.

## Solution

Project names in the usage breakdowns are now buttons that set the
`projectRef` filter and clear `branchRef`, so the page shows that
project's usage. The other query params, such as the date range, are
left alone.

- New `UsageProjectName` component. It renders plain text when that
project is already selected, and a button otherwise. It underlines on
hover only.
- Applied in the metric breakdown tooltip (`BillingMetric`), the compute
hover card (`ComputeMetric`) and the database size table
(`DatabaseSizeUsage`).
- `TotalUsage` passes the selected `projectRef` down to the metric
components.
- The `projectRef`/`branchRef` nuqs parsers are now shared as
`usageFilterParsers` in `Usage.utils.ts`, so `Usage` and
`UsageProjectName` use the same definition.

Tests cover the click updating the URL (and clearing `branchRef`), the
selected project rendering as text, and the `BillingMetric` breakdown in
both states.

<img width="410" height="296" alt="Screenshot 2026-11-19 at 13 36 17"
src="https://github.com/user-attachments/assets/1f032cc3-d0e2-4185-80f7-4ab3303fc6b6"
/>

## Review instructions

1. Open an organization's usage page (`/org/<slug>/usage`) for an org
with several projects.
2. Hover a metric that has a per-project breakdown, such as Egress, and
click a project name.
3. The project dropdown should switch to that project and the usage
should update. Any date range you had selected should survive the click.
4. Hover the same metric again. The selected project is now plain text
and the others are still clickable.
5. Do the same from the compute hover card and the database size table.

## Checklist

Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
2026-11-19 14:49:29 +00:00