Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
2dc63af
Add Usage tab with preview-site quota and delete-all to agentic settings
bcotrim Jul 21, 2026
a239537
Merge remote-tracking branch 'origin/trunk' into agentic-settings-usa…
bcotrim Jul 22, 2026
6dfc351
Replace nested ternary with helper for delete-preview-sites label
bcotrim Jul 22, 2026
9e7f6ca
Merge branch 'trunk' into agentic-settings-usage-tab
bcotrim Jul 22, 2026
562a4ac
Keep optimistic zero after delete-all instead of racing a stale usage…
bcotrim Jul 22, 2026
b9511ac
Merge branch 'agentic-settings-usage-tab' of github.com:Automattic/st…
bcotrim Jul 22, 2026
f745456
Merge remote-tracking branch 'origin/trunk' into agentic-settings-usa…
bcotrim Jul 22, 2026
daebb08
Show Studio Code AI usage quota in the agentic Usage settings tab (#4…
sejas Jul 22, 2026
d45228e
Warn once when offline in the Usage tab and share the quota formatters
bcotrim Jul 22, 2026
3c26b8f
Reuse the app sign-in and offline banners in the Usage tab
bcotrim Jul 22, 2026
a1260c5
Move the Usage banner above the card and use disabled colors for unav…
bcotrim Jul 22, 2026
c10e9a6
Grey the whole Usage card and hatch unavailable meters
bcotrim Jul 22, 2026
bd3c68b
Soften the hatch on unavailable usage meters
bcotrim Jul 22, 2026
c78c48a
Hide usage figures while offline instead of showing stale numbers
bcotrim Jul 22, 2026
a28f998
Merge remote-tracking branch 'origin/trunk' into agentic-settings-usa…
bcotrim Jul 22, 2026
bf80539
Show a progress bar in both usage sections while loading
bcotrim Jul 22, 2026
e2b0415
Empty the preview sites bar while usage is loading
bcotrim Jul 22, 2026
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Empty the preview sites bar while usage is loading
  • Loading branch information
bcotrim committed Jul 22, 2026
commit e2b0415ccbb1fec79dd488eddaa3959214369d0a
16 changes: 13 additions & 3 deletions apps/ui/src/components/settings-view/usage-panel.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,24 @@ describe( 'UsagePanel', () => {
expect( deleteSnapshotsMutate ).not.toHaveBeenCalled();
} );

it( 'shows a loading row with a progress bar in both sections', () => {
it( 'shows a loading row with an empty progress bar in both sections', () => {
useStudioAssistantQuotaMock.mockReturnValue( { data: undefined, isLoading: true } as never );
useSnapshotUsageMock.mockReturnValue( { data: undefined, isLoading: true } as never );
// Preview usage is still cached from before the delete, so the bar would
// otherwise keep its old fill next to a "Loading..." row.
useDeleteAllSnapshotsMock.mockReturnValue( {
mutate: deleteSnapshotsMutate,
isPending: true,
error: null,
} as never );

render( <UsagePanel /> );

expect( screen.getAllByText( 'Loading...' ) ).toHaveLength( 2 );
expect( screen.getAllByTestId( 'usage-progress-bar' ) ).toHaveLength( 2 );
const bars = screen.getAllByTestId( 'usage-progress-bar' );
expect( bars ).toHaveLength( 2 );
for ( const bar of bars ) {
expect( bar.firstElementChild ).toHaveStyle( { inlineSize: '0%' } );
}
} );

it( 'replaces figures and actions with the offline notice while offline', () => {
Expand Down
4 changes: 3 additions & 1 deletion apps/ui/src/components/settings-view/usage-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ function PreviewSitesSummary( { userId }: { userId: number } ) {
const snapshotCreationBlocked = snapshotUsage?.siteCreationBlocked ?? false;
const isLoadingPreviewUsage = isLoading || isLoadingSnapshotUsage || deleteAllSnapshots.isPending;
const isDisabled = siteCount === 0 || snapshotCreationBlocked || isLoadingPreviewUsage;
const fraction = clampQuotaFraction( siteCount, siteLimit );
// Empty while loading: a bar still filled from the previous figure would
// contradict the "Loading..." row next to it.
const fraction = isLoadingPreviewUsage ? 0 : clampQuotaFraction( siteCount, siteLimit );
const deletePreviewSitesLabel = deleteAllSnapshots.isPending
? __( 'Deleting preview sites...' )
: __( 'Delete all preview sites' );
Expand Down