Skip to content

feat: add plugin version trend graph#1638

Merged
riderx merged 1 commit into
mainfrom
riderx/plugin-version-graph
Feb 15, 2026
Merged

feat: add plugin version trend graph#1638
riderx merged 1 commit into
mainfrom
riderx/plugin-version-graph

Conversation

@riderx
Copy link
Copy Markdown
Member

@riderx riderx commented Feb 15, 2026

Summary (AI generated)

  • Add a new "Version Breakdown Over Time" chart on /admin/dashboard/plugins.
  • Extend plugin_breakdown admin stats payload with a backward-compatible trend field.
  • Keep the existing snapshot cards and bar charts unchanged.

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:backend
  • bun lint
  • Open https://console.capgo.app/admin/dashboard/plugins and verify the new chart renders with date-range changes

Screenshots (AI generated)

  • Not included (UI verification not run in a browser in this workspace)

Checklist (AI generated)

  • My code follows the code style of this project and passes
    bun run lint:backend && bun run lint.
  • My change requires a change to the documentation.
  • I have updated the documentation
    accordingly.
  • My change has adequate E2E test coverage.
  • I have tested my code manually, and I have provided steps how to reproduce
    my tests

Generated with AI

Summary by CodeRabbit

  • New Features
    • Added a new "Version Breakdown Over Time" trend chart to the admin dashboard, displaying how plugin version distribution changes over historical periods.
    • Enhanced backend data collection to provide historical trend data for version breakdown analytics.

Copilot AI review requested due to automatic review settings February 15, 2026 20:28
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 15, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The 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

Cohort / File(s) Summary
Frontend Trend Chart UI
src/pages/admin/dashboard/plugins.vue
Adds PluginBreakdownTrendPoint type and trend rendering constants (maxTrendVersions, trendColorPalette). Introduces computed properties (versionTrendPoints, topVersionsForTrend, versionTrendSeries, hasVersionTrendData) to derive multi-line chart data from trend array. Renders new ChartCard with AdminMultiLineChart component displaying "Version Breakdown Over Time" with responsive loading and data guards.
Backend Trend Data Pipeline
supabase/functions/_backend/utils/pg.ts
Updates AdminPluginBreakdown interface to include trend array field. Changes query to return all historical rows (not limited to one) ordered ascending by date. Processes rows into trend array containing date, version_breakdown, and major_breakdown for each point. Uses latest row data for main fields and populates trend: [] on errors or empty results.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 A fluffy chart ascends the sky,
Each version tracked as time goes by,
With trends that dance in colors bright,
The plugins' story, brought to light! ✨📈

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch riderx/plugin-version-graph

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.

❤️ Share

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

@riderx riderx merged commit 0c8aa11 into main Feb 15, 2026
14 of 15 checks passed
@riderx riderx deleted the riderx/plugin-version-graph branch February 15, 2026 20:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 AdminPluginBreakdown payload to include a trend array derived from global_stats over the selected date range.
  • Update /admin/dashboard/plugins to 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.

Comment on lines +223 to +226
<AdminMultiLineChart
:series="versionTrendSeries"
:is-loading="isLoadingBreakdown"
/>
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
@sonarqubecloud
Copy link
Copy Markdown

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