Skip to content

feat(069-B2): usage charts + Usage.vue + Dashboard switcher#571

Merged
Dumbris merged 2 commits into
mainfrom
069-b2-usage-frontend
Jun 2, 2026
Merged

feat(069-B2): usage charts + Usage.vue + Dashboard switcher#571
Dumbris merged 2 commits into
mainfrom
069-b2-usage-frontend

Conversation

@Dumbris
Copy link
Copy Markdown
Member

@Dumbris Dumbris commented Jun 2, 2026

Spec 069 Stream B2 (Frontend/Vue) — MCP-752

Surfaces the activity-log usage aggregate (GET /api/v1/activity/usage, shipped in A3 #565) as Web UI usage graphs. Covers tasks T016–T023.

What's in it

  • components/usage/CallHistogram.vue — calls per tool (horizontal bars).
  • components/usage/ResponseSizeRanking.vue — token-sink ranking by total response bytes, captioned as a size-based proxy for token cost (FR-006).
  • components/usage/ErrorRateChart.vue — error-rate bars + per-tool p50/p95 latency table (T019).
  • components/usage/Timeline.vue — stacked calls/errors over time, honoring the active window/filters (FR-008).
  • views/Usage.vue — tokens-saved headline from ServerTokenMetrics (FR-007), window selector (24h/7d/all), status + sort filters, and an empty/low-data state (FR-009); light 30s auto-refresh against the cached snapshot.
  • views/Dashboard.vue — Overview↔Usage switcher (T016). Overview is kept with v-show so its state survives a round-trip (SC-006); Usage is code-split via defineAsyncComponent so the chart bundle + fetch don't block Dashboard first paint (SC-004 — confirmed: separate 13 kB Usage-*.js chunk).
  • services/api.ts getActivityUsage() (T017) + UsageAggregateResponse types.
  • utils/usageFormat.ts — shared formatters + palette.

Note: B1 (T016/T017 — switcher + api method) had no committed work and shares the FrontendEngineer lane, so it's folded into this PR to keep the feature coherent. MCP-751 can close as covered here.

Verification (T023)

Playwright sweep (CLAUDE.md Web-UI workflow) against a populated instance (everything server, 4 tools seeded via MCP) and a fresh empty instance:

  • 7/7 scenarios pass, 0 console errors: overview-default/lazy-mount, populated charts (≥4 canvases), window 7d/all, status+sort filters, switch-back-preserves-overview, empty-state.
  • vue-tsc typecheck clean; vite build + go build (embedded UI) green.

HTML report + screenshots kept local (per repo QA-report policy), not committed.

PR — do not self-merge. Related #745.

Spec 069 Stream B2 (frontend). Surfaces the activity-log usage aggregate
(GET /api/v1/activity/usage, A3) as Web UI graphs.

- usage/CallHistogram.vue, ResponseSizeRanking.vue (size-based token-sink
  proxy, FR-006), ErrorRateChart.vue (+ per-tool p50/p95 latency table),
  Timeline.vue (calls/errors stacked, honors window/filters, FR-008).
- views/Usage.vue: tokens-saved headline from ServerTokenMetrics (FR-007),
  window selector (24h/7d/all), status/sort filters, empty/low-data state
  (FR-009), 30s auto-refresh against the cached snapshot.
- Dashboard.vue: Overview<->Usage switcher (T016); Overview kept via v-show
  so its state survives a round-trip (SC-006); Usage code-split via
  defineAsyncComponent so the chart bundle/fetch don't block first paint (SC-004).
- api.ts getActivityUsage() (T017) + UsageAggregateResponse types.
- utils/usageFormat.ts shared formatters + palette.

Covers T016-T023. Verified with a Playwright sweep (7/7, 0 console errors)
against populated + empty instances; report kept local per QA-report policy.

Related #745
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Jun 2, 2026

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: f68f441
Status:⚡️  Build in progress...

View logs

@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 2, 2026

📦 Build Artifacts

Workflow Run: View Run
Branch: 069-b2-usage-frontend

Available Artifacts

  • archive-darwin-amd64 (28 MB)
  • archive-darwin-arm64 (25 MB)
  • archive-linux-amd64 (16 MB)
  • archive-linux-arm64 (14 MB)
  • archive-windows-amd64 (28 MB)
  • archive-windows-arm64 (24 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (21 MB)
  • installer-dmg-darwin-arm64 (19 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 26795813629 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

# Conflicts:
#	frontend/src/services/api.ts
#	frontend/src/views/Dashboard.vue
@Dumbris Dumbris merged commit 37d203b into main Jun 2, 2026
12 of 14 checks passed
Dumbris added a commit that referenced this pull request Jun 3, 2026
The 069-B1 switcher tests broke when 069-B2 (#571) swapped the inline
usage panel for the real async Usage.vue. Two mount-side problems:

- The usage panel wrapper carried v-if="usageEverActive", so it was
  absent from the DOM on first paint and the exists() assertion failed.
  Move the lazy gate onto the inner <Suspense> instead: the wrapper div
  is now always present (hidden via v-show), while the chart bundle +
  usage fetch inside UsageView still mount only on first switch (SC-004),
  and the Overview subtree is preserved across switches (SC-006).

- shallowMount stubbed both <Suspense> and the async UsageView, so the
  real Usage.vue never rendered (no fetch, no window buttons). Un-stub
  Suspense and swap the async wrapper for an eagerly-imported Usage.vue
  so the fetch-on-activation and window-re-fetch logic actually runs; a
  dynamic import() never settles inside flushPromises + Suspense. Usage's
  chart grandchildren stay shallow-stubbed (no jsdom canvas).

Related #571
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.

2 participants