Skip to content

Add collection import UI to admin dashboard (PP-364)#195

Merged
jonathangreen merged 11 commits intomainfrom
feature/collection-import-ui
Feb 24, 2026
Merged

Add collection import UI to admin dashboard (PP-364)#195
jonathangreen merged 11 commits intomainfrom
feature/collection-import-ui

Conversation

@jonathangreen
Copy link
Member

@jonathangreen jonathangreen commented Feb 20, 2026

Description

  • Add CollectionImportButton component that renders a collapsible "Import" panel with a "Queue Import" button and "Force full re-import" checkbox for protocols that support import
  • Add supports_import field to ProtocolData interface, used to conditionally show the import controls
  • Add importCollection action that POSTs to /admin/collection/<id>/import
  • Add renderAdditionalContent() hook to ServiceEditForm so subclasses can inject additional panels
  • Wire CollectionEditForm to render the import button via renderAdditionalContent()
  • Display success/error feedback with Bootstrap alert styling (alert-success / alert-danger)
  • Reset component state (checkbox, feedback) when switching between collections

Motivation and Context

Companion to ThePalaceProject/circulation#3069. The backend now exposes supports_import in protocol details and provides a POST /admin/collection/<id>/import endpoint. This PR adds the admin UI to consume that API.

Screenshot 2026-02-20 at 2 01 37 PM

How Has This Been Tested?

  • Added comprehensive tests for CollectionImportButton covering: rendering conditions, checkbox toggle, import with/without force, success/error feedback styling, state reset on collection switch, disabled state, and loading state
  • Updated existing Collections tests to pass the new importCollection prop

Checklist:

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

Add a CollectionImportButton component that renders a "Queue Import"
button with a "Force full re-import" checkbox on the collection edit
screen for protocols that support import. Wire it into the Collections
page via context and connect it to the new backend import endpoint.
Wrap the import controls in a collapsible Panel, add alert-success and
alert-danger feedback styling, and use renderAdditionalContent hook on
ServiceEditForm to inject the import button cleanly.
@jonathangreen jonathangreen added enhancement New feature or request and removed enhancement New feature or request labels Feb 20, 2026
@jonathangreen jonathangreen requested a review from a team February 20, 2026 17:59
Copy link
Contributor

@tdilauro tdilauro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good!

It would be good to add a test for the importCollection Redux action, but the rest of the comments are all minor and shouldn't block merging.

jonathangreen and others added 8 commits February 23, 2026 20:42
Co-authored-by: Tim DiLauro <tdilauro@users.noreply.github.com>
Co-authored-by: Tim DiLauro <tdilauro@users.noreply.github.com>
Derive context type from parent class via indexed access instead of
manually re-declaring registerLibrary, and add importCollection to the
connect dispatch generic so TypeScript validates it against
mapDispatchToProps.
@jonathangreen jonathangreen merged commit 8359d85 into main Feb 24, 2026
1 check passed
@jonathangreen jonathangreen deleted the feature/collection-import-ui branch February 24, 2026 01:21
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.

2 participants