refactor: fix workflow status handling and improve UI components#387
refactor: fix workflow status handling and improve UI components#387LakshanSS merged 1 commit intoopenchoreo:mainfrom
Conversation
- Updated BuildStatusCell and BuildStatusChip components to use consistent terminology for workflow statuses, replacing 'success' and 'complete' with 'succeeded' and 'completed'. - Enhanced BuildStatusChip to handle additional status types, including 'running', 'pending', and 'queued', improving user feedback on workflow states. - Added workflowKind parameter to various components and API calls to ensure proper handling of workflow types across the application. - Introduced new styles for environment variable display in WorkflowDetailsRenderer, enhancing the presentation of name/value pairs. Signed-off-by: Stefinie Fernando <minolispencer@gmail.com>
📝 WalkthroughWalkthroughThe PR introduces support for 'ClusterWorkflow' alongside 'Workflow' by adding an optional workflowKind parameter to workflow schema fetching and API interfaces. It defaults missing workflow kinds to 'Workflow' across multiple layers and refactors status checks to use flexible substring matching, improving UI rendering of environment variables as tables. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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.
🧹 Nitpick comments (2)
plugins/openchoreo-ci/src/components/BuildStatusChip/BuildStatusChip.tsx (1)
11-20: Minor inconsistency with sibling component.This
BuildStatusChipchecks for'succeeded'and'completed', whileplugins/openchoreo/src/components/Workflows/BuildStatusChip.tsxadditionally checks for'success'and'complete'. Both components serve similar purposes, so the status matching logic should be consistent.Consider aligning the status checks across both components to ensure consistent behavior.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@plugins/openchoreo-ci/src/components/BuildStatusChip/BuildStatusChip.tsx` around lines 11 - 20, The status matching in BuildStatusChip currently checks statusLower.includes('succeeded') || statusLower.includes('completed'); update the condition in the BuildStatusChip component (the statusLower variable and the return branch that uses classes.successChip) to also check for 'success' and 'complete' (e.g., include statusLower.includes('success') and statusLower.includes('complete')) so the logic matches the sibling Workflows/BuildStatusChip implementation and yields consistent success/complete detection.plugins/openchoreo/src/components/Workflows/BuildStatusChip.tsx (1)
11-25: Minor redundancy in status checks.The checks for
'success'and'complete'are redundant since'succeeded'contains'success'and'completed'contains'complete'. The current order works correctly, but the redundant checks add minimal overhead.This is a nitpick and doesn't affect correctness—the substring-based approach provides good flexibility for handling various status string formats from the API.
♻️ Optional: Simplify redundant checks
if ( - statusLower.includes('success') || statusLower.includes('succeeded') || - statusLower.includes('completed') || - statusLower.includes('complete') + statusLower.includes('completed') ) {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@plugins/openchoreo/src/components/Workflows/BuildStatusChip.tsx` around lines 11 - 25, In BuildStatusChip, simplify the redundant substring checks on statusLower by removing the extra 'success' and 'complete' checks and keep the broader checks (e.g., 'succeeded' and 'completed' or whichever canonical substrings you prefer) so the conditional in the status rendering only tests the necessary substrings; update the if-block around statusLower.includes(...) that returns the Chip (referenced in BuildStatusChip and classes.statusChip / classes.successChip) accordingly to avoid the redundant includes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@plugins/openchoreo-ci/src/components/BuildStatusChip/BuildStatusChip.tsx`:
- Around line 11-20: The status matching in BuildStatusChip currently checks
statusLower.includes('succeeded') || statusLower.includes('completed'); update
the condition in the BuildStatusChip component (the statusLower variable and the
return branch that uses classes.successChip) to also check for 'success' and
'complete' (e.g., include statusLower.includes('success') and
statusLower.includes('complete')) so the logic matches the sibling
Workflows/BuildStatusChip implementation and yields consistent success/complete
detection.
In `@plugins/openchoreo/src/components/Workflows/BuildStatusChip.tsx`:
- Around line 11-25: In BuildStatusChip, simplify the redundant substring checks
on statusLower by removing the extra 'success' and 'complete' checks and keep
the broader checks (e.g., 'succeeded' and 'completed' or whichever canonical
substrings you prefer) so the conditional in the status rendering only tests the
necessary substrings; update the if-block around statusLower.includes(...) that
returns the Chip (referenced in BuildStatusChip and classes.statusChip /
classes.successChip) accordingly to avoid the redundant includes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 49d0428b-7127-4125-aaa3-a211b6aee67f
📒 Files selected for processing (12)
plugins/openchoreo-backend/src/services/transformers/component.tsplugins/openchoreo-ci/src/api/OpenChoreoCiClient.tsplugins/openchoreo-ci/src/api/OpenChoreoCiClientApi.tsplugins/openchoreo-ci/src/components/BuildStatusChip/BuildStatusChip.tsxplugins/openchoreo-ci/src/components/WorkflowConfigPage/WorkflowConfigPage.tsxplugins/openchoreo-ci/src/components/WorkflowDetailsRenderer/WorkflowDetailsRenderer.tsxplugins/openchoreo-ci/src/components/WorkflowDetailsRenderer/styles.tsplugins/openchoreo-ci/src/components/Workflows/Workflows.tsxplugins/openchoreo/src/components/Projects/ProjectComponentsCard/BuildStatusCell.tsxplugins/openchoreo/src/components/Workflows/BuildStatusChip.tsxplugins/openchoreo/src/components/Workflows/OverviewCard/useWorkflowsSummary.tsplugins/scaffolder-backend-module-openchoreo/src/actions/component.ts
Purpose
Related Issue: openchoreo/openchoreo#2562
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes