Fix compliance dashboard chart visualisation#291
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5e04acab3e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const safeLabels = labels.length > 0 ? labels : ["No data"]; | ||
| const safeValues = values.length > 0 ? values : [0]; |
There was a problem hiding this comment.
Treat zero-total pie data as no data
When the selected scan has no results yet (for example, a first-run dashboard, a pending/running scan, or a scan whose counts are all zero), Dashboard still passes labels=["Pass", "Fail"] and values=[0, 0], so this length-only fallback is skipped. The pie/doughnut chart is then asked to render an all-zero series instead of the intended No data state, leaving empty dashboards with a blank or invalid chart rather than the fallback this component is trying to provide.
Useful? React with 👍 / 👎.
Summary
This PR has fixed the custom chart visualization feature of the dashboard.
Users can now select different chart types when viewing compliance results. Previously, due to an error, the charts were not visible and the available chart types were:
Type of Change
Affected Components
/backend-api/frontend/engine(collectors / policies)/security/infrastructure/.github/workflows/docsMotivation
Testing
Manually tested: