Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CST-12044 visualize the primary bitstream & CST-12043 primary bitstream flag #2631

Merged

Conversation

vNovski
Copy link
Contributor

@vNovski vNovski commented Nov 13, 2023

Please note that this development has been funded by the University of California - California Digital Library.

References

DSpace PR: DSpace/DSpace#9195

Description

  • Added a bitstream switch on the download page for each file and also add a switch in the modal editing window of a specific file, which can be used to make the bitstream the primary.
  • Added a badge primary aside the file name for the bitstream that has been eventually set as primary

INTERNAL DOCUMENTATION:

  • Added a new method to bitstream-data.service.ts findPrimaryBitstreamByItemAndName() which allows you to get a primary bitstream based on item and origin
  • In addition to implementing the business logic described in the task, the behavior of the custom switch was also fixed so that it was correctly processed by the form builder, specifically data normalization. Also, the custom switch did not use translate pipe for automatic label translation

Instructions for Reviewers

Review for primary bitstream switch has been done with the following cases:

  • Edit Submission form

    • Upload files:

      • Scroll down to file list

        • activate the switch for one of the files - automaticaly saves and updates

        • activate the switch for another file → previous primary bitstream turns off automatically and new primary bitstream turns on then automaticaly saves and updates

        • deactivate the switch of current primary bitstream → primary bitstream turns off then automaticaly saves and updates

        • activate the switch for one of the files - automaticaly saves and updates

        • delete file witch is primary - file is deleted and primary bitstream is reseted then automaticaly saves and updates

      • open file edit modal for one of the files

        • activate the primary bitstream switcher then click save - saves and updates
      • open file edit modal for file witch is not primary

        • activate the primary bitstream switcher then click save - previous primary bitstream turns off automatically and new primary bitstream turns on then saves and updates
      • open file edit modal for file witch is primary

        • deactivate the switch of primary bitstream then click save → primary bitstream turns off then saves and updates

SCREENSHOTS:
Modal:
image
Upload Files form:
image

Review for badge which indicates primary bitstream has been done with the following cases:

  • if bitstream is primary then badge [Primary] is displayed
    image
  • if bitstream is not primary then badge [Primary] is not displayed
    image

Checklist

  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
  • My PR passes ESLint validation using yarn lint
  • My PR doesn't introduce circular dependencies (verified via yarn check-circ-deps)
  • My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • If my PR includes new libraries/dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

@hardyoyo
Copy link
Member

hardyoyo commented Jan 22, 2024

I'm attempting to test this PR in concert with the backend PR... and... I cannot see the primary bitstream switch on the submission form. Is there any chance you can post a screenshot of what this is supposed to look like for the submission form (not the edit a bitstream modal, I'm aware of what that modal looks like, and that functionality still works in my testing).

I'm attaching a screenshot of what I see on the upload form:

image

Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

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

@vNovski : Thanks! Tested and reviewed this today. It looks good overall & works! That said, I found a small bug, and I think we may want to look at the layout of the page a bit.

Here's what I see on the submission form with this PR (and the backend PR):
Primary-bitstream

A few points about that layout:

  • The "Primary Bitstream" header is aligned right, while the buttons are aligned center. It makes it look a bit odd.
  • I think we need a header over the file section that says something like "File Details" or "File Information". That would make it clear this is a table of information.
  • (Not Required) I'm starting to wonder if we should rename the "Primary Bitstream" header on the submission form to say "Primary File" or "Primary?". I noticed that submission form doesn't use the term "bitstsream". So, we may want to consider just calling everything a "file" on this page.

One small bug that I noticed: If you click on a primary bitstream, then accept/reject the license, then change the primary bitstream the changes are not saved. Here's how to reproduce:

  • Upload at least to bitstreams on the submission form
  • Select one as primary (should succeed)
  • Now either check or uncheck the license checkbox
  • Immediately select the other bitstream as the primary bitstream.
  • No error will occur, but the primary bitstream is unchanged. It appears the PATCH request sent was only to update the license checkbox and NOT for the new primary bitstream.

I have a few other minor comments inline. Overall though this all looks good.

@vNovski
Copy link
Contributor Author

vNovski commented Feb 6, 2024

@vNovski : Thanks! Tested and reviewed this today. It looks good overall & works! That said, I found a small bug, and I think we may want to look at the layout of the page a bit.

Here's what I see on the submission form with this PR (and the backend PR): Primary-bitstream

A few points about that layout:

  • The "Primary Bitstream" header is aligned right, while the buttons are aligned center. It makes it look a bit odd.
  • I think we need a header over the file section that says something like "File Details" or "File Information". That would make it clear this is a table of information.
  • (Not Required) I'm starting to wonder if we should rename the "Primary Bitstream" header on the submission form to say "Primary File" or "Primary?". I noticed that submission form doesn't use the term "bitstsream". So, we may want to consider just calling everything a "file" on this page.

One small bug that I noticed: If you click on a primary bitstream, then accept/reject the license, then change the primary bitstream the changes are not saved. Here's how to reproduce:

  • Upload at least to bitstreams on the submission form
  • Select one as primary (should succeed)
  • Now either check or uncheck the license checkbox
  • Immediately select the other bitstream as the primary bitstream.
  • No error will occur, but the primary bitstream is unchanged. It appears the PATCH request sent was only to update the license checkbox and NOT for the new primary bitstream.

I have a few other minor comments inline. Overall though this all looks good.

For the pull request, I made the following changes:

  1. Removed --code-coverage from package.json.
  2. Added two texts for the tag, depending on the selected option: "Make {{fileName}} the primary bitstream" and "Remove {{fileName}} as the primary bitstream".
  3. Fixed linting issues.
  4. Changed the label "Primary bitstream" to "Primary File".
  5. Fixed an issue with the license button that was preventing saving, now everything works correctly.

@tdonohue tdonohue self-requested a review February 6, 2024 15:29
Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

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

Thanks @vNovski ! This looks good except for a very minor issue. I have retested & verified that all prior bugs are fixed and everything else looks good.

So, once this issue is fixed (and the backend PR is ready), then this will be ready to merge.

[checked]="isPrimary"
(change)="togglePrimaryBitstream($event)">
<label class="custom-control-label" for="primaryBitstream{{fileIndex}}">
<span class="sr-only" aria-hidden="true" *ngIf="!isPrimary">{{'submission.sections.upload.primary.make' | translate:{ fileName: fileName } }}</span>
Copy link
Member

@tdonohue tdonohue Feb 14, 2024

Choose a reason for hiding this comment

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

aria-hidden=true should be removed from this <span> along with the one below it.

I think I mistakenly asked you to add this.. My apologies as I was wrong. The class="sr-only" is all that is needed to pass accessibility checks. Currently, the accessibility checks in "axe DevTools" fail on this line because the aria-hidden=true hides the text in the span from the accessibility scanner.

(change)="togglePrimaryBitstream($event)">
<label class="custom-control-label" for="primaryBitstream{{fileIndex}}">
<span class="sr-only" aria-hidden="true" *ngIf="!isPrimary">{{'submission.sections.upload.primary.make' | translate:{ fileName: fileName } }}</span>
<span class="sr-only" aria-hidden="true" *ngIf="isPrimary">{{'submission.sections.upload.primary.remove' | translate:{ fileName: fileName } }}</span>
Copy link
Member

Choose a reason for hiding this comment

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

Same here, please remove aria-hidden=true attribute

@vNovski
Copy link
Contributor Author

vNovski commented Feb 15, 2024

@vNovski : Thanks! Tested and reviewed this today. It looks good overall & works! That said, I found a small bug, and I think we may want to look at the layout of the page a bit.
Here's what I see on the submission form with this PR (and the backend PR): Primary-bitstream
A few points about that layout:

  • The "Primary Bitstream" header is aligned right, while the buttons are aligned center. It makes it look a bit odd.
  • I think we need a header over the file section that says something like "File Details" or "File Information". That would make it clear this is a table of information.
  • (Not Required) I'm starting to wonder if we should rename the "Primary Bitstream" header on the submission form to say "Primary File" or "Primary?". I noticed that submission form doesn't use the term "bitstsream". So, we may want to consider just calling everything a "file" on this page.

One small bug that I noticed: If you click on a primary bitstream, then accept/reject the license, then change the primary bitstream the changes are not saved. Here's how to reproduce:

  • Upload at least to bitstreams on the submission form
  • Select one as primary (should succeed)
  • Now either check or uncheck the license checkbox
  • Immediately select the other bitstream as the primary bitstream.
  • No error will occur, but the primary bitstream is unchanged. It appears the PATCH request sent was only to update the license checkbox and NOT for the new primary bitstream.

I have a few other minor comments inline. Overall though this all looks good.

For the pull request, I made the following changes:

  1. Removed --code-coverage from package.json.
  2. Added two texts for the tag, depending on the selected option: "Make {{fileName}} the primary bitstream" and "Remove {{fileName}} as the primary bitstream".
  3. Fixed linting issues.
  4. Changed the label "Primary bitstream" to "Primary File".
  5. Fixed an issue with the license button that was preventing saving, now everything works correctly.

For the pull request, I made the following changes:

  1. The aria-hidden attribute has been removed.

Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

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

👍 Thanks @vNovski !

@tdonohue tdonohue merged commit dcf5836 into DSpace:main Feb 20, 2024
13 checks passed
@tdonohue
Copy link
Member

While this has been merged, I'm flagging as needs documentation until we can update the Submission documentation to include basic details about this feature: https://wiki.lyrasis.org/display/DSDOC8x/Submission+User+Interface

@tdonohue tdonohue added the needs documentation PR is missing documentation. All new features and config changes require documentation. label Feb 20, 2024
@GraziaQuercia
Copy link

Hi @tdonohue here's the documentation page: https://wiki.lyrasis.org/display/DSDOC8x/Set+a+bitstream+as+primary
If any change is needed, let me know! Thanks in advance

@tdonohue tdonohue removed the needs documentation PR is missing documentation. All new features and config changes require documentation. label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

5 participants