feat(ui): add delete action for workflow and CI runs#679
feat(ui): add delete action for workflow and CI runs#679eshwanthkartitr wants to merge 16 commits into
Conversation
Add ability to delete workflow runs across CI and generic workflows plugins. Includes DELETE endpoints in backend routers, service methods for API integration, client methods in frontend APIs, and delete action buttons in the RunsTab and WorkflowRunsContent components with confirmation dialogs.
Wrap RunsTab component with TestApiProvider to properly inject mocked openChoreoCiClientApiRef. This ensures the component has access to the required API when testing, including the mocked deleteWorkflowRun method.
|
Changeset detected — the following file(s) will be released with this PR: |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds authenticated workflow-run deletion across CI and generic workflow APIs, backend services, routers, and both run-list interfaces. UI actions confirm deletion, refresh lists on success, and alert on failure. ChangesWorkflow run deletion
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related issues
Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant User
participant RunTable
participant WorkflowClient
participant BackendRouter
participant WorkflowService
participant OpenChoreoAPI
User->>RunTable: Confirm delete action
RunTable->>WorkflowClient: deleteWorkflowRun identifiers
WorkflowClient->>BackendRouter: DELETE workflow run
BackendRouter->>WorkflowService: deleteWorkflowRun
WorkflowService->>OpenChoreoAPI: Validate and delete run
OpenChoreoAPI-->>WorkflowService: 204 No Content
WorkflowService-->>BackendRouter: Success
BackendRouter-->>WorkflowClient: 204 No Content
WorkflowClient-->>RunTable: Deletion completed
RunTable->>RunTable: Refresh run list
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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: 6
🧹 Nitpick comments (1)
plugins/openchoreo-workflows/src/components/WorkflowRunsContent/WorkflowRunsContent.tsx (1)
920-942: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider extracting the shared delete action logic.
The delete action configuration (confirm dialog, API call, refresh, error alert) is nearly identical between
RunsTab.tsxandWorkflowRunsContent.tsx. Extracting a shared helper would reduce duplication and ensure consistent behavior.🤖 Prompt for 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. In `@plugins/openchoreo-workflows/src/components/WorkflowRunsContent/WorkflowRunsContent.tsx` around lines 920 - 942, Extract the duplicated workflow-run deletion flow from the action configuration in WorkflowRunsContent and its counterpart in RunsTab into a shared helper. Preserve the confirmation dialog, client.deleteWorkflowRun call, refetch behavior, and error alert, then have both delete actions invoke the helper with their relevant client, namespace, run, and refresh context.
🤖 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 `@plugins/openchoreo-ci-backend/src/services/WorkflowService.ts`:
- Around line 769-805: Update deleteWorkflowRun to validate ownership before
issuing the DELETE request: fetch the workflow run using the same approach as
getWorkflowRun, then confirm its labels match projectName and componentName.
Only proceed with the existing deletion call when both labels match; otherwise
reject the operation and preserve the existing error propagation behavior.
In `@plugins/openchoreo-ci/src/api/OpenChoreoCiClient.ts`:
- Around line 247-250: Update apiFetch to handle successful responses with no
body, including 204 No Content, without calling response.json() on an empty
response. Preserve JSON parsing for responses that contain a body, and keep the
existing error handling and typed return behavior for callers such as the DELETE
workflow-run request.
In `@plugins/openchoreo-ci/src/components/RunsTab/RunsTab.test.tsx`:
- Around line 83-86: Add a test in the RunsTab test suite covering the complete
delete flow: trigger deletion, confirm the dialog, and assert
mockCiClient.deleteWorkflowRun and onRefresh are each called with the expected
arguments. Reuse the existing mockCiClient.deleteWorkflowRun setup and the
component’s established test helpers and data.
In `@plugins/openchoreo-ci/src/components/RunsTab/RunsTab.tsx`:
- Around line 142-147: Guard the delete flow around client.deleteWorkflowRun so
run.namespaceName, run.projectName, and run.componentName are validated as
present before invoking it; only pass the validated values and remove the
non-null assertions. Preserve the existing deletion behavior when all required
fields are available.
In `@plugins/openchoreo-workflows/src/api/GenericWorkflowsClient.ts`:
- Around line 169-181: Update apiFetch to detect a 204 No Content response and
return without attempting response.json(); retain JSON parsing for responses
with content. Ensure deleteWorkflowRun continues to complete successfully when
the DELETE endpoint returns 204.
In
`@plugins/openchoreo-workflows/src/components/WorkflowRunsContent/WorkflowRunsContent.tsx`:
- Around line 920-942: The `GenericWorkflowsClient.apiFetch` response handling
must support successful empty DELETE responses. Detect a 204/no-content response
before calling `response.json()`, skip parsing, and return `undefined` for
`deleteWorkflowRun()` while preserving JSON parsing for responses that contain a
body.
---
Nitpick comments:
In
`@plugins/openchoreo-workflows/src/components/WorkflowRunsContent/WorkflowRunsContent.tsx`:
- Around line 920-942: Extract the duplicated workflow-run deletion flow from
the action configuration in WorkflowRunsContent and its counterpart in RunsTab
into a shared helper. Preserve the confirmation dialog, client.deleteWorkflowRun
call, refetch behavior, and error alert, then have both delete actions invoke
the helper with their relevant client, namespace, run, and refresh context.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 3650940a-1b82-4ce1-8179-76cd5c71fa2e
📒 Files selected for processing (11)
plugins/openchoreo-ci-backend/src/router.tsplugins/openchoreo-ci-backend/src/services/WorkflowService.tsplugins/openchoreo-ci/src/api/OpenChoreoCiClient.tsplugins/openchoreo-ci/src/api/OpenChoreoCiClientApi.tsplugins/openchoreo-ci/src/components/RunsTab/RunsTab.test.tsxplugins/openchoreo-ci/src/components/RunsTab/RunsTab.tsxplugins/openchoreo-workflows-backend/src/router.tsplugins/openchoreo-workflows-backend/src/services/GenericWorkflowService.tsplugins/openchoreo-workflows/src/api/GenericWorkflowsClient.tsplugins/openchoreo-workflows/src/api/GenericWorkflowsClientApi.tsplugins/openchoreo-workflows/src/components/WorkflowRunsContent/WorkflowRunsContent.tsx
Allow delete requests to accept 204 No Content responses in both OpenChoreo clients, and guard the Runs tab delete action against missing run identifiers before calling the API. The backend now verifies the run exists before deleting it.
Add ability to delete workflow runs across CI and generic workflows plugins. Includes DELETE endpoints in backend routers, service methods for API integration, client methods in frontend APIs, and delete action buttons in the RunsTab and WorkflowRunsContent components with confirmation dialogs. Signed-off-by: Eshwanth Karti T R <eshwanthkartitr@gmail.com>
Wrap RunsTab component with TestApiProvider to properly inject mocked openChoreoCiClientApiRef. This ensures the component has access to the required API when testing, including the mocked deleteWorkflowRun method. Signed-off-by: Eshwanth Karti T R <eshwanthkartitr@gmail.com>
Allow delete requests to accept 204 No Content responses in both OpenChoreo clients, and guard the Runs tab delete action against missing run identifiers before calling the API. The backend now verifies the run exists before deleting it. Signed-off-by: Eshwanth Karti T R <eshwanthkartitr@gmail.com>
Signed-off-by: Eshwanth Karti T R <eshwanthkartitr@gmail.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.changeset/calm-zebras-wave.md (1)
1-3: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winAdd package bump metadata and a release-note description.
This changeset contains empty frontmatter, so Changesets cannot determine which packages to version or publish for this PR. Add the affected package names with the appropriate bump type and a concise description of the deletion feature.
🤖 Prompt for 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. In @.changeset/calm-zebras-wave.md around lines 1 - 3, Update the changeset frontmatter in calm-zebras-wave.md to list every package affected by the deletion feature with the appropriate version bump type, and add a concise release-note description below the closing delimiter. Ensure the metadata is valid Changesets syntax and no longer contains empty frontmatter.
🤖 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.
Outside diff comments:
In @.changeset/calm-zebras-wave.md:
- Around line 1-3: Update the changeset frontmatter in calm-zebras-wave.md to
list every package affected by the deletion feature with the appropriate version
bump type, and add a concise release-note description below the closing
delimiter. Ensure the metadata is valid Changesets syntax and no longer contains
empty frontmatter.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 7154312e-e33b-4394-9a07-fd2bfe0f001c
📒 Files selected for processing (1)
.changeset/calm-zebras-wave.md
…com> I, Eshwanth Karti T R <eshwanthkartitr@gmail.com>, hereby add my Signed-off-by to this commit: 8f58dbb I, Eshwanth Karti T R <eshwanthkartitr@gmail.com>, hereby add my Signed-off-by to this commit: 21fa0ed I, Eshwanth Karti T R <eshwanthkartitr@gmail.com>, hereby add my Signed-off-by to this commit: 57ca827 I, Eshwanth Karti T R <eshwanthkartitr@gmail.com>, hereby add my Signed-off-by to this commit: fabc109 Signed-off-by: Eshwanth Karti T R <eshwanthkartitr@gmail.com>
Signed-off-by: Eshwanth Karti T R <eshwanthkartitr@gmail.com>
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
@eshwanthkartitr Please add a screen recording of the changes Also fix the lint issues and add unit tests for the changes that you have done |
Switched workflow run deletion in both openchoreo-ci and openchoreo-workflows from browser confirm/alert flows to Material-UI dialogs plus Backstage alertApi error reporting. Added component tests to cover confirm/delete success and failure paths, and new API client tests to verify 204 No Content returns undefined while 200 responses still parse JSON.
Screen.Recording.2026-07-13.at.15.13.58.movHey @stefinie123, here is a screen recording of the new delete workflow run UI in action! Note: I used mock data and a guest session to demonstrate this locally, but it shows the full confirmation dialog flow and API integration. |
Switched workflow run deletion in both openchoreo-ci and openchoreo-workflows from browser confirm/alert flows to Material-UI dialogs plus Backstage alertApi error reporting. Added component tests to cover confirm/delete success and failure paths, and new API client tests to verify 204 No Content returns undefined while 200 responses still parse JSON. Signed-off-by: Eshwanth Karti T R <eshwanthkartitr@gmail.com>
There was a problem hiding this comment.
🧹 Nitpick comments (2)
plugins/openchoreo-ci/src/api/OpenChoreoCiClient.test.ts (1)
19-49: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd error-response test coverage to both client test suites. Both
OpenChoreoCiClientandGenericWorkflowsClientshare the sameapiFetchstructure (throw on!response.ok,undefinedon 204, else parse JSON), but only the 204/200 branches are tested in either file; the reviewer has requested additional unit tests for this feature.
plugins/openchoreo-ci/src/api/OpenChoreoCiClient.test.ts#L19-L49: add a test wherefetchresolves withok: false(e.g.status: 404) and assertdeleteWorkflowRunrejects with the expectedAPI request failed (...)error.plugins/openchoreo-workflows/src/api/GenericWorkflowsClient.test.ts#L19-L48: add the equivalentok: falsetest fordeleteWorkflowRun.🤖 Prompt for 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. In `@plugins/openchoreo-ci/src/api/OpenChoreoCiClient.test.ts` around lines 19 - 49, Add equivalent error-response unit tests in plugins/openchoreo-ci/src/api/OpenChoreoCiClient.test.ts (lines 19-49) and plugins/openchoreo-workflows/src/api/GenericWorkflowsClient.test.ts (lines 19-48): mock fetch to resolve with ok false, such as status 404, invoke deleteWorkflowRun, and assert it rejects with the expected API request failed (...) error. Preserve the existing 204 and 200 coverage.plugins/openchoreo-ci/src/components/RunsTab/RunsTab.test.tsx (1)
220-256: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a Cancel-path test to both run-table test suites. Both files test the delete-confirm success/failure paths but neither verifies that clicking Cancel closes the dialog without invoking the delete call or the refresh/refetch callback; the reviewer has requested additional unit tests for this feature.
plugins/openchoreo-ci/src/components/RunsTab/RunsTab.test.tsx#L220-L256: add a test that opens the dialog, clicks "Cancel", and assertsmockCiClient.deleteWorkflowRunandonRefreshare never called.plugins/openchoreo-workflows/src/components/WorkflowRunsContent/WorkflowRunsContent.test.tsx#L122-L167: add the equivalent Cancel test assertingmockWorkflowsClient.deleteWorkflowRunandmockRefetchare never called.🤖 Prompt for 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. In `@plugins/openchoreo-ci/src/components/RunsTab/RunsTab.test.tsx` around lines 220 - 256, The CI RunsTab test suite at plugins/openchoreo-ci/src/components/RunsTab/RunsTab.test.tsx:220-256 needs a Cancel-path test: open the delete dialog, click Cancel, and assert mockCiClient.deleteWorkflowRun and onRefresh are not called. Add the equivalent test in plugins/openchoreo-workflows/src/components/WorkflowRunsContent/WorkflowRunsContent.test.tsx:122-167, asserting mockWorkflowsClient.deleteWorkflowRun and mockRefetch are not called.
🤖 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.
Nitpick comments:
In `@plugins/openchoreo-ci/src/api/OpenChoreoCiClient.test.ts`:
- Around line 19-49: Add equivalent error-response unit tests in
plugins/openchoreo-ci/src/api/OpenChoreoCiClient.test.ts (lines 19-49) and
plugins/openchoreo-workflows/src/api/GenericWorkflowsClient.test.ts (lines
19-48): mock fetch to resolve with ok false, such as status 404, invoke
deleteWorkflowRun, and assert it rejects with the expected API request failed
(...) error. Preserve the existing 204 and 200 coverage.
In `@plugins/openchoreo-ci/src/components/RunsTab/RunsTab.test.tsx`:
- Around line 220-256: The CI RunsTab test suite at
plugins/openchoreo-ci/src/components/RunsTab/RunsTab.test.tsx:220-256 needs a
Cancel-path test: open the delete dialog, click Cancel, and assert
mockCiClient.deleteWorkflowRun and onRefresh are not called. Add the equivalent
test in
plugins/openchoreo-workflows/src/components/WorkflowRunsContent/WorkflowRunsContent.test.tsx:122-167,
asserting mockWorkflowsClient.deleteWorkflowRun and mockRefetch are not called.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 86fd6289-6bb5-4127-8f65-e1b0e40ef6d8
📒 Files selected for processing (8)
.changeset/calm-zebras-wave.md.gitignoreplugins/openchoreo-ci/src/api/OpenChoreoCiClient.test.tsplugins/openchoreo-ci/src/components/RunsTab/RunsTab.test.tsxplugins/openchoreo-ci/src/components/RunsTab/RunsTab.tsxplugins/openchoreo-workflows/src/api/GenericWorkflowsClient.test.tsplugins/openchoreo-workflows/src/components/WorkflowRunsContent/WorkflowRunsContent.test.tsxplugins/openchoreo-workflows/src/components/WorkflowRunsContent/WorkflowRunsContent.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- plugins/openchoreo-workflows/src/components/WorkflowRunsContent/WorkflowRunsContent.tsx
…com> I, Eshwanth Karti T R <eshwanthkartitr@gmail.com>, hereby add my Signed-off-by to this commit: 983d032 Signed-off-by: Eshwanth Karti T R <eshwanthkartitr@gmail.com>
|
Hi @eshwanthkartitr, Shall we improve it like this? After doing can you attach another video of the final version. Use this sample for your builds https://github.com/openchoreo/openchoreo/tree/main/samples/from-source/services/go-docker-greeter. Feel free to add any other suggestions @stefinie123.
|


Purpose
Currently, users have no way to clean up or remove obsolete, failed, or unnecessary workflow and CI runs from the Backstage UI. This clutters the run history and creates a poor user experience.
Goals
To introduce an end-to-end deletion flow that allows users to permanently delete workflow runs and CI runs directly from the Backstage portal. This involves updating the UI tables to include a delete action, routing that action through the frontend API clients, and adding the corresponding backend service endpoints to make the final delete request to the OpenChoreo API.
Approach
RunsTab.tsx&WorkflowRunsContent.tsx): Added a new action column to the Material Table using theDeleteIcon. Clicking this prompts awindow.confirmdialog. Upon confirmation, the respective frontend client is called to execute the deletion, and the table is refreshed viaonRefresh()/refetch().OpenChoreoCiClient&GenericWorkflowsClient): Added adeleteWorkflowRun(namespace, runName)method that makes an HTTPDELETErequest to the Backstage backend plugins.router.ts): Exposed newDELETE /workflow-runs/:runNameendpoints in both the CI and workflows backend plugins.GenericWorkflowService&WorkflowService): Added thedeleteWorkflowRunmethod which uses theOpenChoreoApiClientto forward the deletion command securely to the upstream OpenChoreo API (DELETE /api/v1/namespaces/{namespaceName}/workflowruns/{runName}).User stories
Release note
Added the ability to delete workflow runs and CI runs directly from the OpenChoreo portal UI.
Documentation
N/A
Training
N/A
Certification
N/A - This feature is a minor UI action addition and does not impact existing certification exams.
Marketing
N/A
Automation tests
Security checks
Samples
N/A
Related PRs
N/A
Migrations (if applicable)
N/A
Test environment
Learning
Leveraged the existing
@material-table/coreActions API (actionsarray) within Backstage to seamlessly inject the row-level delete button without requiring a custom column override. Reviewed Backstage core plugin architecture for safely passing the user's namespace query parameters down to the upstream API client.Summary by CodeRabbit
204 No Contentfor delete operations to avoid JSON parsing issues.204behavior for delete flows.