feat(scaffolder): Allow filtering by status in scaffolderService.listTasks#33122
feat(scaffolder): Allow filtering by status in scaffolderService.listTasks#33122freben merged 5 commits intobackstage:masterfrom
Conversation
…sks. Added optional `status` filter to `ScaffolderService.listTasks`, by exposing the `status` query parameter, allowing callers to retrieve tasks of a specific status. Also updated the `list-scaffolder-tasks` action to support this parameter. Signed-off-by: John Collier <jcollier@redhat.com>
|
Important This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior. Changed Packages
|
There was a problem hiding this comment.
Pull request overview
This PR exposes the existing scaffolder /v2/tasks status query parameter through ScaffolderService.listTasks, and wires that new filter into the list-scaffolder-tasks backend action (including tests and changesets).
Changes:
- Add optional
statusfilter support toScaffolderService.listTasksand propagate it as a query param. - Extend
list-scaffolder-tasksaction input schema to acceptstatusand pass it through to the service. - Add/adjust unit tests and add changesets for the affected packages.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| plugins/scaffolder-node/src/scaffolderService.ts | Adds status to the service request and includes it in the /v2/tasks query string. |
| plugins/scaffolder-backend/src/actions/listScaffolderTasksAction.ts | Adds status to the action input schema and passes it to scaffolderService.listTasks. |
| plugins/scaffolder-backend/src/actions/listScaffolderTasksAction.test.ts | Updates expectations and adds a test covering the new status filter pass-through. |
| .changeset/gold-friends-end.md | Changeset for @backstage/plugin-scaffolder-node documenting the new filter option. |
| .changeset/fifty-clubs-play.md | Changeset for @backstage/plugin-scaffolder-backend documenting the action update (contains a small typo). |
Signed-off-by: John Collier <jcollier@redhat.com>
Signed-off-by: John Collier <jcollier@redhat.com>
| .min(0) | ||
| .describe('The offset to start from for pagination') | ||
| .optional(), | ||
| status: z |
There was a problem hiding this comment.
I wanted to pass in the ScaffolderTaskStatus enum into the zod schema for the action, but it didn't seem to be supported, so I ended up needing to hard code the statuses here. Not sure if there's a better way to handle this?
|
This is great! But should we also add the status filter to the scaffolder UI? Please review the Copilot comments; they actually make some sense. |
|
@drodil As far as I'm aware, I'll take a look at remaining Copilot comments |
Signed-off-by: John Collier <jcollier@redhat.com>
|
Edit: I was wrong, it's here: https://github.com/backstage/backstage/blob/master/plugins%2Fscaffolder-backend%2Fsrc%2Fservice%2Frouter.ts#L626 so never mind, carry on 😁 |
|
This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution! |
|
Not stale |
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
|
Thank you for contributing to Backstage! The changes in this pull request will be part of the |
Minor follow up PR for #32989
This PR adds an optional
statusfilter toScaffolderService.listTasks, by exposing thestatusquery parameter already present on the scaffolder API, allowing callers to retrieve tasks of a specific status. I've also updated thelist-scaffolder-tasksaction accordingly to support this filter.Hey, I just made a Pull Request!
✔️ Checklist
Signed-off-byline in the message. (more info)