community-plugins icon indicating copy to clipboard operation
community-plugins copied to clipboard

Refactor `WorkflowRunsTable` to leverage `WorkflowRunsCard` filter and search capabilities

Open daversomethingsomething opened this issue 10 months ago • 4 comments

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

  • WorkflowRunsTable currently lists workflow runs from all branches by default, with no filtering other than run.message
  • WorkflowRunsCard currently 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 enableToolbar toggle to WorkflowRunsTableView, passing through to the <Table> in order to optionally disable the title banner for projectName and table filter.

WorkflowRunsCard

  • added tableMode toggle to have WorkflowRunsCard emulate WorkflowRunsTable, reusing WorkflowRunsTableView
  • run the filter/search before calling WorkflowRunsTableView since we're not using the <Table> toolbar search anymore.
    • side-effect: WorkflowRunsCard (non-tableMode) runs the filter a second time currently).

matchesSearchTerm

  • use getStatusDescription() instead of raw run.status, it combines run.status and run.conclusion
    • The displayed status value comes from getStatusDescription(), search should be consistent with what's displayed.
  • added searching run.message in order to reach parity with existing WorkflowRunsTable filter behavior.

General refactoring / non-impacting cosmetic changes

  • Moved WorkflowRunsCardViewProps and WorkflowRunsCardProps definitions closer to their component usage to help future refactoring. Existing separation makes code reviewing props changes harder to reconcile.

Screenshots

Screenshot Before (WorkflowRunsTable): image

Screenshot After (WorkflowRunsCard tableMode after "select all branches"): image

Screenshot After (WorkflowRunsCard tableMode default view - main branch for this repo): image

:heavy_check_mark: Checklist

  • [X] A changeset describing the change and affected packages. (more info)
  • [ ] Added or updated documentation
  • [ ] Tests for new functionality and regression tests for bug fixes
  • [X] Screenshots attached (for UI changes)
  • [X] All your commits have a Signed-off-by line in the message. (more info)

daversomethingsomething avatar Apr 27 '25 18:04 daversomethingsomething

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

backstage-goalie[bot] avatar Apr 27 '25 18:04 backstage-goalie[bot]

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!

github-actions[bot] avatar May 12 '25 00:05 github-actions[bot]

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.

awanlin avatar May 12 '25 12:05 awanlin

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.

daversomethingsomething avatar May 17 '25 21:05 daversomethingsomething

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.

daversomethingsomething avatar May 25 '25 12:05 daversomethingsomething

Hi @awanlin,

I think I addressed your requested changes, with some slight refinements that I think will help with migration.

  • Kept the view prop named as-is for the Router, but I did name the prop for the new component viewType
    • Keeping view for the Router avoids requiring changes on the consumer side for cards consumers as documented in README.md
    • With type being a TS reserved word elsewhere I thought it might be better to avoid using it verbatim.
    • Maybe view -> viewType is just confusing though.
  • Added a new /ng plugin 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-cd route.
    • Using the existing Router keeps migration within the span of control of the plugin rather than requiring App entity page changes.

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

daversomethingsomething avatar May 27 '25 18:05 daversomethingsomething

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!

github-actions[bot] avatar Jun 11 '25 00:06 github-actions[bot]