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

Change - Metadata field selector, add infinite scroll for data paginated #3096

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

VictorHugoDuranS
Copy link
Contributor

Hi @tdonohue , I'm @jtimal partner, I like to share this PR with you:

References

Description

I changed metadata field selector add infinite scroll for pagination all data from metadata field service, this change load all options in the start

Instructions for Reviewers

To see the new implementation, I attch a video with the functionality: https://youtu.be/8D-EjhubABI

List of changes in this PR:

  • I changed the template metadata-field-selector.component.html adding the infinite scroll directives
  • I changed the search function to page the query detecting change value on input
  • I changed the observable list to "behaviorsubject" for update the current list
  • I added a function for update the current list options according the query search, only if the user scroll to last item of the list

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.

@tdonohue tdonohue added bug 1 APPROVAL pull request only requires a single approval to merge component: Item (Archived) Item display or editing ux User Experience related works port to main This PR needs to be ported to `main` branch for the next major release labels May 31, 2024
this.input.valueChanges.pipe(
debounceTime(this.debounceTime),
startWith(''),
tap( () => this.currentPage$.next(1) )
Copy link
Member

Choose a reason for hiding this comment

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

It's not a good idea to "perform work" in a tap. Taps are meant for debugging purposes, and shouldn't affect anything else. The main reason for that is that the code in the tap won't be executed if nothing is subscribed to the pipe in the end. Since you're subscribing immediately underneath this line that's not an issue here, but then there's also no good reason not to move this code to the subscribe as well.

Choose a reason for hiding this comment

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

@artlowel Hi, I changed this observable in the subscribe function

debounceTime(this.debounceTime),
startWith(''),
tap( () => this.currentPage$.next(1) )
).subscribe((valueChange) => {
Copy link
Member

Choose a reason for hiding this comment

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

Please also add this subscribe to the subs array, so it can be unsubscribed onDestroy

Choose a reason for hiding this comment

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

@artlowel I aded to subs array

@pilasou
Copy link
Contributor

pilasou commented Sep 5, 2024

Hi, I tested the PR. It works as described : when adding a metadata field to an archived Item, full list of metadata available is listed in the Field Column with ability to scroll down :
image

When starting to type metadata name (i.e dc.identifier) the metadata list is filtered accordingly and can still be scrolled.

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.

@VictorHugoDuranS : We reviewed this as a team in our weekly DevMtg today. Some of the feedback can be found above. One other note to add is that we'd need to have a version of this PR built against main, so that we can port it to 8.x and 9.0. If you could create a separate PR for main, that'd be appreciated. (An alternative would be to update this PR to be against main, and we can then just apply this fix in 9.0 and 8.x only). Thanks!

</ng-container>
<button *ngIf="loading"
class="list-group-item list-group-item-action border-0 list-entry">
<ds-themed-loading [showMessage]="false"></ds-themed-loading>
Copy link
Member

Choose a reason for hiding this comment

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

When this is ported to main, I believe this <ds-themed-loading> tag will need to be <ds-loading> because of the changes in 8.0 applied in #2865.

So, this is an example of why we need a separate PR for main. This current code is correct for 7.x, but will fail in 8.x or main.

Choose a reason for hiding this comment

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

@tdonohue. I merged the main branch with this branch and changed the "ds-loading" import. Thanks for the feedback

# Conflicts:
#	src/app/dso-shared/dso-edit-metadata/metadata-field-selector/metadata-field-selector.component.ts
#	src/app/dso-shared/dso-shared.module.ts
Copy link

github-actions bot commented Sep 8, 2024

Hi @VictorHugoDuranS,
Conflicts have been detected against the base branch.
Please resolve these conflicts as soon as you can. Thanks!

@VictorHugoDuranS VictorHugoDuranS changed the base branch from dspace-7_x to main September 8, 2024 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 APPROVAL pull request only requires a single approval to merge bug component: Item (Archived) Item display or editing port to main This PR needs to be ported to `main` branch for the next major release ux User Experience related works
Projects
Status: 👀 Under Review
Development

Successfully merging this pull request may close these issues.

List of available metadata fields is truncated when adding new metadata in "Edit Item"
5 participants