UoE/Bitstream name in upload notifications - #24
Conversation
Multi-file drag-and-drop uploads showed generic 'Upload successful'/'Upload failed' toasts, so users could not tell which file each notification referred to. Add a non-breaking onCompleteItemWithFile output on UploaderComponent that carries the client-side file name alongside the parsed response, and use it (plus the existing error payload) in SubmissionUploadFilesComponent to render per-file notifications, falling back to the generic keys when no name is available. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
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 |
There was a problem hiding this comment.
Pull request overview
This PR improves submission upload UX by including the client-side file name in success/failure notifications, making multi-file drag-and-drop toasts unambiguous.
Changes:
- Added a new
UploaderComponentoutput (onCompleteItemWithFile) that emits both the parsed response and the uploaded file name (while keepingonCompleteItemintact). - Updated submission upload components (including the Datashare theme override) to use the new event and render filename-aware notifications with fallback to the generic messages.
- Added i18n keys (English) and unit tests covering both the filename and fallback paths.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/themes/datashare/app/submission/form/submission-upload-files/submission-upload-files.component.html | Switches upload completion binding to the new filename-carrying output and forwards upload error event. |
| src/app/submission/form/submission-upload-files/submission-upload-files.component.html | Same binding change in the base theme template. |
| src/app/submission/form/submission-upload-files/submission-upload-files.component.ts | Builds filename-aware translated notification content with fallback to existing generic keys. |
| src/app/submission/form/submission-upload-files/submission-upload-files.component.spec.ts | Adds tests for filename-aware notifications and fallback behavior. |
| src/app/shared/upload/uploader/uploader.component.ts | Emits the new completion event alongside the legacy completion event. |
| src/app/shared/upload/uploader/uploader.component.spec.ts | Adds a test asserting both completion outputs are emitted. |
| src/app/shared/upload/uploader/uploader-complete-event.model.ts | Introduces the completion event model used by the new output. |
| src/assets/i18n/en.json5 | Adds new English i18n strings that include {{fileName}}. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The emitter can pass undefined when the FileItem carries no file name; the interface claimed it was always present. Also cover the missing-file-name emit in the uploader spec. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/app/shared/upload/uploader/uploader.component.ts:105
onUploadErroremits a structured object that matchesUploaderError, but the output is still typed asEventEmitter<any>. Typing it asEventEmitter<UploaderError>will improve consumer type-safety (e.g.SubmissionUploadFilesComponent.onUploadError(error?: UploaderError)).
/**
* The function to call on error occurred
*/
@Output() onUploadError: EventEmitter<any> = new EventEmitter<any>();
Omit fileName from UploaderCompleteEvent when unknown instead of emitting an explicit undefined, type the onUploadError output as EventEmitter<UploaderError>, and drop the explicit undefined fileName from the fallback spec. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
83be561
into
datashare-UoEMainLibrary-dspace-8_x
Upload success and failure toasts in the submission form now name the file
they refer to ("File "report.pdf" uploaded successfully") instead of the
anonymous "Upload successful" / "Upload failed", so a submitter dropping
several files can tell which one each toast is about.
The uploader gains an additive `onCompleteItemWithFile` output carrying the
parsed response plus the client-side file name; the legacy `onCompleteItem`
is retained and still emits the bare parsed body first, byte-identically, so
the five other uploader consumers are untouched. `onUploadError` is retyped
from `any` to the existing `UploaderError`. A single `getNotificationContent`
helper is the only place an upload notification key literal appears.
The CLARIN client-side size-limit rejection is preserved exactly: its
discriminator still compares against a one-argument `translate.instant(key)`
and still runs first, and its message is emitted un-interpolated and without
a file name. The error handler resolves the name from both emitted item
shapes (FileItem from onErrorItem, FileLikeObject from onWhenAddingFileFailed).
Locales that have not translated the two new keys render the generic message
via the `default` interpolate param that MissingTranslationHelper already
honours, rather than a raw dotted key. cs.json5 carries human translations.
Ported from dataquest-dev#24.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
What: Upload success/error notifications in the submission workflow now include the file name, so multi-file drag-and-drop no longer shows ambiguous generic toasts.
Why: With multiple files dropped at once, generic "Upload successful"/"Upload failed" toasts gave no way to tell which file each message referred to.
How: Added a non-breaking
onCompleteItemWithFileoutput onUploaderComponentcarrying the client-side file name next to the parsed response (legacyonCompleteItemuntouched, so other consumers are unaffected).SubmissionUploadFilesComponentuses it plus the existing error payload to render per-file notifications via new{{fileName}}i18n keys, falling back to the generic keys when no name is available. English-only key added toen.json5. Upstream check: no equivalent in DSpace/dspace-angulardspace-8_x, implemented fresh.Before:

After:

