Skip to content

[CSM] Pie/bar dashboard widget charts and titled widget sections - #1326

Merged
rksk merged 2 commits into
wso2-open-operations:mainfrom
Rashmika998:csm-portal-dashboard-pie-bar-charts
Aug 2, 2026
Merged

rksk merged 2 commits into
wso2-open-operations:mainfrom
Rashmika998:csm-portal-dashboard-pie-bar-charts

Conversation

@Rashmika998

@Rashmika998 Rashmika998 commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • shape: "pie"/"bar" dashboard widgets now render a real donut/bar chart — one wedge or bar per configured slices entry, each resolved via its own single search+limit:1 (the same mechanism shape: "count" already uses) and clickable through to that slice's own filtered list.
  • New optional widget fields, all omitempty on the wire (no effect on existing dashboards that don't set them):
    • description — subtitle text shown under the widget's title.
    • slices — the per-wedge/bar label/color/filters, shared by both pie and bar.
    • section — groups widgets sharing the same value under a titled sub-section within a dashboard (e.g. a handful of SLA-violation count widgets under their own "SLA Violation" heading), in the order that value first appears. No section set renders exactly as before this field existed.
  • Empty (zero-total) pie/bar widgets show an inbox icon + "Nothing to show here right now" instead of an all-grey ring/bars.
  • Fixed a couple of chart-rendering bugs found along the way: the @wso2/oxygen-ui-charts-react PieChart wrapper's own default margin ({top:12,...,bottom:40}, sized for a legend we don't show) was pushing the donut's visual center down, making its top edge look clipped under the tile's header — cleared to {0,0,0,0}. The default tooltip cursor highlight (a full-height box behind the hovered bar) is now disabled in favor of the bar's own hover border.

Test plan

  • go build/go vet/go test -race — all pass
  • gosec -fmt=text ./... — 0 issues
  • Frontend tsc -b / eslint — clean
  • Frontend vitest run — 792/801 pass; the 9 failures are pre-existing and unrelated (confirmed via git log -S they predate this branch — 4 in CaseActionBar.test.tsx from a stale "Change state" dropdown test, 5 in CsmAnnouncementsPage.test.tsx from a pre-existing router-context issue)
  • Manual smoke test of pie/bar widgets, titled sections, and the empty state in a browser

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added pie and bar chart widgets with configurable labels, colors, descriptions, and filters.
    • Chart slices display totals, percentages, tooltips, loading and error states, and empty states.
    • Clicking a chart slice or legend item opens the corresponding filtered results.
    • Added dashboard sections with shared headings and responsive widget grouping.
  • Bug Fixes
    • Improved widget rendering and filtering for chart-based dashboard views.
  • Documentation
    • Updated dashboard API documentation to describe chart configuration and slice-based data behavior.

- shape "pie"/"bar" widgets now render a real donut/bar chart (one wedge
  or bar per configured slice), each clickable through to that slice's
  own filtered case list — resolved the same way shape "count" resolves
  its own single search, just once per slice (useWidgetPieData).
- New optional widget fields: description (subtitle text) and slices
  (the per-wedge/bar label + color + filters); both already existed for
  pie, extended to bar so either shape works off the same config.
- New optional widget field `section` groups widgets sharing the same
  value under a titled sub-section within a dashboard, in the order that
  value first appears — e.g. a handful of SLA-violation count widgets can
  render together under their own "SLA Violation" heading, separate from
  a dashboard's other widgets. No section set (the default) renders
  exactly as before this field existed.
- Empty (zero-total) pie/bar widgets now show an inbox icon + "Nothing to
  show here right now" instead of an all-grey ring/bars.
- All three fields are optional/omitempty on the wire — existing
  dashboards/widgets that don't set them are unaffected.

Backend: internal/dashboard/widgets.go, internal/handler/dashboards.go,
openapi.yaml, with Go tests covering config parsing and the handler's
wire response. gosec: 0 issues.
@coderabbitai

coderabbitai Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Rashmika998, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 43 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1c38054c-b1d6-4310-965a-0ee7f6477a0e

📥 Commits

Reviewing files that changed from the base of the PR and between bb6b00b and 08473c3.

📒 Files selected for processing (2)
  • apps/csm-portal/webapp/src/api/backend/types.ts
  • apps/csm-portal/webapp/src/features/csm-dashboard/components/DashboardWidgetTile.tsx
📝 Walkthrough

Walkthrough

Changes

Dashboard widget visualization

Layer / File(s) Summary
Backend widget contract and response
apps/csm-portal/backend/internal/dashboard/widgets.go, apps/csm-portal/backend/internal/handler/dashboards.go, apps/csm-portal/backend/openapi.yaml, apps/csm-portal/backend/internal/**/*_test.go
Dashboard configuration and responses now support descriptions, sections, pie/bar shapes, slices, and resolved slice filters.
Per-slice data loading
apps/csm-portal/webapp/src/api/backend/types.ts, apps/csm-portal/webapp/src/features/csm-dashboard/api/useWidgetPieData.*
The frontend loads one search total per slice, merges filters, and aggregates slice values.
Chart rendering and widget interactions
apps/csm-portal/webapp/src/features/csm-dashboard/components/Dashboard{Pie,Bar}Chart.tsx, apps/csm-portal/webapp/src/features/csm-dashboard/components/DashboardWidgetTile.*
Pie and bar charts render loading, error, empty, hover, legend, and click states. Slice interactions navigate with merged filters.
Section-aware dashboard layout
apps/csm-portal/webapp/src/features/csm-dashboard/components/AgentsLandingPagePilot.*
Widgets are grouped by section and rendered in responsive rows with headings and dividers.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant DashboardConfig
  participant DashboardDetailHandler
  participant useWidgetPieData
  participant SearchAPI
  participant DashboardWidgetTile
  participant DashboardPieChart
  participant DashboardBarChart
  participant CasesRoute

  DashboardConfig->>DashboardDetailHandler: provide widget and slice configuration
  DashboardDetailHandler-->>useWidgetPieData: return resolved widget data
  useWidgetPieData->>SearchAPI: request one total per slice
  SearchAPI-->>useWidgetPieData: return slice totals
  useWidgetPieData-->>DashboardWidgetTile: provide aggregated chart data
  DashboardWidgetTile->>DashboardPieChart: render pie data
  DashboardWidgetTile->>DashboardBarChart: render bar data
  DashboardPieChart->>DashboardWidgetTile: report selected slice
  DashboardBarChart->>DashboardWidgetTile: report selected slice
  DashboardWidgetTile->>CasesRoute: navigate with merged filters
Loading

Possibly related PRs

Suggested reviewers: rksk

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the implementation and test results but omits most required template sections, including purpose, goals, documentation, security checks, and test environment. Complete the required template sections and document the pending manual browser smoke test before merging.
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: pie/bar dashboard charts and titled widget sections.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@Rashmika998
Rashmika998 requested a review from rksk August 2, 2026 14:48
rksk
rksk previously approved these changes Aug 2, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/csm-portal/webapp/src/api/backend/types.ts`:
- Around line 2715-2720: Update the BeWidgetShape documentation for "bar" to
state that it is resolved like "pie", with one /search request per slice and
each result read through its total. Remove the outdated claims that bar is not
resolvable and reserved for a future dashboard, while preserving the existing
count/list descriptions.

In
`@apps/csm-portal/webapp/src/features/csm-dashboard/components/DashboardWidgetTile.tsx`:
- Around line 34-36: Update the JSDoc for the description prop in
DashboardWidgetTile so it accurately states that the subtitle is rendered for
both pie and bar shapes, while remaining not shape-specific by design.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fbc115c7-f8b8-4d5c-9c0b-8dc37c81a478

📥 Commits

Reviewing files that changed from the base of the PR and between 470d7f2 and bb6b00b.

📒 Files selected for processing (14)
  • apps/csm-portal/backend/internal/dashboard/widgets.go
  • apps/csm-portal/backend/internal/dashboard/widgets_test.go
  • apps/csm-portal/backend/internal/handler/dashboards.go
  • apps/csm-portal/backend/internal/handler/dashboards_test.go
  • apps/csm-portal/backend/openapi.yaml
  • apps/csm-portal/webapp/src/api/backend/types.ts
  • apps/csm-portal/webapp/src/features/csm-dashboard/api/useWidgetPieData.test.tsx
  • apps/csm-portal/webapp/src/features/csm-dashboard/api/useWidgetPieData.ts
  • apps/csm-portal/webapp/src/features/csm-dashboard/components/AgentsLandingPagePilot.test.tsx
  • apps/csm-portal/webapp/src/features/csm-dashboard/components/AgentsLandingPagePilot.tsx
  • apps/csm-portal/webapp/src/features/csm-dashboard/components/DashboardBarChart.tsx
  • apps/csm-portal/webapp/src/features/csm-dashboard/components/DashboardPieChart.tsx
  • apps/csm-portal/webapp/src/features/csm-dashboard/components/DashboardWidgetTile.test.tsx
  • apps/csm-portal/webapp/src/features/csm-dashboard/components/DashboardWidgetTile.tsx

Comment thread apps/csm-portal/webapp/src/api/backend/types.ts Outdated
- BeWidgetShape's own comment still said bar was unresolvable/reserved
  for a future dashboard, contradicting the slices field doc right below
  it and the actual DashboardWidgetTile implementation.
- DashboardWidgetTile's description prop comment said it only rendered
  for shape "pie", but it renders for "pie"/"bar" alike.
@rksk
rksk merged commit 36561d7 into wso2-open-operations:main Aug 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants