Notification Config object¶
The Notification Config object specifies the appearance of the notifications panel. If a Notification Config is passed to Common Canvas a notifications button will be shown on the far right of the canvas toolbar. When clicked, the button opens the Notificaiton Panel.
For information about the structure of notification messages, refer to the Notification Messages page. Messages can be added and removed from the notification panel by calling the notification methods in the canvas-controller..
The Notification Config object looks like this:
const notificationConfig = {
action: "notification",
label: "Notifications",
enable: true,
notificationHeader: "Notification Messages",
notificationSubtitle: "subtitle",
emptyMessage: "You don't have any notifications right now.",
clearAllMessage: "Clear all",
keepOpen: true,
clearAllCallback: () => { console.log("Clear All clicked"); }
};
-
action - “notification” enables the notifications button to appear in the far right of the toolbar.
-
label - the Tooltip label to display for the notifications button in the toolbar.
-
enable - Toolbar button will have hover effect and is clickable when set to true. If false, the button will be disabled and unclickable. If not set, it will default to disabled (enable: false)
-
notificationHeader - String to display in the notification panel header. If not set, it will default to “Notifications”.
-
notificationSubtitle - String to be displayed as a sub-title in the panel header. If not set, panel header will be sized to only contain the
notificationHeader
string. -
emptyMessage - String to be displayed when there are no notification messages to display.
-
clearAllMessage - String to be displayed on a button displayed at the bottom of the panel. The button can be clicked to clear all the messages from the panel. If omitted the button, and the footer area of the panel it appears in, will not be displayed.
-
keepOpen - A boolean which indicates when the panel will close. The default is false. If set to false, the panel will close when the user clicks on the page somewhere outside the panel. If set to true the panel will remain open when the user clicks somewhere on the page outside of the panel. With the option the user must click the
x
icon in the top right of the panel, or click the notification toolbar icon, to close the panel. -
clearAllCallback - An optional callback function that will be called every time the “clear all” button is clicked.
-
secondaryButtonLabel - Label for the optional secondary button to be displayed in the notification panel. Both
secondaryButtonLabel
andsecondaryButtonCallback
must be specified for the button to appear. - secondaryButtonCallback - A callback function that will be called when the secondary button is clicked.
- secondaryButtonDisabled - Specify whether the secondary button is disabled or not.