Skip to content

Extract shared dashboard patterns into reusable helpers#23

Merged
Theauxm merged 1 commit intomainfrom
refactor/dashboard-deduplication
Apr 1, 2026
Merged

Extract shared dashboard patterns into reusable helpers#23
Theauxm merged 1 commit intomainfrom
refactor/dashboard-deduplication

Conversation

@Theauxm
Copy link
Copy Markdown
Member

@Theauxm Theauxm commented Apr 1, 2026

Summary

  • Extract RunBatchOperationAsync, BatchError, BatchOperating into PollingComponentBase — replaces identical try/catch/finally wrappers in 10 batch methods across 5 data pages
  • Add DataGridQueryHelper.LoadPageAsync<T> — generic server-side pagination that replaces identical 20-line LoadPageAsync methods in 4 pages (DeadLetters, WorkQueue, Metadata, Logs)
  • Add CancellationHelper.CancelTrainsAsync — centralizes the "set DB flag + call CancellationRegistry" pattern used by MetadataPage, MetadataDetailPage, and ManifestGroupDetailPage
  • Move GetWorkQueueStatusBadgeStyle to DashboardFormatters — was duplicated verbatim in WorkQueuePage and WorkQueueDetailPage
  • Add PausePolling to PollingComponentBase — skips poll refreshes while user has active checkbox selections, preventing data from being yanked out from under them

Net result: -178 lines across 13 files, with all shared logic in 3 focused utility classes. Future pages get batch operations and pagination for free.

Test plan

  • dotnet build — zero warnings
  • dotnet test — all 108 existing Dashboard tests pass + 4 new GetWorkQueueStatusBadgeStyle tests
  • Manual: navigate to each data list page, verify checkboxes + batch buttons + polling pause work
  • Manual: verify detail page cancel buttons still work (MetadataDetail, ManifestGroupDetail)

Deduplicate batch operation wrappers, server-side pagination, cancel
logic, and badge helpers that were copy-pasted across all data pages.

- Add RunBatchOperationAsync, BatchError, BatchOperating to
  PollingComponentBase (replaces identical try/catch/finally in 10
  methods across 5 pages)
- Add DataGridQueryHelper.LoadPageAsync for server-side pagination
  (replaces identical 20-line methods in 4 pages)
- Add CancellationHelper.CancelTrainsAsync for DB flag + registry
  cancel (replaces logic in MetadataPage, MetadataDetailPage,
  ManifestGroupDetailPage)
- Move GetWorkQueueStatusBadgeStyle to DashboardFormatters (was
  duplicated in WorkQueuePage and WorkQueueDetailPage)
- Add PausePolling to PollingComponentBase to skip refreshes while
  user has active checkbox selections
@Theauxm Theauxm merged commit 33c13c5 into main Apr 1, 2026
1 check passed
@Theauxm Theauxm deleted the refactor/dashboard-deduplication branch April 1, 2026 15:06
@traxsharp
Copy link
Copy Markdown

traxsharp Bot commented Apr 1, 2026

This PR is included in version 1.12.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant