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

[Vue] migrate notifications directive & service + UI.Notifications #18225

Merged
merged 119 commits into from Nov 15, 2021

Conversation

diosmosis
Copy link
Member

@diosmosis diosmosis commented Oct 27, 2021

Description:

This PR is based off of #18214.

This PR is fairly complicated since the original notifications code added and removed DOM nodes itself, where this management is meant to be done (in most cases) by the framework.

Changes:

  • Migrated notification angularjs directive to Vue (in Notification.vue).

  • Moved notification.js logic to new NotificationsStore class. This store houses a list of displayed notifications. Notifications are added to the store to display them, removed from the store to destroy them.

  • Created NotificationGroup component to display a list of notifications based on what's in the store. This approximates the placeat functionality except instead of directly adding DOM nodes to an element, we are adding notifications to the store which a NotificationGroup will see and display. The specific NotificationGroup that displays the notification is determined by a new group property in client side notifications.

    • NotificationGroups are currently dynamically instantiated via NotificationsStore.show(). If we see that the placeat node is not initialized as the vue component, we do so. Then it pulls notifications from the store and displays them.
    • This dynamic instantiation logic will eventually be removed once Vue is used everywhere (then the component will just be used directly).
  • Added toast functionality to NotificationsStore (the previous implementation appears to be completely broken).

  • Implemented the scrollToNotification() functionality using an attribute we select for, since we no longer have the actual DOM node for a notification.

image

Review

…se v-model, add event parameters to createAngularAdapter, allow translate to use variadic args or one string array + rebuild
…ndling to just reset back to the previous date since it was easier in vue to do that)
@diosmosis diosmosis marked this pull request as ready for review November 10, 2021 01:41
@diosmosis diosmosis added the Needs Review PRs that need a code review label Nov 10, 2021
@sgiehl
Copy link
Member

sgiehl commented Nov 12, 2021

@diosmosis could you please merge in the latest changes from 4.x-dev and resolve the conflicts. The diff currently also shows all changes from the previous PR, so it's hard to look through it.

@diosmosis
Copy link
Member Author

@sgiehl done

Copy link
Member

@sgiehl sgiehl left a comment

Choose a reason for hiding this comment

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

Overall this seems to work. The animation for appearing notifications looks slightly different, but imho that would be fine, as it doesn't make a big difference.
Left some small comments, besides that it would be good to merge.
Not sure if maybe @peterhashair wants to have a look as well.

plugins/CoreHome/vue/src/Menudropdown/Menudropdown.vue Outdated Show resolved Hide resolved
plugins/UsersManager/tests/UI/UsersManager_spec.js Outdated Show resolved Hide resolved
Copy link
Contributor

@peterhashair peterhashair left a comment

Choose a reason for hiding this comment

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

Looks good, maybe one mirror CSS change.

plugins/CoreHome/vue/src/Menudropdown/Menudropdown.vue Outdated Show resolved Hide resolved
@@ -8,6 +8,10 @@
margin-top: 1em;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

not sure if we need a max-width:1300px here. see the image, the notification is not lined up on a large screen.
image

Copy link
Member Author

Choose a reason for hiding this comment

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

@peterhashair this looks strange, I agree, but I think it's a problem w/ admin pages, since it looks fine on the dashboard and other report pages (the widgets stretch as far as the notification). I checked on 4.x-dev and it's an issue there so I'm guessing this might be a good candidate for a new issue 👍

Copy link
Member

@sgiehl sgiehl left a comment

Choose a reason for hiding this comment

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

LGTM. Merged in latest 4.x-dev changes. Will wait for the tests before merging.

@sgiehl sgiehl merged commit 89cb577 into 4.x-dev Nov 15, 2021
@sgiehl sgiehl deleted the vue-notifications branch November 15, 2021 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants