Skip to content

feat(site/src): add AI spend summary cards, unpriced model details, and CSV export - #29862

Closed
tracyjohnsonux wants to merge 71 commits into
mainfrom
tracy/user-spend-filters
Closed

tracyjohnsonux wants to merge 71 commits into
mainfrom
tracy/user-spend-filters

Conversation

@tracyjohnsonux

@tracyjohnsonux tracyjohnsonux commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

This PR adds summary cards, unpriced model details, top models and clients tooltips, and a CSV export to the AI Settings User spend page. The spend filters are unchanged from main.

  • Summary cards above the table show total spend, user count, and timeframe (abbreviated months, such as "Feb 10 - Mar 12") for the current filters and period. They replace the old "Total spend" line.
  • Unpriced models: the warning icon is 16px on user rows and in the total spend card ("Model pricing missing"). Hovering it opens a card that lists the models without pricing. Viewers who can update model prices also get a "Set pricing for these models" link to the organization's models page.
  • Models and Clients tooltips show "Top models" / "Top clients" (Based on cost) and at most five rows. The badge still counts every item. The Providers column is unchanged.
  • Export CSV after the date picker downloads the existing /api/v2/organizations/{organization}/ai/spend/export for the selected period, provider, and model.

This PR is frontend-only. Backend support still needed:

  • Return the models with unpriced usage per user and across the report. Until then the page infers them from the model price catalog (/api/experimental/ai/model-prices): a user's model counts as unpriced when none of their providers has a price for it. The report doesn't pair models with providers, and usage recorded before a price was added can't be identified, so the card falls back to a generic message in that case. Only deployment owners can read the catalog today, so other viewers always get the generic message. The summary card loads every matching user, in pages of 100, to build its list.
  • Return cost-ranked top models and top clients per user, capped at five, so those tooltips are truly based on cost. Until then they list the first five entries of the existing alphabetical lists.
  • Let the CSV export accept client. The export endpoint rejects it, so a client filter isn't applied to the download.
Coder Agents disclosure

This PR was generated with Coder Agents on behalf of @tracyjohnsonux.

tracyjohnsonux and others added 30 commits September 8, 2026 17:17
Design review fixes for the unified workspace search and filter:

- Show a dotted filter icon on the toggle while any chip is applied.
- Render chips as a muted `key:` prefix with a prominent value.
- Present Attributes chips as `attribute:<key>` and rename the category
  key to `attribute` (with `attributes` as an alias) so chips, the draft
  prefix, and typed prefixes all use the same pattern.
- Dropdown rows: 34px tall, 8px horizontal padding, 24px icon slot with
  18px lucide icons and 24px avatars, 13px regular text, group headers
  with 16px above (8px list padding only for the first header).
- Use `BuildingIcon` for Organization and `TagIcon` for Attributes.
- Result rows inherit the row colour so text and icons highlight
  together; drop the workspace result subtitle.
- Size the chip-row input to its content so an empty input never forces
  a second row, and match its height to a chip so the box does not
  change height when the first chip is added.
- Prefix the pagination summary with "Filtered:" while a query is set
  and use "No workspaces match your search." for empty filtered
  results, with a "Clear all" button in the empty state.
Owner, Status, Attributes, Template, Organization.
Keep Building2Icon for Organization to match the rest of the app, and
render the dotted active filter icon at 20px so it reads the same size
as the plain 18px icon.
Each category row in the filter dropdown now ends with either the labels
of its applied chips plus a check mark, or a short sample of its options
(templates and organizations are pulled from the deployment). Categories
can provide a hint shown while options load.
Clicking the filter toggle, or pressing Backspace on an empty input, while a
category is open returns to the category list instead of closing the menu.
…ate and drop mobile scroll timers

Inline categories such as Status and Workspace attributes no longer enter
category mode when their prefix is typed; the prefix narrows the inline
group in place, so no duplicate flyout renders. The pointer flyout now
follows the cmdk highlight, closing or switching when keyboard
navigation moves on. The browsing and category main panels share one
renderer. On mobile the open field pins below the navbar with CSS
instead of timer-driven scrolling.
… highlighted after leaving it

Returning from a category with ArrowLeft or by picking an option left
cmdk pointing at an unmounted option row, so nothing in the menu looked
focused. The highlighted row is now controlled state owned by the hook
and is set back to the parent category on return. This also replaces
the highlight reset counter with the controlled value and drops
memoization around cheap derived lists.
…eedback

# Conflicts:
#	site/src/pages/WorkspacesPage/filter/WorkspacesFilter.stories.tsx
#	site/src/pages/WorkspacesPage/filter/WorkspacesFilter.tsx
…mouse-interactions

# Conflicts:
#	site/src/components/Filter/FilterCombobox/primitives.tsx
#	site/src/pages/WorkspacesPage/WorkspacesPage.stories.tsx
#	site/src/pages/WorkspacesPage/WorkspacesPage.tsx
#	site/src/pages/WorkspacesPage/filter/WorkspacesFilter.stories.tsx
#	site/src/pages/WorkspacesPage/filter/WorkspacesFilter.tsx
Replaces the separate User category with a switch in the Owner list
footer. While on, picking a user commits user:<name>, which also matches
workspaces shared with them, and the chip reads owner: <name> +shared.
Flipping the switch rewrites an applied Owner chip in place. The Shared
attribute option is removed in favor of the toggle. Clicking the already
focused input reopens a dismissed menu, and a dismissed flyout no longer
reappears on reopen.
The toggle is on by default. While on, the search field shows a
removable include shared pill instead of a chip suffix, and removing
it narrows the applied Owner chip. Applied chips always render in
lowercase regardless of the option label shown in the menu.
@tracyjohnsonux
tracyjohnsonux changed the base branch from main to fix/filter-combobox-mouse-interactions September 24, 2026 16:45
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@github-actions

Copy link
Copy Markdown
Contributor

Docs preview

Check off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here.

Changed images

These images changed. Each is listed with the navigable page(s) that embed it, so you can open the preview and see the new image in context. An image with no page listed isn't embedded by any navigable docs page. These links are informational and have no review checkboxes.

@tracyjohnsonux
tracyjohnsonux changed the base branch from fix/filter-combobox-mouse-interactions to main September 24, 2026 16:45
…ouse-interactions

# Conflicts:
#	site/src/components/Filter/FilterCombobox/FilterCombobox.stories.tsx
#	site/src/components/Filter/FilterCombobox/FilterCombobox.tsx
#	site/src/components/Filter/FilterCombobox/filterQuery.ts
#	site/src/components/Filter/FilterCombobox/primitives.tsx
#	site/src/components/Filter/FilterCombobox/types.ts
#	site/src/components/Filter/FilterCombobox/useFilterCombobox.ts
#	site/src/pages/WorkspacesPage/filter/WorkspacesFilter.stories.tsx
#	site/src/pages/WorkspacesPage/filter/WorkspacesFilter.tsx
#	site/src/pages/WorkspacesPage/filter/categoryOptions.tsx
Merge main and keep only the non-filter spend page changes: summary
cards, unpriced model hover cards, top models and clients tooltips, and
the CSV export.
@tracyjohnsonux tracyjohnsonux changed the title feat(site): unify AI spend filters feat(site/src): add AI spend summary cards, unpriced model details, and CSV export Sep 29, 2026
@linear-code

linear-code Bot commented Oct 8, 2026

Copy link
Copy Markdown

CODAGT-1121

@tracyjohnsonux tracyjohnsonux added the experimental Changes that might not necessarily be merged, until its approved to proceed with. label Oct 21, 2026
@github-actions github-actions Bot added the stale This issue is like stale bread. label Oct 31, 2026
@github-actions github-actions Bot closed this Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

experimental Changes that might not necessarily be merged, until its approved to proceed with. stale This issue is like stale bread.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants