diff options
author | dizzy <diosmosis@users.noreply.github.com> | 2022-01-13 11:59:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-13 11:59:25 +0300 |
commit | c252d952caa8466c4720abe153ced2199f71292a (patch) | |
tree | ac8bed853cb6887e8ffade23f20f0cbcb469f803 /plugins | |
parent | 4ba705e4dad91210558cba6715e7e9b6b5b4c553 (diff) |
expose notification type in CoreHome (#18611)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/CoreHome/vue/src/Notification/Notification.ts | 87 | ||||
-rw-r--r-- | plugins/CoreHome/vue/src/Notification/Notifications.store.ts | 80 | ||||
-rw-r--r-- | plugins/CoreHome/vue/src/Notification/index.ts | 1 |
3 files changed, 89 insertions, 79 deletions
diff --git a/plugins/CoreHome/vue/src/Notification/Notification.ts b/plugins/CoreHome/vue/src/Notification/Notification.ts new file mode 100644 index 0000000000..8ddfcd62f2 --- /dev/null +++ b/plugins/CoreHome/vue/src/Notification/Notification.ts @@ -0,0 +1,87 @@ +/*! + * Matomo - free/libre analytics platform + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + +interface Notification { + /** + * Only needed for persistent notifications. The id will be sent to the + * frontend once the user closes the notifications. The notification has to + * be registered/notified under this name. + */ + id?: string; + + /** + * Unique ID generated for the notification so it can be referenced specifically + * to scroll to. + */ + notificationInstanceId?: string; + + /** + * Determines which notification group a notification is meant to be displayed + * in. + */ + group?: string; + + /** + * The title of the notification. For instance the plugin name. + */ + title?: string; + + /** + * The actual message that will be displayed. Must be set. + */ + message: string; + + /** + * Context of the notification: 'info', 'warning', 'success' or 'error' + */ + context: 'success'|'error'|'info'|'warning'; + + /** + * The type of the notification: Either 'toast' or 'transient'. 'persistent' is valid, but + * has no effect if only specified client side. + * + * 'help' is only used by ReportingMenu.vue. + */ + type: 'toast'|'persistent'|'transient'|'help'; + + /** + * If set, the close icon is not displayed. + */ + noclear?: boolean; + + /** + * The number of milliseconds before a toast animation disappears. + */ + toastLength?: number; + + /** + * Optional style/css dictionary. For instance {'display': 'inline-block'} + */ + style?: string|Record<string, unknown>; + + /** + * Optional CSS class to add. + */ + class?: string; + + /** + * If true, fades the animation in. + */ + animate?: boolean; + + /** + * Where to place the notification. Required if showing a toast. + */ + placeat?: string|HTMLElement|JQuery; + + /** + * If true, the notification will be displayed before others currently displayed. + */ + prepend?: boolean; +} + +export default Notification; diff --git a/plugins/CoreHome/vue/src/Notification/Notifications.store.ts b/plugins/CoreHome/vue/src/Notification/Notifications.store.ts index 83916f64bd..701bddee17 100644 --- a/plugins/CoreHome/vue/src/Notification/Notifications.store.ts +++ b/plugins/CoreHome/vue/src/Notification/Notifications.store.ts @@ -14,85 +14,7 @@ import { import NotificationComponent from './Notification.vue'; import Matomo from '../Matomo/Matomo'; import createVueApp from '../createVueApp'; - -interface Notification { - /** - * Only needed for persistent notifications. The id will be sent to the - * frontend once the user closes the notifications. The notification has to - * be registered/notified under this name. - */ - id?: string; - - /** - * Unique ID generated for the notification so it can be referenced specifically - * to scroll to. - */ - notificationInstanceId?: string; - - /** - * Determines which notification group a notification is meant to be displayed - * in. - */ - group?: string; - - /** - * The title of the notification. For instance the plugin name. - */ - title?: string; - - /** - * The actual message that will be displayed. Must be set. - */ - message: string; - - /** - * Context of the notification: 'info', 'warning', 'success' or 'error' - */ - context: 'success'|'error'|'info'|'warning'; - - /** - * The type of the notification: Either 'toast' or 'transient'. 'persistent' is valid, but - * has no effect if only specified client side. - * - * 'help' is only used by ReportingMenu.vue. - */ - type: 'toast'|'persistent'|'transient'|'help'; - - /** - * If set, the close icon is not displayed. - */ - noclear?: boolean; - - /** - * The number of milliseconds before a toast animation disappears. - */ - toastLength?: number; - - /** - * Optional style/css dictionary. For instance {'display': 'inline-block'} - */ - style?: string|Record<string, unknown>; - - /** - * Optional CSS class to add. - */ - class?: string; - - /** - * If true, fades the animation in. - */ - animate?: boolean; - - /** - * Where to place the notification. Required if showing a toast. - */ - placeat?: string|HTMLElement|JQuery; - - /** - * If true, the notification will be displayed before others currently displayed. - */ - prepend?: boolean; -} +import Notification from './Notification'; interface NotificationsData { notifications: Notification[]; diff --git a/plugins/CoreHome/vue/src/Notification/index.ts b/plugins/CoreHome/vue/src/Notification/index.ts index abcc74b952..a7a929a5bb 100644 --- a/plugins/CoreHome/vue/src/Notification/index.ts +++ b/plugins/CoreHome/vue/src/Notification/index.ts @@ -10,3 +10,4 @@ import './Notifications.store.adapter'; export { default as Notification } from './Notification.vue'; export { default as NotificationGroup } from './NotificationGroup.vue'; export { default as NotificationsStore } from './Notifications.store'; +export { default as NotificationType } from './Notification'; |