feat(site): polish AI budget members table - #26805
Conversation
dd18046 to
749d184
Compare
f2d3cfb to
a097f7d
Compare
3fa59a7 to
daabe1b
Compare
|
@ssncferreira quick contract question on the members payload (AIGOV-291): when no budget applies to a member, is The frontend renders both today, but differently:
If the me-endpoint semantics carry over, the second state can't happen and I'll drop it from the stories. |
8cc5b28 to
b206d9d
Compare
@EhabY this is related to the discussion around always having an effective group, i.e, defaulting to the Everyone group with an unlimited spend. Linear issue: AIGOV-509. Currently, |
Emphasize spend in the primary color until it nears the limit, add the reset date to the AI budget column tooltip (derived from the monthly AIBudgetPeriod rather than the unrelated chat usage-limit subsystem, and noted as rendering in local time), rename Budget type to Budget Source with a new tooltip, and show a dash in both columns when another group governs the member's budget.
Show the AI budget period on the group members tab, derive the reset date from the spend period, badge the budget source, and disable the override action when a member's budget is governed by another group. Escape the empty-cell dash placeholder so it doesn't trip make lint/emdash.
Render each member's AI spend against the viewed group, or unlimited/not-attributed when another group governs the budget, plus the governing budget group. Rename the limit_source override value from "override" to "user_override", clarify the governance tooltips to state plainly what's governing the budget, distinguish a group budget of exactly $0 from no budget configured (unlimited), and stop showing a dollar figure for spend governed by a group the viewer can't resolve. Adds per-state Storybook coverage, including an AIBudgetShowcase story covering every AI budget state in one table, and shares the spend severity color with AIBudgetUsage.
…e-governed members The dropdown disabled "Manage AI budget" whenever another group governed a member's spend, including the org-wide Everyone default. Since Everyone means the budget is simply unset, that blocked setting up a first override for any group without its own configured budget. Also dedupe the aibridge-visibility gate into a shared useAIBudgetVisible hook, fix a flash of the "unresolvable group" fallback while the governing group's name is still loading, and inline a couple of single-use locals.
…le-use AI spend hook useAISpend was only consumed by UserDropdown, so fold it into a plain toAISpend helper there instead of a dedicated hook module, and add a test covering its visibility and severity branching.
…bility check useAIBudgetVisible bundled a feature/experiment check together with a useQuery call. Since the experiment gate is temporary (AIGOV-443), just inline the check and call useQuery directly in each of its two consumers instead of maintaining a shared hook for it.
Derive notAttributed by composing isBudgetFromOtherGroup instead of reimplementing its comparisons, flatten a nested ternary for the budget group badge label, and inline a single-use class name in AIBudgetUsage. Also drop comments that just restated the story's exported name, its play()/step() assertions, or the line directly below them, keeping only the ones that explain non-obvious behavior.
b206d9d to
bf11493
Compare
ssncferreira
left a comment
There was a problem hiding this comment.
LGTM 👍 just a few notes regarding consistency mainly around the budget period and period reset
14e8062 to
0136986
Compare
Also flattens the member budget cells, unifies the em-dash placeholder, and trims restating comments.
0136986 to
72933cd
Compare
Follow the codebase's spread-based mock pattern instead of factory helpers, and inline single-use style/border logic at their call sites.
Finishing touches for the AI cost control group members table.
AIBudgetAmountcomponent that owns the spend-amount coloring. The severity class maps moved out ofutils/budget.tsinto the components that use them.UserAISpendtype is replaced with the generatedUserAISpendStatus, which also fixeslimit_source(previously sent asoverrideinstead ofuser_override).enabled, so unlicensed deployments no longer poll the enterprise spend endpoint.Skipped for now: the per-group spend breakdown ("Group breakdown" button and popover). The backend contract isn't defined yet, so it'll land in a follow-up.
Closes #26401