Conversation
- 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.
|
Warning Review limit reached
Next review available in: 43 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughChangesDashboard widget visualization
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
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ 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.
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
📒 Files selected for processing (14)
apps/csm-portal/backend/internal/dashboard/widgets.goapps/csm-portal/backend/internal/dashboard/widgets_test.goapps/csm-portal/backend/internal/handler/dashboards.goapps/csm-portal/backend/internal/handler/dashboards_test.goapps/csm-portal/backend/openapi.yamlapps/csm-portal/webapp/src/api/backend/types.tsapps/csm-portal/webapp/src/features/csm-dashboard/api/useWidgetPieData.test.tsxapps/csm-portal/webapp/src/features/csm-dashboard/api/useWidgetPieData.tsapps/csm-portal/webapp/src/features/csm-dashboard/components/AgentsLandingPagePilot.test.tsxapps/csm-portal/webapp/src/features/csm-dashboard/components/AgentsLandingPagePilot.tsxapps/csm-portal/webapp/src/features/csm-dashboard/components/DashboardBarChart.tsxapps/csm-portal/webapp/src/features/csm-dashboard/components/DashboardPieChart.tsxapps/csm-portal/webapp/src/features/csm-dashboard/components/DashboardWidgetTile.test.tsxapps/csm-portal/webapp/src/features/csm-dashboard/components/DashboardWidgetTile.tsx
- 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.
Summary
shape: "pie"/"bar"dashboard widgets now render a real donut/bar chart — one wedge or bar per configuredslicesentry, each resolved via its own single search+limit:1(the same mechanismshape: "count"already uses) and clickable through to that slice's own filtered list.omitemptyon 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/barlabel/color/filters, shared by bothpieandbar.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. Nosectionset renders exactly as before this field existed.@wso2/oxygen-ui-charts-reactPieChartwrapper'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 passgosec -fmt=text ./...— 0 issuestsc -b/eslint— cleanvitest run— 792/801 pass; the 9 failures are pre-existing and unrelated (confirmed viagit log -Sthey predate this branch — 4 inCaseActionBar.test.tsxfrom a stale "Change state" dropdown test, 5 inCsmAnnouncementsPage.test.tsxfrom a pre-existing router-context issue)🤖 Generated with Claude Code
Summary by CodeRabbit