feat: add plugin version trend graph#1638
Conversation
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThe changes add a trend chart feature to the admin plugin dashboard. The backend now retrieves and formats plugin version breakdown data across multiple time points as a trend array. The frontend adds computed properties to process this trend data and renders a new multi-line chart visualization displaying version breakdown evolution over time. Changes
Sequence Diagram(s)sequenceDiagram
participant FE as Admin Dashboard<br/>(Vue)
participant API as Backend API<br/>(pg.ts)
participant DB as Database
FE->>API: Request plugin breakdown data
activate API
API->>DB: SELECT plugin metrics ordered by date
activate DB
DB-->>API: Return all historical rows
deactivate DB
Note over API: Process rows into trend array<br/>Extract latest for main fields
API-->>FE: Return AdminPluginBreakdown<br/>with trend array
deactivate API
activate FE
Note over FE: Compute versionTrendPoints<br/>from trend array
Note over FE: Filter top N versions<br/>(maxTrendVersions)
Note over FE: Build versionTrendSeries<br/>for multi-line chart
FE->>FE: Render AdminMultiLineChart<br/>with series data
deactivate FE
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds a plugin-version “over time” visualization to the admin plugins dashboard by extending the existing plugin_breakdown stats payload with a trend series while preserving the current snapshot cards and bar charts.
Changes:
- Extend backend
AdminPluginBreakdownpayload to include atrendarray derived fromglobal_statsover the selected date range. - Update
/admin/dashboard/pluginsto compute top versions and render a new multi-line trend chart.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| supabase/functions/_backend/utils/pg.ts | Expands getAdminPluginBreakdown to return both latest snapshot + full time-series trend data. |
| src/pages/admin/dashboard/plugins.vue | Adds computed trend series selection and renders a new “Version Breakdown Over Time” chart. |
| <AdminMultiLineChart | ||
| :series="versionTrendSeries" | ||
| :is-loading="isLoadingBreakdown" | ||
| /> |
There was a problem hiding this comment.
The trend values are percentages (per global_stats.plugin_version_breakdown comment), but AdminMultiLineChart currently formats the y-axis ticks and tooltip as raw numbers (no "%", no fixed decimals). This makes the new chart inconsistent with the existing bar charts and ambiguous to interpret. Consider extending AdminMultiLineChart (or adding an option in this page) to format values as percentages (e.g., tick callback appends "%" and tooltip shows value.toFixed(2)+"%", optionally also deriving device counts when devices_total is available).
|



Summary (AI generated)
/admin/dashboard/plugins.plugin_breakdownadmin stats payload with a backward-compatibletrendfield.Motivation (AI generated)
The plugins dashboard showed only a latest snapshot, making version adoption trends hard to track.
Business Impact (AI generated)
Admins can monitor plugin-version rollout over time and react faster to slow upgrades.
Test plan (AI generated)
bun lint:backendbun linthttps://console.capgo.app/admin/dashboard/pluginsand verify the new chart renders with date-range changesScreenshots (AI generated)
Checklist (AI generated)
bun run lint:backend && bun run lint.accordingly.
my tests
Generated with AI
Summary by CodeRabbit