CLARIN-DSpace v9/Port #1269 (Add bitstream from URL on MyDSpace) to the v9 base - #1507
Merged
Merged
Conversation
… workspace items
An editable workspace item in /mydspace gains an "Add bitstream from URL" action
(link icon + tooltip), shown when the user can edit the item AND the
`file-downloader` script exists and is executable for them. It opens a modal
with a required URL and an optional bitstream name, invokes the script with
`-u <url> -w <workspaceitem id>` (plus `-n <name>` only when a name was given),
notifies, and navigates to `/processes/<id>`.
The backend half is already on 9-base: `dspace/config/spring/rest/scripts.xml`
declares the `file-downloader` bean and `FileDownloader.java` is byte-identical
with dtq-dev, so this is a front-end-only port.
v9 adaptations against the 9-base pre-image (which is NOT vanilla - it already
carries the CLARIN share-submission action, so this is a partial-port file, not
a vanilla-wholesale one):
* standalone component: `FormsModule` (for `[(ngModel)]`) and
`BtnDisabledDirective` added to `imports[]`.
* `[disabled]` -> `[dsBtnDisabled]` on the modal's Add button - 9-base's
`dspace-angular-html/no-disabled-attribute-on-button` is an eslint *error*.
* modal close button `class="close"` + `×` -> Bootstrap 5 `btn-close`,
matching the sibling discard modal in the same template.
* `form-group` -> `mb-3` (Bootstrap 5).
* every `*ngIf` -> `@if`, matching the rest of the file after the v9 migration.
* `getProcessDetailRoute(String(rd.payload.processId))` - `Process.processId` is
declared `string` but the REST payload delivers a JSON number (the spec's own
fixtures use `{ processId: 202 }`), so `String()` keeps the route stable.
* `void this.router.navigateByUrl(...)` - the neighbouring `shareSubmission()`
on 9-base already writes `void this.router.navigate(...)`; without it the port
would add a new `no-floating-promises` warning.
* spec: the existing 9-base standalone TestBed plus a `ScriptDataService` spy;
`of` instead of `of as observableOf`. 8 -> 13 `it()`.
* en.json5: the 9 keys are added in the source's relative position (after
`submission.workflow.generic.share-submission.tooltip`) but without blank lines
between them, matching the compact style of the CLARIN block they land in;
cs.json5 keeps the `// "<key>": "<EN>"` comment convention (+27 lines, exactly
as in the source).
Source: 1c285b4 (dtq-dev PR #1269)
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Ports
dataquest-dev/dspace-angular#1269 (1c285b4a6b, "UFAL/[Port to dtq-dev] Add 'Add URLbitstream' feature to workspace items") to
dtq-dev-9-base. Sync card FE-27 (tranche T4).An editable workspace item in
/mydspacegains an "Add bitstream from URL" action (link icon +tooltip), shown when the user can edit the item and the
file-downloaderscript exists and isexecutable for them. It opens a modal with a required URL and an optional bitstream name, invokes
the script with
-u <url> -w <workspaceitem id>(plus-n <name>only when a name was given),notifies, and navigates to
/processes/<id>.Changes
shared/mydspace-actions/workspaceitem/workspaceitem-actions.component.tsFILE_DOWNLOADER_SCRIPT_NAME,canUseFileDownloader$,processingAddFromUrl$,bitstreamFromUrl,bitstreamName,openAddBitstreamFromUrlModal(),addBitstreamFromUrl();ScriptDataServiceinjected…workspaceitem-actions.component.html#addBitstreamFromUrlModaltemplate…workspaceitem-actions.component.spec.tsit(),ScriptDataServicespyassets/i18n/en.json5,cs.json5submission.workflow.generic.add-url-bitstream*keysFront-end only — the backend half is already on
dtq-dev-9-base:(The July audit that reported the script beans as missing is stale.)
Why
The feature is entirely absent on the v9 base — not "present by name with the body gone", genuinely
absent:
v9 adaptations (translate, not transplant)
The 9-base pre-image is not vanilla — it already carries the CLARIN share-submission action — so
this is a partial-port file, and each hunk was re-derived against the real target:
FormsModule(for[(ngModel)]) andBtnDisabledDirectiveadded toimports[]; 7.x reached both throughSharedModule, which does not exist on v9.[disabled]→[dsBtnDisabled]on the modal's Add button —dspace-angular-html/no-disabled-attribute-on-buttonis an eslint error on 9-base(
.eslintrc.json:345), and the directive is the accessible replacement (it setsaria-disabledand swallows the click rather than removing the button from the a11y tree).
class="close"+×→class="btn-close"(Bootstrap 5) — identical to the siblingdiscard modal already in this template.
form-group→mb-3(Bootstrap 5), ×2.*ngIf→@if, matching the rest of the file after the v9 control-flow migration.getProcessDetailRoute(String(rd.payload.processId))—Process.processIdis declaredstringon both branches, so nothing fails to compile withoutString(); the reason is runtime:the REST payload delivers a JSON number, which is exactly why the source's own spec fixtures are
{ processId: 202 }.String()keeps the produced route stable either way.void this.router.navigateByUrl(...)— the neighbouringshareSubmission()on 9-base alreadywrites
void this.router.navigate(...); withoutvoidthis port would add a newno-floating-promiseswarning (measured: 7 warnings without it, 6 with — and those 6 are allpre-existing).
ScriptDataServicespy;ofinstead ofof as observableOf; trailing commas where 7.x omitted them (comma-dangleis an error here).en.json5: the 9 keys go in the source's relative position (right aftersubmission.workflow.generic.share-submission.tooltip) but without blank lines between them,matching the compact style of the CLARIN block they land in — 9 lines rather than the source's 18.
cs.json5keeps the// "<key>": "<EN>"convention and is +27, exactly as in the source.Hunk-level parity was checked line by line: after normalising whitespace, every added line in
en.json5andcs.json5is identical to the source's, and the only differences in the other threefiles are the adaptations listed above.
Testing
Negative control — both mutations revert production code only; the spec was never touched:
add_url_bitstreambutton block from the template and makeaddBitstreamFromUrlan early-return no-op → 4 FAILED, 9 SUCCESS(
should display add URL bitstream button when script is executable,should invoke file-downloader with -u and -w and optional -n,should navigate to process detail and close modal on add from URL success,should show error notification on add from URL failure);canUseFileDownloader$from the button's@ifguard → 1 FAILED, 12 SUCCESS(
should not display add URL bitstream button when script is not executable).All five new cases fail under one of the two, so none is vacuous — worth stating for the second one,
whose
expect(btn).toBeNull()shape is the same one that produced a vacuous test elsewhere in thissync.
Manual verification on dev-6 is scenario LINDAT-123; not run here — this branch is not deployed,
and the authenticated
system/scripts/file-downloaderprobe needs the admin secret(anonymously it correctly returns 401).
Source:
1c285b4a6b(dtq-dev PR #1269, itself a port ofufal/dspace-angular#110).Sync card: FE-27.
🤖 Generated with Claude Code