Notification Messages
Notification Message structure.¶
Notification messages are displayed in the notification panel which the user can access by clicking the Notifications button in the toolbar. The application specifies an array of messages using the notification methods in the canvas controller. The appearance of the panel is customized in the Notification Config.
The application passes to Common Canvas an array of messages each described by a simple JavaScript object like this:
{
id: <string>,
type: <string>,
title: <string or JSX object>,
content: <string or JSX object>,
timestamp: <string>,
callback: <function>,
closeMessage: <string or JSX object>
}
-
id (string, required): this is a unique ID assigned to the notification message. This is passed as a parameter in the callback (see below) and is used to reference messages when deleting them through the
CanvasController
API. -
type (string, required): this must be one of four values: “info”, “success”, “warning”, or “error”. If
type
is null, empty string, or undefined, the message type will be “unspecified”. -
title (string or JSX object): the title of the notification message.
-
content (string or JSX object): the body of the notification message.
-
callback (function): an optional callback function that will be called when the notification message is clicked. Callback function is called with one parameter,
id
-
timestamp (string or JSX object): an optional timestamp that will be rendered in a separate section with different formatting, if passed in
-
closeMessage (string or React object): an optional message that, if passed in, will display as clickable. Clicking on this will delete this individual message. If none is passed in, no delete option will be shown.