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

Closes #2509: New notifications UI #2530

Merged
merged 10 commits into from
Sep 24, 2024
Merged

Closes #2509: New notifications UI #2530

merged 10 commits into from
Sep 24, 2024

Conversation

diasf
Copy link

@diasf diasf commented Aug 6, 2024

New UI to manage notifications:

  • Show notifications in a paged table with multi selection enabled
  • Allow to select all notifications in a page and all notifications of the user for deletion
  • Allow filtering by simple text field
  • Filter is applied on new searchLabel column. The column is filled when notification is added based on the object pointed by the objectid.
  • Added an admin API (/admin/index/usernotifications) to fill out the new column for existing notifications

Alternatively to the DB based filtering we could add a new solr index.

Issue: #2509

@diasf diasf requested a review from madryk August 6, 2024 12:27
Comment on lines +44 to +46
static public UserNotificationQuery newQuery() {
return new UserNotificationQuery();
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we are making this a builder kind of class then I think that we should block creating the object outside of it by adding private constructor.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, good point, added private constructor.

Comment on lines 16 to 18
int resultLimit = DEFAULT_RESULT_LIMIT;

boolean ascending;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any reason why this is not private? Do we need it to be package private?

Copy link
Author

Choose a reason for hiding this comment

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

Made them private.


List<Predicate> predicates = new ArrayList<>();
if (StringUtils.isNotBlank(queryParam.getSearchLabel())) {
predicates.add(criteriaBuilder.like(criteriaBuilder.lower(root.get("searchLabel")), "%" + queryParam.getSearchLabel().toLowerCase() + "%"));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do index on searchLabel will be used when we lower case it in the query? If yes then ok. If not then I would consider to keep lowercased searchLabel in the DB (since we use this field only for searching) and skip lowercasing it here.

Copy link
Author

Choose a reason for hiding this comment

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

Setting it to lower case in the db seems actually cleaner to me. I've adjusted that.

notification.deleteSelected.btn=Usu\u0144 wybrane
notification.deleteSelected=Usu\u0144 powiadomienia
notification.deleteSelected.info=Powiadomienia zostan\u0105 usuni\u0119ty po naci\u015Bni\u0119ciu przycisku "Usu\u0144".
notification.numSelected=Obecnie wybrano {0} {0,choice,0#powiadomie\u0144|1#powiadomienie|2#powiadomie\u0144}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Depending on the number we will have:

  • Obecnie wybrano 0 powiadomień - OK
  • Obecnie wybrano 1 powiadomienie - OK
  • Obecnie wybrano 2 powiadomień - I think it should be powiadomienia
  • Obecnie wybrano 3 powiadomień - As above
  • Obecnie wybrano 4 powiadomień - As above
  • Obecnie wybrano 5 powiadomień - OK

Copy link
Author

Choose a reason for hiding this comment

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

Corrected.

Comment on lines +741 to +742
@GET
@Path("usernotifications")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I assume that method GET is to keep the consistency between other endpoints in Index. Is that right? Because endpoint will result in some change in DB. If yes then then ignore this comment

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, it's to be consistent with the other endpoints. They're all GET requests despite performing actions/write operations (apart from 2 DELETE which accurately delete things). Didn't want to break that "consistency" for this new one.

@madryk madryk assigned diasf and unassigned madryk Sep 19, 2024
@diasf diasf requested a review from madryk September 20, 2024 10:21
@diasf diasf assigned madryk and unassigned diasf Sep 20, 2024
@madryk madryk assigned diasf and unassigned madryk Sep 23, 2024
@diasf diasf merged commit 2e81850 into develop Sep 24, 2024
1 check passed
@diasf diasf deleted the fdias-2509-notification-ui branch September 24, 2024 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants