Refactor `WorkflowRunsTable` to leverage `WorkflowRunsCard` filter and search capabilities
Hey, I just made a Pull Request!
This PR is probably mergeable, but open to further input/refinement. Please, lol. 🙏 Working on Issue #3640
Since this change involves API/UI changes, I'm welcoming input/suggestions on the final API or UI. There may be README.md changes required as a result as well.
Branch filtering
-
WorkflowRunsTablecurrently lists workflow runs from all branches by default, with no filtering other thanrun.message -
WorkflowRunsCardcurrently selects the default branch only (but offers selection, including "select all branches").- We can change this default to match the current table behavior, but it would be nice to have Card/Table consistent whichever way. Default branch seems to fit Backstage's model better IMO.
Potentially Breaking: This change as-is changes the default Table output to match default Card behavior.
WorkflowRunsTable Entrypoint Change
Currently there are two primary entrypoints for this plugin in Router.tsx:
<WorkflowRunsCard entity={entity} />
<WorkflowRunsTable entity={entity} />
I have created a third (temporary?) intended for reviewing this refactoring without impacting current behavior:
<WorkflowRunsCard entity={entity} tableMode />
This is not optimal. A component refactoring is really needed after this, I think it should be separate from this functionality/behavior change.
Change details
WorkflowRunsTable
- Added
enableToolbartoggle toWorkflowRunsTableView, passing through to the<Table>in order to optionally disable the title banner for projectName and table filter.
WorkflowRunsCard
- added
tableModetoggle to haveWorkflowRunsCardemulateWorkflowRunsTable, reusingWorkflowRunsTableView - run the filter/search before calling
WorkflowRunsTableViewsince we're not using the<Table>toolbar search anymore.- side-effect:
WorkflowRunsCard(non-tableMode) runs the filter a second time currently).
- side-effect:
matchesSearchTerm
- use
getStatusDescription()instead of rawrun.status, it combinesrun.statusandrun.conclusion- The displayed status value comes from
getStatusDescription(), search should be consistent with what's displayed.
- The displayed status value comes from
- added searching
run.messagein order to reach parity with existingWorkflowRunsTablefilter behavior.
General refactoring / non-impacting cosmetic changes
- Moved
WorkflowRunsCardViewPropsandWorkflowRunsCardPropsdefinitions closer to their component usage to help future refactoring. Existing separation makes code reviewing props changes harder to reconcile.
Screenshots
Screenshot Before (WorkflowRunsTable):
Screenshot After (WorkflowRunsCard tableMode after "select all branches"):
Screenshot After (WorkflowRunsCard tableMode default view - main branch for this repo):
:heavy_check_mark: Checklist
Changed Packages
| Package Name | Package Path | Changeset Bump | Current Version |
|---|---|---|---|
| @backstage-community/plugin-github-actions | workspaces/github-actions/plugins/github-actions | minor | v0.10.0 |
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!
Sorry @daversomethingsomething, this got past me on Friday when I was doing reviews, will give it a look this Friday or if I can get to it sooner I will.
Thanks, that's pretty much the kind of input I was looking for at this point.
I'll park this PR back in draft while I work on that.
Hi @awanlin, do you have an opinion/preference on whether I should revert this change on this branch, or start a new branch/PR?
edit: I noticed the squash merge mention for this repo, I guess the branch commit history doesn't matter enough to worry about.
Hi @awanlin,
I think I addressed your requested changes, with some slight refinements that I think will help with migration.
- Kept the
viewprop named as-is for the Router, but I did name the prop for the new componentviewType- Keeping
viewfor the Router avoids requiring changes on the consumer side forcardsconsumers as documented inREADME.md - With
typebeing a TS reserved word elsewhere I thought it might be better to avoid using it verbatim. - Maybe
view->viewTypeis just confusing though.
- Keeping
- Added a new
/ngplugin route rather than a whole new Router. Happy to use a better name..- I am assuming the final factoring will take over the existing
/ci-cdroute. - Using the existing Router keeps migration within the span of control of the plugin rather than requiring App entity page changes.
- I am assuming the final factoring will take over the existing
Testing the changes on my instance:
- OLD: http://localhost:3000/catalog/default/component/backstage/ci-cd
- NEW: http://localhost:3000/catalog/default/component/backstage/ci-cd/ng
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!