Skip to content

feat: extract BudgetDisplay component with progress bar and tooltip - #4055

Merged
akshaydeo merged 15 commits into
devfrom
06-04-chore_uniform_view_of_budget_and_limits_for_virtual_keys_table
Jun 5, 2026
Merged

feat: extract BudgetDisplay component with progress bar and tooltip#4055
akshaydeo merged 15 commits into
devfrom
06-04-chore_uniform_view_of_budget_and_limits_for_virtual_keys_table

Conversation

@impoiler

@impoiler impoiler commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Extracts the inline budget rendering logic from the virtual keys table into a reusable BudgetDisplay component, and upgrades the visual presentation from plain text to a color-coded progress bar with tooltips — matching the style of RateLimitDisplay.

Changes

  • Created ui/components/budgetDisplay.tsx with a new BudgetDisplay component that renders each budget line as a progress bar (emerald < 80% < amber < exhausted = red), with the max limit and reset period shown above and a tooltip displaying the exact current/max spend.
  • Replaced the inline budget rendering in VKBudgetCell with a call to <BudgetDisplay />, passing displayBudgets and calendarAligned.
  • Moved supportsCalendarAlignment usage and formatResetDuration logic into BudgetDisplay, keeping the calendar-aligned label suffix behavior intact.

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (React)
  • Docs

How to test

cd ui
pnpm i || npm i
pnpm build || npm run build

Navigate to the Virtual Keys table and verify that budget cells now display a progress bar with color coding (green, amber, red) and a tooltip showing current/max spend. Confirm calendar-aligned keys still show the (calendar) suffix.

Screenshots/Recordings

Before: Budget displayed as plain current / max text with a reset duration label below.

After: Budget displayed as a labeled progress bar with color thresholds and a hover tooltip for exact spend values.

Breaking changes

  • Yes
  • No

Related issues

Security considerations

None.

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

Summary by CodeRabbit

  • Improvements
    • Virtual key budget display now uses a unified visual component showing progress bars with color-coded usage levels, clearer capped percentages, and exhaustion indicators.
    • Tooltips now include exact usage vs. limit and reset timelines; empty budgets display a muted dash. Reset duration formatting and optional “(calendar)” annotation improved for clearer timelines.

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@impoiler, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 8 minutes and 52 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a3a265bf-2968-4e1e-9ae6-02c6d84f8066

📥 Commits

Reviewing files that changed from the base of the PR and between de5a5c7 and 880609d.

📒 Files selected for processing (2)
  • ui/app/workspace/virtual-keys/views/virtualKeysTable.tsx
  • ui/components/budgetDisplay.tsx
📝 Walkthrough

Walkthrough

Adds a new BudgetDisplay React component for rendering budget usage bars and replaces the virtual keys table's inline budget cell rendering with BudgetDisplay, also removing an unused governance constant import.

Changes

Budget Display Component Extraction

Layer / File(s) Summary
BudgetDisplay component implementation
ui/components/budgetDisplay.tsx
New component renders budget entries as progress bars with current/max usage tooltips, exhaustion flags, threshold-based coloring, and optional calendar-aligned reset duration labels; shows a muted dash for empty budgets.
Virtual keys table integration
ui/app/workspace/virtual-keys/views/virtualKeysTable.tsx
Imports BudgetDisplay and uses it in the budget column, replacing prior inline rendering logic; governance constants import updated to drop supportsCalendarAlignment.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • akshaydeo
  • danpiths

Poem

🐰 I hopped through code to paint a bar,
Colors that tell how close we are,
Compact and shared, no more repeat,
Budgets now march in tidy neat.
A tiny hop — UI looks smart!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: extracting a BudgetDisplay component with progress bar and tooltip functionality.
Description check ✅ Passed The PR description is comprehensive and well-structured, covering summary, changes, type of change, affected areas, testing steps, and breaking changes information aligned with the template.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 06-04-chore_uniform_view_of_budget_and_limits_for_virtual_keys_table

Comment @coderabbitai help to get the list of available commands and usage tips.

impoiler commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

@impoiler
impoiler force-pushed the 06-04-chore_uniform_view_of_budget_and_limits_for_virtual_keys_table branch from f49ad9d to dd1027f Compare June 4, 2026 12:07
@impoiler
impoiler force-pushed the 06-04-chore_make_the_filterable_entity_in_log_detail_sheets_clickable_for_filters branch from bf03ec6 to 6bc8c5f Compare June 4, 2026 12:07
@impoiler impoiler self-assigned this Jun 4, 2026
@impoiler
impoiler force-pushed the 06-04-chore_uniform_view_of_budget_and_limits_for_virtual_keys_table branch from dd1027f to f267909 Compare June 4, 2026 13:11
@impoiler
impoiler force-pushed the 06-04-chore_make_the_filterable_entity_in_log_detail_sheets_clickable_for_filters branch from 6bc8c5f to 75b9000 Compare June 4, 2026 13:11
@impoiler
impoiler force-pushed the 06-04-chore_uniform_view_of_budget_and_limits_for_virtual_keys_table branch from f267909 to 5eb0446 Compare June 4, 2026 14:31
@impoiler
impoiler force-pushed the 06-04-chore_make_the_filterable_entity_in_log_detail_sheets_clickable_for_filters branch 2 times, most recently from 03716d7 to b5e111e Compare June 5, 2026 04:53
@impoiler
impoiler force-pushed the 06-04-chore_uniform_view_of_budget_and_limits_for_virtual_keys_table branch from 5eb0446 to b95d788 Compare June 5, 2026 04:53
@impoiler
impoiler force-pushed the 06-04-chore_make_the_filterable_entity_in_log_detail_sheets_clickable_for_filters branch from b5e111e to 5ac2b1e Compare June 5, 2026 04:54
@impoiler
impoiler force-pushed the 06-04-chore_uniform_view_of_budget_and_limits_for_virtual_keys_table branch from b95d788 to 46aada1 Compare June 5, 2026 04:54
@roroghost17
roroghost17 marked this pull request as ready for review June 5, 2026 09:50
@greptile-apps

greptile-apps Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Clean UI refactor with no logic regressions; safe to merge.

The change is a pure extraction refactor — the new component reproduces the same percentage, exhaustion, and calendar-alignment logic faithfully, and the tooltip now also carries the "(calendar)" suffix which is a consistent improvement. No data-testid attributes are touched, no browser crypto APIs are introduced, and the existing import of resetDurationLabels in virtualKeysTable.tsx remains valid because the local formatResetDuration on line 66 still uses it.

No files require special attention.

Important Files Changed

Filename Overview
ui/components/budgetDisplay.tsx New BudgetDisplay component mirroring RateLimitDisplay with color-coded progress bars, tooltips, and calendar-aligned label support; logic and thresholds are correct.
ui/app/workspace/virtual-keys/views/virtualKeysTable.tsx VKBudgetCell inline rendering replaced by BudgetDisplay; supportsCalendarAlignment import removed; resetDurationLabels import retained for the existing local formatResetDuration on line 66.

Reviews (4): Last reviewed commit: "chore: uniform view of budget and limits..." | Re-trigger Greptile

Comment thread ui/components/budgetDisplay.tsx
@impoiler
impoiler force-pushed the 06-04-chore_uniform_view_of_budget_and_limits_for_virtual_keys_table branch from 46aada1 to de5a5c7 Compare June 5, 2026 13:48
@impoiler
impoiler force-pushed the 06-04-chore_make_the_filterable_entity_in_log_detail_sheets_clickable_for_filters branch from 45487db to f239b91 Compare June 5, 2026 13:51
@impoiler
impoiler force-pushed the 06-04-chore_uniform_view_of_budget_and_limits_for_virtual_keys_table branch from de5a5c7 to 7084c24 Compare June 5, 2026 13:51
@impoiler
impoiler force-pushed the 06-04-chore_uniform_view_of_budget_and_limits_for_virtual_keys_table branch from 7084c24 to 880609d Compare June 5, 2026 13:53
@impoiler
impoiler force-pushed the 06-04-chore_make_the_filterable_entity_in_log_detail_sheets_clickable_for_filters branch from f239b91 to 748d230 Compare June 5, 2026 13:53
@CLAassistant

CLAassistant commented Jun 5, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

akshaydeo commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Merge activity

  • Jun 5, 2:00 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jun 5, 2:15 PM UTC: @akshaydeo merged this pull request with Graphite.

@akshaydeo
akshaydeo changed the base branch from 06-04-chore_make_the_filterable_entity_in_log_detail_sheets_clickable_for_filters to graphite-base/4055 June 5, 2026 14:14
@akshaydeo
akshaydeo changed the base branch from graphite-base/4055 to dev June 5, 2026 14:15
@akshaydeo
akshaydeo merged commit d1b3d04 into dev Jun 5, 2026
10 of 11 checks passed
@akshaydeo
akshaydeo deleted the 06-04-chore_uniform_view_of_budget_and_limits_for_virtual_keys_table branch June 5, 2026 14:15
@akshaydeo akshaydeo mentioned this pull request Jun 7, 2026
akshaydeo pushed a commit that referenced this pull request Jun 7, 2026
…#4055)

## Summary

Extracts the inline budget rendering logic from the virtual keys table into a reusable `BudgetDisplay` component, and upgrades the visual presentation from plain text to a color-coded progress bar with tooltips — matching the style of `RateLimitDisplay`.

## Changes

- Created `ui/components/budgetDisplay.tsx` with a new `BudgetDisplay` component that renders each budget line as a progress bar (emerald < 80% < amber < exhausted = red), with the max limit and reset period shown above and a tooltip displaying the exact current/max spend.
- Replaced the inline budget rendering in `VKBudgetCell` with a call to `<BudgetDisplay />`, passing `displayBudgets` and `calendarAligned`.
- Moved `supportsCalendarAlignment` usage and `formatResetDuration` logic into `BudgetDisplay`, keeping the calendar-aligned label suffix behavior intact.

## Type of change

- [ ] Bug fix
- [ ] Feature
- [x] Refactor
- [ ] Documentation
- [ ] Chore/CI

## Affected areas

- [ ] Core (Go)
- [ ] Transports (HTTP)
- [ ] Providers/Integrations
- [ ] Plugins
- [x] UI (React)
- [ ] Docs

## How to test

```sh
cd ui
pnpm i || npm i
pnpm build || npm run build
```

Navigate to the Virtual Keys table and verify that budget cells now display a progress bar with color coding (green, amber, red) and a tooltip showing current/max spend. Confirm calendar-aligned keys still show the `(calendar)` suffix.

## Screenshots/Recordings

Before: Budget displayed as plain `current / max` text with a reset duration label below.

After: Budget displayed as a labeled progress bar with color thresholds and a hover tooltip for exact spend values.

## Breaking changes

- [ ] Yes
- [x] No

## Related issues

## Security considerations

None.

## Checklist

- [ ] I read `docs/contributing/README.md` and followed the guidelines
- [ ] I added/updated tests where appropriate
- [ ] I updated documentation where needed
- [ ] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

* **Improvements**
  * Virtual key budget display now uses a unified visual component showing progress bars with color-coded usage levels, clearer capped percentages, and exhaustion indicators.
  * Tooltips now include exact usage vs. limit and reset timelines; empty budgets display a muted dash. Reset duration formatting and optional “(calendar)” annotation improved for clearer timelines.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
akshaydeo added a commit that referenced this pull request Jun 7, 2026
## ✨ Features

- **OpenAI Compaction** — Added OpenAI conversation compaction support
across core, framework, logging, and the API surface (#4053)
- **Multi-Customer & Org Hierarchy** — Logs and usage tracking now
support multiple customers, teams, and business units, including
business unit CRUD, team assignment, and governance endpoints in the
OpenAPI spec (#4066, #4041, #4082)
- **Provider-Level Governance** — Budgets & limits are now scope-aware
and can be applied at the virtual-key top level and per provider, wired
from the model configs table, with UI filters for scope and providers
(#3938, #3937, #3939, #3981, #3962)
- **Customer Budgets** — Customers support multiple budgets and
`calendar_aligned` budget windows (#3998, #3997)
- **Virtual Key Attribution & Controls** — Added a `created_by` user
attribution column and a `blacklisted_models` column for virtual key
provider configs (#3672, #3653)
- **Request Header Capture** — OTel and Maxim observability plugins
capture `request_headers` by pattern, with wildcard support (e.g.
`x-custom-*`); logging gained the same wildcard header capture (#4012,
#3958)
- **OTel Content Controls & Collectors** — New `disable_content_logging`
option drops message/tool content from exported spans, plus support for
multiple OTel collectors (#4064, #3894)
- **xAI x_search** — Added xAI `x_search` tool support (#3976)
- **URL Validation** — Added fetch URL validation with private-network
configuration and link-local blocking (#3947, #3991)
- **File Scheme Pricing URLs** — Pricing source URLs now accept the
`file://` scheme for air-gapped and self-hosted deployments (#4045)
- **Paginated Virtual Keys** — Virtual key fetching is paginated to
handle deployments with very large numbers of keys (#3957)
- **Client IP Resolution** — Resolve client IP from
`X-Forwarded-For`/`X-Real-IP` headers
- **SCIM Provisioning** — Added `attributeType`/`attributeValue` SCIM
provisioning fields
- **Helm/Config Schema** — Added `roles` RBAC governance config and
`per_user_oauth` MCP auth to the Helm chart and config schema (#4004,
#4009)
- **Log Navigation UI** — Added a "View logs" menu item to customer,
team, and virtual key tables, clickable links in log detail views, a
customer detail sheet, and a reusable `BudgetDisplay` component (#4073,
#4054, #4026, #4055)
- **Faster First Paint** — Added an inline loading shell to `#root`
before React mounts (#4063)
- **Materialized View Alias** — Added an `alias` column to the
materialized view with filter support (#4078)

## 🐞 Fixed

- **Fetch URL IP Checks** — Hardened fetch URL IP checks against SSRF
(#4092)
- **Mantle Model Matching** — Broadened Mantle model matching to all
`gpt` variants (#4091)
- **Empty Thinking Blocks** — Strip thinking blocks when the signature
is empty (#4079)
- **OpenAI Stream Usage** — Removed usage from the `responses.created`
event in the OpenAI stream (#4080)
- **Prompt Cache Key** — Set the prompt cache key from the Anthropic
integration (#4086)
- **Upstream Failure Status** — Map upstream connection failures to 502
instead of 400 (#3929) (thanks
[@chris-colinsky](https://github.com/chris-colinsky)!)
- **Gemini Schema Constraints** — Accept numeric schema integer
constraints for Gemini (#3994) (thanks
[@yanhao98](https://github.com/yanhao98)!)
- **Files Provider Param** — Accept the `?provider=` query param on `GET
/v1/files` (#3971) (thanks [@alexef](https://github.com/alexef)!)
- **Optional Batch Model** — Made the `model` field optional on `POST
/v1/batches` (#3973) (thanks [@alexef](https://github.com/alexef)!)
- **Helm Azure Config** — Added missing `azure_key_config` fields to the
Helm schema (#3996) (thanks
[@axelray-dev](https://github.com/axelray-dev)!)
- **Text Completion Chunk Model** — Added the missing `Model` field to
`TextCompletionChunkResponse` (#3970) (thanks
[@kuishou68](https://github.com/kuishou68)!)
- **MCP Inline stdio Env** — MCP stdio server configs accept inline
environment variable assignments (#3861) (thanks
[@Shushmitaaaa](https://github.com/Shushmitaaaa)!)
- **Orphaned Tool Results** — Orphaned tool results in the OpenAI to
Anthropic conversion flow are no longer rejected by the Anthropic API
(#3919)
- **Node Usage Reconciliation** — Added a monotonic `inc_number` log
cursor so node usage reconciliation does not skip late async log writes
(#3664)
- **Bedrock Output Assessments** — Corrected the type of
`outputAssessments` in Bedrock responses (#4028)
- **Model Pool Pricing Reloads** — Preserve non-pricing model pool
entries across pricing reloads (#3999)
- **Ghost Node Reconciliation** — Replicate the VK hierarchy flow for
ghost node reconciliation (#4088)
- **VK Double Usage Counting** — Fixed double usage counting when
creating a virtual key (#4070)
- **Model Config Lifecycle** — Cascade deletes for model configs and
removal of stale in-memory model configs (#4051, #4043)
- **FTS Index Cap** — Reduced the FTS index `left()` cap from 800k to
250k chars to stay within the tsvector limit (#4057)
- **Sync Worker Drift** — Reduced the sync worker ticker period to 5m to
prevent threshold drift (#4023)
- **Passthrough** — Fixed passthrough budgets, gated passthrough models
per VK, model extraction for Azure passthrough, and restricted
fallbacks/provider selection to the VK boundary (#3941, #3988, #3983,
#3924)
- **Provider Response Headers** — Strip provider response headers and
add a content-type filter (#3955, #4024)
- **Stream Handling** — Drain non-SSE stream readers and retry stale
connections (#3956, #3967)
- **Azure Claude** — Strip Azure diagnostic property for Claude models
(#3925)
- **Compat max_tokens** — Preserve chat `max_tokens` during param
filtering (#3992)
- **Raw Request Flag** — Removed the raw request flag from providers
that don't support it (#4058)
- **UI Fixes** — Standardized page container layout, virtual key model
configs UI, and dashboard chart tooltips (#4046, #4052, #4044)

## 🔧 Maintenance

- **Dependency Upgrades** — Bumped transitive `golang.org/x`
dependencies (crypto, net, sys, text) for Docker Scout CVE remediation
and `recharts` to 3.8.1; cascaded version bumps across all modules
(#3900, #4003)
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.

4 participants