PER-10621: use Archivematica thumbnails#1051
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1051 +/- ##
==========================================
- Coverage 50.03% 49.97% -0.06%
==========================================
Files 348 348
Lines 11497 11497
Branches 1974 1974
==========================================
- Hits 5752 5746 -6
- Misses 5559 5560 +1
- Partials 186 191 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
46004fa to
309741d
Compare
2e54c37 to
b63b1dc
Compare
9ce98b6 to
b071b9e
Compare
Map the 256 size thumbnail from the stela response to the record. Also check for it in the data service when deciding whether or not to refresh an item. I wanted to add a test, but I'm not sure this one is useful.
b071b9e to
18db8cd
Compare
|
I think this is ready for review now @slifty -- I would test it on dev. |
There was a problem hiding this comment.
Pull request overview
Updates the web-app’s thumbnail handling to prefer Archivematica’s 256px thumbnails so thumbnails can still render when other sizes are missing, aligning with the post-#923 thumbnail access approach.
Changes:
- Avoids re-queuing thumbnail refreshes when a 256px thumbnail is already present.
- Adjusts Stela record shaping to read thumbnail URLs from a
thumbnailUrlsmap (including256) and maps them ontoRecordVO. - Adds
thumbnail256to the lean whitelist and adds a unit test for the Stela record conversion.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/app/shared/services/data/data.service.ts | Tweaks missing-thumbnail detection to account for thumbnail256. |
| src/app/shared/services/api/record.repo.ts | Updates Stela record typing and conversion to use thumbnailUrls (including 256). |
| src/app/shared/services/api/record.repo.spec.ts | Adds test coverage for mapping thumbnailUrls onto RecordVO thumb fields. |
| src/app/shared/services/api/base.ts | Adds thumbnail256 to LeanWhitelist so lean responses can include the 256px thumbnail. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if ( | ||
| !item.isFolder && | ||
| !item.thumbURL200 && | ||
| !item.thumbnail256 && | ||
| item.parentFolderId === this.currentFolder.folderId | ||
| ) { |
| thumbnailUrls: { | ||
| '200': string; | ||
| '256': string; | ||
| '500': string; | ||
| '1000': string; | ||
| '2000': string; | ||
| }; |
| thumbURL200: stelaRecord.thumbnailUrls?.['200'], | ||
| thumbURL500: stelaRecord.thumbnailUrls?.['500'], | ||
| thumbURL1000: stelaRecord.thumbnailUrls?.['1000'], | ||
| thumbURL2000: stelaRecord.thumbnailUrls?.['2000'], | ||
| thumbnail256: stelaRecord.thumbnailUrls?.['256'], |
|
Dang here I was ready to hit approve, but at least a few of the things copilot found look legitimate |
| if ( | ||
| !item.isFolder && | ||
| !item.thumbURL200 && | ||
| !item.thumbnail256 && |
There was a problem hiding this comment.
Maybe just add a test for this change?
Use the 256 size thumbnails wherever possible in the web-app. This is a followup to #923, which changed the way we load thumbnails in general. With this change, thumbnails will appear even if the other sizes are not available.
For thumbnails to appear in the file list, it needs companion PR https://github.com/PermanentOrg/back-end/pull/881. This one alone fixes the thumbnail in the sidebar editing modal.
I tested this by uploading a record on dev, checking to make sure that it got an Archivematica thumbnail (
thumbnail256was not null), then runningupdate record set thumburl200 = null, thumburl500 = null, thumburl1000 = null, thumburl2000 = null where recordid = _ID_OF_NEW_RECORDin the database directly.I mentioned this in the commit message, but I'm not sure this test is particularly useful - I just wanted to guard against a regression here somehow. Suggestions welcome!