ZCU-DATA/Show a per-bitstream embargo-date badge in the CLARIN file listing - #1394
Conversation
Fixes dataquest-dev/dspace-customers#823 (ZCU-DATA portion). ZCU-DATA's Item View file listing doesn't go through the standard file-download-link/AccessStatusBadgeComponent path used on ZCU-PUB (#1378) - it's a separate, CLARIN-specific component chain (clarin-files-section -> preview-section -> file-description) backed by a completely different REST endpoint (metadatabitstreams/search/byHandle) that returns a flat DTO, not a HAL resource with resolvable links. This is new implementation, not a port. Change set: - MetadataBitstream model gains status/embargoDate fields, matching what the backend companion PR (dataquest-dev/DSpace#1380) now embeds directly in that endpoint's response - no separate resolution step needed, unlike the HAL-link approach on ZCU-PUB. - file-description.component.html renders the same visual badge (badge badge-secondary, embargo.listelement.badge i18n key) used on ZCU-PUB, for a consistent look, next to the file name. - New item.bitstream.showAccessStatuses config flag (defaults to false, same reasoning as ZCU-PUB: flip only once the backend PR is deployed). - i18n copy matches ZCU-PUB/vanilla: "Embargo until {{ date }}" (en) / "Embargo do {{ date }}" (cs). Test evidence: npx ng lint --quiet -> All files pass linting. npx ng build --configuration production -> build succeeded, no budget warnings npx ng test (file-description.component.spec.ts) -> 5/5 SUCCESS, including coverage for: badge hidden by default, badge shown when embargoed + flag on, badge hidden when embargoed but flag off.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Companion backend PR: dataquest-dev/DSpace#1380. Sibling PR for ZCU-PUB (different implementation path, same feature): #1378. |
There was a problem hiding this comment.
Pull request overview
Adds feature-flagged support for displaying an embargo-until badge per CLARIN bitstream in the custom file listing path, by extending the MetadataBitstream DTO and rendering a localized badge next to the filename.
Changes:
- Extend
MetadataBitstreamwithstatusandembargoDatefields to match the updated REST payload. - Add
item.bitstream.showAccessStatusesconfiguration (defaultfalse) and wire it into the CLARINFileDescriptionComponent. - Introduce
embargo.listelement.badgei18n strings (en/cs) and unit tests covering the flag behavior.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/environments/environment.test.ts | Adds the new item.bitstream.showAccessStatuses flag to the test environment config. |
| src/config/item-config.interface.ts | Extends the item bitstream config interface with showAccessStatuses. |
| src/config/default-app-config.ts | Defines the default value (false) for the new bitstream access-status display flag. |
| src/assets/i18n/en.json5 | Adds the new embargo badge translation string. |
| src/assets/i18n/cs.json5 | Adds the Czech translation for the new embargo badge string. |
| src/app/item-page/simple/field-components/preview-section/file-description/file-description.component.ts | Reads the new feature flag for controlling badge display in the CLARIN file listing. |
| src/app/item-page/simple/field-components/preview-section/file-description/file-description.component.html | Renders the embargo-until badge next to the filename when enabled. |
| src/app/item-page/simple/field-components/preview-section/file-description/file-description.component.spec.ts | Adds unit coverage for badge hidden-by-default and gated-by-flag behavior. |
| src/app/core/metadata/metadata-bitstream.model.ts | Adds status/embargoDate autoserialized fields to the metadata bitstream model. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Manual verification against a local Docker stackBackend: Setup:
Close-up of the CLARIN file-description badge: Renders exactly as expected: "Embargo until 2027-06-30", right next to Note: initially hit a stale pre-built Screenshots pushed to orphan branch |
Matches the existing lock-icon pattern used on ZCU-PUB's file-download-link component for restricted bitstreams.
…yle 1:1 The lock icon now inherits link color (blue) by living inside an anchor that triggers downloadFile(), exactly mirroring the file-download-link component's <a><lock/>content</a> structure used on ZCU-PUB. Non-embargoed file names are unaffected (still plain text).
|
Fixed: lock icon/filename now match ZCU-PUB's visual style 1:1 (3dfd44a). Root cause of the mismatch in the previous screenshot: on ZCU-PUB, Fixed by wrapping the name (and lock icon) in a clickable element bound to 🔒 restricted-document.pdf (blue, clickable) — Embargo until 2027-06-30, now visually 1:1 with the ZCU-PUB screenshot. |
…sStatuses) (#1404) * ZCU-DATA/Enable per-bitstream embargo badge (item.bitstream.showAccessStatuses) The embargo-date badge (dspace-customers#823, FE #1394) is gated behind item.bitstream.showAccessStatuses, which defaults to false in default-app-config.ts. Set it to true in config.yml so the badge renders on redeploy. Safe now that the backend accessStatus endpoint is deployed for zcu-data (DSpace#1380); the frontend fails closed without it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Simplify embargo badge comment --------- Co-authored-by: Matus Kasak <matus.kasak@dataquest.sk> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>


Problem
The bitstream download in the ZCU-DATA Item View gives no indication when a restricted file's embargo lifts. Fixes dataquest-dev/dspace-customers#823 (ZCU-DATA frontend portion).
Root cause / why this isn't a port of #1378
ZCU-DATA's Item View doesn't use the standard
file-download-link/AccessStatusBadgeComponentpath at all - the wholeds-clarin-files-item-fieldblock is commented out in bothpublication.component.htmlanduntyped-item.component.html. Instead, every item page unconditionally renders<ds-clarin-files-section>(wired directly intosimple/item-page.component.html), which goes through a completely separate, CLARIN-specific component chain:clarin-files-section→preview-section→file-description, backed by its own REST endpoint (metadatabitstreams/search/byHandle→MetadataBitstreamWrapperRest) that returns a flat DTO per file rather than a HAL resource with resolvable links. This needed real new implementation, not a cherry-pick.Change set
MetadataBitstreammodel gainsstatus/embargoDatefields, matching what the backend companion PR (ZCU-DATA/Add bitstream-level access status/embargo date REST endpoint DSpace#1380) now embeds directly in the endpoint's response - no separate link-resolution step needed here, unlike the HAL-link approach on ZCU-PUB.file-description.component.htmlrenders the same visual badge (badge badge-secondary,embargo.listelement.badgei18n key) already used on ZCU-PUB (ZCU-PUB/Show a per-bitstream embargo-date badge in the Item View #1378), next to the file name, for a consistent look across both customer instances.item.bitstream.showAccessStatusesconfig flag, defaulting tofalse- same reasoning as ZCU-PUB/Show a per-bitstream embargo-date badge in the Item View #1378: flip it only once the backend PR is deployed."Embargo until {{ date }}"(en) /"Embargo do {{ date }}"(cs).Backend dependency
Needs dataquest-dev/DSpace#1380 (which also fixes a real pre-existing bug found while testing this: the CLARIN file listing 500'd entirely for any item with an embargoed bitstream, anonymously, independent of this change - see that PR for details). With the flag at its default
false, this frontend PR has no runtime effect either way.Test evidence
Covers: badge hidden by default (no embargo), badge shown when embargoed + flag on, badge hidden when embargoed but flag off (fail-safe default).
Risk & rollback
Low risk: two new optional fields on an existing DTO, one new conditional badge in one template, feature-flagged off by default. Revert is a straight
git revert.Notes / assumptions