fix: Show different statuses on graph#156
Conversation
WalkthroughThe pull request introduces significant changes to the Changes
Possibly related PRs
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (2)
🧰 Additional context used🔇 Additional comments (9)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 6
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (2)
- apps/webservice/src/app/[workspaceSlug]/systems/JobHistoryChart.tsx (3 hunks)
- packages/api/src/router/job.ts (1 hunks)
🧰 Additional context used
🔇 Additional comments (3)
apps/webservice/src/app/[workspaceSlug]/systems/JobHistoryChart.tsx (1)
21-32: Ensure allJobStatusvalues are included instatusColorsmappingTo prevent any missing or unintended behaviors in the chart rendering, please verify that all possible
JobStatusenum values are included in thestatusColorsmapping. Missing statuses might lead to bars not displaying or errors during rendering.packages/api/src/router/job.ts (2)
88-105: Aggregation subquery is well-constructedThe
subquerycorrectly aggregates the count of jobs per status and date. The use of joins and groupings is appropriate and aligns with the objective of enhancing data retrieval for job statuses.
107-117: Ensure all job statuses are included instatusCountsVerify that the
statusCountsJSON object includes all possibleJobStatusvalues, even those with zero counts. This will prevent potential issues in the front-end display where certain statuses might be expected but absent.
| {Object.entries(statusColors).map(([status, color]) => ( | ||
| <Bar | ||
| key={status} | ||
| dataKey={status.toLowerCase()} | ||
| stackId="jobs" | ||
| fill={color} | ||
| /> | ||
| ))} |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Specify name prop in Bar components for accurate tooltips
To ensure the tooltip displays the correct status labels, include the name prop in each Bar component, using the statusLabels mapping.
Modify the Bar components as follows:
{Object.entries(statusColors).map(([status, color]) => (
<Bar
key={status}
dataKey={status.toLowerCase()}
stackId="jobs"
fill={color}
+ name={statusLabels[status.toLowerCase()] || status}
/>
))}This provides the tooltip with the appropriate label for each status segment.
Committable suggestion was skipped due to low confidence.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation