@diosmosis opened this Pull Request on October 27th 2021 Member

Description:

This PR is based off of https://github.com/matomo-org/matomo/pull/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

@sgiehl commented on November 12th 2021 Member

@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 commented on November 12th 2021 Member

@sgiehl done

This Pull Request was closed on November 15th 2021
Powered by GitHub Issue Mirror