Skip to content

PER-10621: use Archivematica thumbnails#1051

Open
cecilia-donnelly wants to merge 1 commit into
mainfrom
per-10621-archivematica-thumbnails
Open

PER-10621: use Archivematica thumbnails#1051
cecilia-donnelly wants to merge 1 commit into
mainfrom
per-10621-archivematica-thumbnails

Conversation

@cecilia-donnelly

@cecilia-donnelly cecilia-donnelly commented Jun 8, 2026

Copy link
Copy Markdown
Member

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 (thumbnail256 was not null), then running update record set thumburl200 = null, thumburl500 = null, thumburl1000 = null, thumburl2000 = null where recordid = _ID_OF_NEW_RECORD in 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!

@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.97%. Comparing base (2b811f1) to head (18db8cd).
⚠️ Report is 4 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cecilia-donnelly cecilia-donnelly force-pushed the per-10621-archivematica-thumbnails branch from 46004fa to 309741d Compare June 8, 2026 19:51
@cecilia-donnelly cecilia-donnelly changed the title PER-10621: try this on dev PER-10621: use Archivematica thumbnails Jun 8, 2026
@cecilia-donnelly cecilia-donnelly force-pushed the per-10621-archivematica-thumbnails branch 2 times, most recently from 2e54c37 to b63b1dc Compare June 8, 2026 21:00
@cecilia-donnelly cecilia-donnelly requested a review from slifty June 8, 2026 21:00
@cecilia-donnelly cecilia-donnelly marked this pull request as ready for review June 8, 2026 21:04
@cecilia-donnelly cecilia-donnelly marked this pull request as draft June 8, 2026 21:13
@cecilia-donnelly cecilia-donnelly force-pushed the per-10621-archivematica-thumbnails branch from 9ce98b6 to b071b9e Compare June 11, 2026 18:30
@cecilia-donnelly cecilia-donnelly marked this pull request as ready for review June 11, 2026 20:21
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.
@cecilia-donnelly cecilia-donnelly force-pushed the per-10621-archivematica-thumbnails branch from b071b9e to 18db8cd Compare June 11, 2026 20:21
@cecilia-donnelly

Copy link
Copy Markdown
Member Author

I think this is ready for review now @slifty -- I would test it on dev.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 thumbnailUrls map (including 256) and maps them onto RecordVO.
  • Adds thumbnail256 to 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.

Comment on lines 253 to 258
if (
!item.isFolder &&
!item.thumbURL200 &&
!item.thumbnail256 &&
item.parentFolderId === this.currentFolder.folderId
) {
Comment on lines +107 to +113
thumbnailUrls: {
'200': string;
'256': string;
'500': string;
'1000': string;
'2000': string;
};
Comment on lines +177 to +181
thumbURL200: stelaRecord.thumbnailUrls?.['200'],
thumbURL500: stelaRecord.thumbnailUrls?.['500'],
thumbURL1000: stelaRecord.thumbnailUrls?.['1000'],
thumbURL2000: stelaRecord.thumbnailUrls?.['2000'],
thumbnail256: stelaRecord.thumbnailUrls?.['256'],
@slifty

slifty commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Dang here I was ready to hit approve, but at least a few of the things copilot found look legitimate

@aasandei-vsp aasandei-vsp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot covered a lot it seems, I only have a small remark.
I am not sure how I can check it locally, but I did upload a few images and then click around to see different sizes and it all looked ok.

if (
!item.isFolder &&
!item.thumbURL200 &&
!item.thumbnail256 &&

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe just add a test for this change?

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.

4 participants