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

Frontend updates: Search functionality to users page #1280

Merged
merged 9 commits into from
Jun 6, 2024

Conversation

MartinaeyNL
Copy link
Contributor

@MartinaeyNL MartinaeyNL commented Apr 4, 2024

In regards to issue #1274, I added a search field to both "regular user" and "service user" tables,
that filters the shown items in the table. So, this filtering done locally on the client after fetching all users.

Only includes frontend changes.

Changelog;

  • Added search field to tables on the users page, that locally filters the _users or _serviceUsers array based on
    username, email, first name, last name, et cetera. Using @input on the search field for live updates of the tables.
  • Minor cleanup / refactors
  • Small styling changes

… 'live' attribute for text fields that trigger on every character change.
@MartinaeyNL MartinaeyNL changed the title Added search functionality to users page & or-mwc-input updates Frontend updates: Search functionality to users page / or-mwc-input Apr 4, 2024
@MartinaeyNL MartinaeyNL linked an issue Apr 5, 2024 that may be closed by this pull request
Copy link
Member

@richturner richturner left a comment

Choose a reason for hiding this comment

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

See my comments

richturner

This comment was marked as duplicate.

@MartinaeyNL MartinaeyNL marked this pull request as draft May 7, 2024 09:36
@MartinaeyNL
Copy link
Contributor Author

Put it back to a draft as it is currently WIP.

…s not working properly for @input. (original input element needs to be referenced, but its living in the shadow dom)
@MartinaeyNL MartinaeyNL marked this pull request as ready for review May 7, 2024 12:20
@MartinaeyNL
Copy link
Contributor Author

Went through the requested changes, and tried out to use event bubbling instead of re-dispatching an event.
However, event bubbling was not working for @input listener unfortunately.
Comments from me;

Since @input only dispatches the keypress, for example H, we have no idea what its current value is.
Normally we would use event.currentTarget for this, but with the shadow DOM it won't return the correct element.
Directly referencing OrMwcInput.value also won't work, as this value isn't updated before a user submit.

I think adding a live property, where @input behaves exactly the same as @change does now,
is the most useful solution here. (instead of simply redispatching the input event)

Feel free to PM me if an additional chat is necessary 😄

@richturner
Copy link
Member

I still don't understand the need for this live option; for example in other parts of the code base the @input event handler is attached to the or-mwc-input control and the current value can be accessed:

@input=${(ev: Event) => inputChanged((ev.target as OrMwcInput).nativeValue)}

Happy to have a call to clarify why this alternative approach is required

@MartinaeyNL
Copy link
Contributor Author

MartinaeyNL commented May 28, 2024

Thanks for referring to OrMwcInput.nativeValue, as that was the fix I was looking for.
Previously .value was not working, as it didn't have the actual input value, only the submitted one.
This is now resolved.

Removed the live property from or-mwc-input as there is no use for it anymore.

@DonWillems you can either deploy this on a test server first, or simply approve this.

@MartinaeyNL MartinaeyNL requested review from DonWillems and removed request for richturner May 28, 2024 10:04
@MartinaeyNL MartinaeyNL changed the title Frontend updates: Search functionality to users page / or-mwc-input Frontend updates: Search functionality to users page Jun 6, 2024
@MartinaeyNL MartinaeyNL merged commit c3a0352 into master Jun 6, 2024
1 check passed
@MartinaeyNL MartinaeyNL deleted the feature/users-improvements branch June 6, 2024 15:17
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.

Users: add fields to filter users by username or email
3 participants