[Bug 42804] New: Replace svc/cover_images and tools/upload-cover-image.pl with REST API
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42804 Bug ID: 42804 Summary: Replace svc/cover_images and tools/upload-cover-image.pl with REST API Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com QA Contact: testopia@bugs.koha-community.org CC: tomascohen@gmail.com Depends on: 42404, 42405 Blocks: 42643 Target Milestone: --- The old CGI-based cover image upload (tools/upload-cover-image.pl) and delete (svc/cover_images) endpoints need to be replaced with the new REST API endpoints introduced in bugs 42404 and 42405. This involves: 1. Create a CoverImageAPIClient (fetch-based) to encapsulate the API calls 2. Rewrite upload-images.js to POST to /api/v1/biblios/{biblio_id}/cover_images (single) or /api/v1/cover_images/batch (zip) 3. Replace svc/cover_images delete calls with DELETE /api/v1/cover_images/{image_id} 4. Add background job progress polling reusing existing Koha job progress components 5. Update upload-images.tt to remove CGI form actions 6. Remove tools/upload-cover-image.pl once no longer referenced The JS work should reuse the existing background job progress UI components where possible. Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42404 [Bug 42404] Add a batch cover images upload endpoint https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 [Bug 42405] Add single cover image upload path https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42643 [Bug 42643] [OMNIBUS] Assorted performance and stability work -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42804 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Comma delimited| |ByWater Solutions list of Sponsors| | Status|NEW |Needs Signoff Patch complexity|--- |Small patch Sponsorship status|--- |Sponsored -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42804 --- Comment #1 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 200155 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200155&action=edit Bug 42804: Replace svc/cover_images and upload-cover-image.pl with REST API client This patch replaces the CGI-based cover image upload workflow with the REST API endpoints from bugs 42404 and 42405. Changes: - Rewrite CoverImageAPIClient to use /api/v1 endpoints - Rewrite upload-images.js: single uploads POST directly to the API, batch uploads enqueue a background job and poll with updateProgress - Remove CGI form action from upload-images.tt - Add job progress panel for batch imports - Delete uses DELETE /api/v1/cover_images/{image_id} - No longer depends on file-upload.js or the svc/cover_images CGI Test plan: 1. Apply patches for bugs 42404, 42405, and this one 2. Navigate to Tools > Upload local cover image 3. Upload a single image for a biblio => SUCCESS: Image uploads without page reload, success message shown 4. Upload a zip file with idlink.txt => SUCCESS: Progress bar shown, completion message with image count 5. Click delete on an existing cover image thumbnail => SUCCESS: Image removed without page reload 6. Navigate to a specific biblio detail page, click upload cover image => SUCCESS: Single image uploads correctly for that biblio 7. Sign off :-D Sponsored-by: ByWater Solutions -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42804 --- Comment #2 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 200156 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200156&action=edit Bug 42804: (follow-up) Remove unused svc/cover_images and strip upload CGI This patch removes assets that are no longer needed after the migration to the REST API: - Remove svc/cover_images (replaced by DELETE /api/v1/cover_images/{id}) - Strip tools/upload-cover-image.pl down to page rendering only (image processing now handled by the REST API) No functional changes - the UI behavior is identical. Test plan: 1. Apply patch 2. Verify the upload page still renders: Navigate to Tools > Upload local cover image => SUCCESS: Page loads correctly 3. Verify svc/cover_images is gone: curl http://localhost:8081/cgi-bin/koha/svc/cover_images => SUCCESS: 404 4. Sign off :-D Sponsored-by: ByWater Solutions -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42804 --- Comment #3 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 200157 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200157&action=edit Bug 42804: (follow-up) Replace confirm() with Bootstrap modal for delete This patch replaces the browser-native confirm() dialog with a proper Bootstrap modal for the cover image delete action on the upload page, consistent with other delete confirmation patterns in Koha (e.g. delete_item_confirmation.inc). Test plan: 1. Apply patch 2. Navigate to Tools > Upload local cover image for a biblio with images 3. Click the delete icon on a thumbnail => SUCCESS: Bootstrap modal appears asking for confirmation 4. Click Cancel => SUCCESS: Modal dismisses, image not deleted 5. Click Delete => SUCCESS: Image removed 6. Sign off :-D Sponsored-by: ByWater Solutions -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42804 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@openfifth.c | |o.uk Depends on|42404 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42404 [Bug 42404] Add a batch cover images upload endpoint -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42804 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42804 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42804 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #200155|0 |1 is obsolete| | Attachment #200156|0 |1 is obsolete| | Attachment #200157|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42804 --- Comment #4 from David Nind <david@davidnind.com> --- Created attachment 201137 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201137&action=edit Bug 42804: Replace svc/cover_images and upload-cover-image.pl with REST API client This patch replaces the CGI-based cover image upload workflow with the REST API endpoints from bugs 42404 and 42405. Changes: - Rewrite CoverImageAPIClient to use /api/v1 endpoints - Rewrite upload-images.js: single uploads POST directly to the API, batch uploads enqueue a background job and poll with updateProgress - Remove CGI form action from upload-images.tt - Add job progress panel for batch imports - Delete uses DELETE /api/v1/cover_images/{image_id} - No longer depends on file-upload.js or the svc/cover_images CGI Test plan: 1. Apply patches for bugs 42404, 42405, and this one 2. Navigate to Tools > Upload local cover image 3. Upload a single image for a biblio => SUCCESS: Image uploads without page reload, success message shown 4. Upload a zip file with idlink.txt => SUCCESS: Progress bar shown, completion message with image count 5. Click delete on an existing cover image thumbnail => SUCCESS: Image removed without page reload 6. Navigate to a specific biblio detail page, click upload cover image => SUCCESS: Single image uploads correctly for that biblio 7. Sign off :-D Sponsored-by: ByWater Solutions Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42804 --- Comment #5 from David Nind <david@davidnind.com> --- Created attachment 201138 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201138&action=edit Bug 42804: (follow-up) Remove unused svc/cover_images and strip upload CGI This patch removes assets that are no longer needed after the migration to the REST API: - Remove svc/cover_images (replaced by DELETE /api/v1/cover_images/{id}) - Strip tools/upload-cover-image.pl down to page rendering only (image processing now handled by the REST API) No functional changes - the UI behavior is identical. Test plan: 1. Apply patch 2. Verify the upload page still renders: Navigate to Tools > Upload local cover image => SUCCESS: Page loads correctly 3. Verify svc/cover_images is gone: curl http://localhost:8081/cgi-bin/koha/svc/cover_images => SUCCESS: 404 4. Sign off :-D Sponsored-by: ByWater Solutions Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42804 --- Comment #6 from David Nind <david@davidnind.com> --- Created attachment 201139 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201139&action=edit Bug 42804: (follow-up) Replace confirm() with Bootstrap modal for delete This patch replaces the browser-native confirm() dialog with a proper Bootstrap modal for the cover image delete action on the upload page, consistent with other delete confirmation patterns in Koha (e.g. delete_item_confirmation.inc). Test plan: 1. Apply patch 2. Navigate to Tools > Upload local cover image for a biblio with images 3. Click the delete icon on a thumbnail => SUCCESS: Bootstrap modal appears asking for confirmation 4. Click Cancel => SUCCESS: Modal dismisses, image not deleted 5. Click Delete => SUCCESS: Image removed 6. Sign off :-D Sponsored-by: ByWater Solutions Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42804 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #7 from David Nind <david@davidnind.com> --- Testing notes (using KTD): 1. Enable these system prferences: - LocalCoverImages - OPACLocalCoverImages - AllowMultipleCovers 2. Navigate to Cataloging > Tools > Upload local cover images 3. For the third patch ((follow-up) Replace confirm() with Bootstrap modal for delete), I: - Went to a record with an image - Went to the Images tab on the record details page - Clicked 'Upload' - Uploaded another cover image - Result: Two images - Clicked 'Delete image' for one of the images - Get Bootstrap pop-up window - If I click 'Cancel', returns to the page and no images deleted - If I click 'Delete', the image is deleted and upload page shows with the remaining image -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42804 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #201137|0 |1 is obsolete| | Attachment #201138|0 |1 is obsolete| | Attachment #201139|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42804 --- Comment #8 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 201334 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201334&action=edit Bug 42804: Replace svc/cover_images and upload-cover-image.pl with REST API client This patch replaces the CGI-based cover image upload workflow with the REST API endpoints from bugs 42404 and 42405. Changes: - Rewrite CoverImageAPIClient to use /api/v1 endpoints - Rewrite upload-images.js: single uploads POST directly to the API, batch uploads enqueue a background job and poll with updateProgress - Remove CGI form action from upload-images.tt - Add job progress panel for batch imports - Delete uses DELETE /api/v1/cover_images/{image_id} - No longer depends on file-upload.js or the svc/cover_images CGI Test plan: 1. Apply patches for bugs 42404, 42405, and this one 2. Navigate to Tools > Upload local cover image 3. Upload a single image for a biblio => SUCCESS: Image uploads without page reload, success message shown 4. Upload a zip file with idlink.txt => SUCCESS: Progress bar shown, completion message with image count 5. Click delete on an existing cover image thumbnail => SUCCESS: Image removed without page reload 6. Navigate to a specific biblio detail page, click upload cover image => SUCCESS: Single image uploads correctly for that biblio 7. Sign off :-D Sponsored-by: ByWater Solutions Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42804 --- Comment #9 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 201335 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201335&action=edit Bug 42804: (follow-up) Remove unused svc/cover_images and strip upload CGI This patch removes assets that are no longer needed after the migration to the REST API: - Remove svc/cover_images (replaced by DELETE /api/v1/cover_images/{id}) - Strip tools/upload-cover-image.pl down to page rendering only (image processing now handled by the REST API) No functional changes - the UI behavior is identical. Test plan: 1. Apply patch 2. Verify the upload page still renders: Navigate to Tools > Upload local cover image => SUCCESS: Page loads correctly 3. Verify svc/cover_images is gone: curl http://localhost:8081/cgi-bin/koha/svc/cover_images => SUCCESS: 404 4. Sign off :-D Sponsored-by: ByWater Solutions Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42804 --- Comment #10 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 201336 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201336&action=edit Bug 42804: (follow-up) Replace confirm() with Bootstrap modal for delete This patch replaces the browser-native confirm() dialog with a proper Bootstrap modal for the cover image delete action on the upload page, consistent with other delete confirmation patterns in Koha (e.g. delete_item_confirmation.inc). Test plan: 1. Apply patch 2. Navigate to Tools > Upload local cover image for a biblio with images 3. Click the delete icon on a thumbnail => SUCCESS: Bootstrap modal appears asking for confirmation 4. Click Cancel => SUCCESS: Modal dismisses, image not deleted 5. Click Delete => SUCCESS: Image removed 6. Sign off :-D Sponsored-by: ByWater Solutions Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org