Skip to content

UoE/Bitstream name in upload notifications - #24

Merged
milanmajchrak merged 3 commits into
datashare-UoEMainLibrary-dspace-8_xfrom
uoe/bitstream-name-in-upload-notifications
Jul 16, 2026
Merged

UoE/Bitstream name in upload notifications#24
milanmajchrak merged 3 commits into
datashare-UoEMainLibrary-dspace-8_xfrom
uoe/bitstream-name-in-upload-notifications

Conversation

@jr-rk

@jr-rk jr-rk commented Jul 15, 2026

Copy link
Copy Markdown

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 onCompleteItemWithFile output on UploaderComponent carrying the client-side file name next to the parsed response (legacy onCompleteItem untouched, so other consumers are unaffected). SubmissionUploadFilesComponent uses 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 to en.json5. Upstream check: no equivalent in DSpace/dspace-angular dspace-8_x, implemented fresh.

Before:
image

After:
image
image

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>
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0dcddd2e-d0a0-40b0-9d66-fc250d7b3cca

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

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 UploaderComponent output (onCompleteItemWithFile) that emits both the parsed response and the uploaded file name (while keeping onCompleteItem intact).
  • 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.

Comment thread src/app/shared/upload/uploader/uploader-complete-event.model.ts
Comment thread src/app/shared/upload/uploader/uploader.component.ts
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>

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

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

  • onUploadError emits a structured object that matches UploaderError, but the output is still typed as EventEmitter<any>. Typing it as EventEmitter<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>();

Comment thread src/app/shared/upload/uploader/uploader.component.ts
@jr-rk jr-rk self-assigned this Jul 16, 2026
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>

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

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

@jr-rk
jr-rk requested a review from milanmajchrak July 16, 2026 10:20
@milanmajchrak
milanmajchrak merged commit 83be561 into datashare-UoEMainLibrary-dspace-8_x Jul 16, 2026
11 checks passed
milanmajchrak added a commit to dataquest-dev/dspace-angular that referenced this pull request Aug 3, 2026
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>
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.

3 participants