Notifications

NotificationData rules allow you to successfully trigger notifications in the Rhapsody Systems Engineering host application. This configuration defines the properties and format for notifications sent to the client.

Notification configuration options

title
Main message displayed in the notification.
subtitle
Additional information shown below the title.
kind
Specifies the notification type, controlling the icon and style. It should consist of an error, info, info-square, success, warning, or warning-alt.
isActionable
This is optional. When true, it displays an action button in the notification.
actionButtonLabel
This is optional. It is required if isActionable is true. Text displayed on the action button.
timeout
Duration in milliseconds before the notification dismisses automatically. It is set to 0 to disable auto-dismiss.
onAction
This is optional. This function is a callback function for action button click events.
onClose
This is optional. This function is a callback function for notification close events.

Sample notification usage

/**
 * Configuration object for notifications
 * @typedef {Object} NotificationData
 * @property {string} title - The main notification message
 * @property {string} subtitle - Additional details shown below the title
 * @property {('error'|'info'|'info-square'|'success'|'warning'|'warning-alt')} kind - The type of notification, controls the icon and styling
 * @property {boolean} [isActionable] - Whether the notification shows an action button
 * @property {number} [timeout] - Time in milliseconds before the notification auto-dismisses (0 for no auto-dismiss)
 * @property {string} [actionButtonLabel] - Label for the action button (required if isActionable is true)
 * @property {Function} [onAction] - Callback function when action button is clicked
 */
const notificationData = {
    title: 'Published successfully',
    subtitle: `The content was published successfully for the project with id: ${payload.ProjectId}`,
    kind: notificationKind.SUCCESS,
    isActionable: true,  // optional, required if actionButtonLabel is provided
    actionButtonLabel: 'Action after publish',  // optional, required if isActionable is true
    timeout: 10000,
    onAction: () => {
        console.log('Optionally, you can handle the clicking of the action button here');
    },
    onClose: () => {
        console.log('Optionally, you can handle the close event here');
	},
};

// then send the notification to the client
window.RHAPSODYSE.sendEvent(EXTENSION_EVENTS.SHOW_NOTIFICATION, notificationData);

Indicator data structure

Rhapsody Systems Engineering UI can handle up to four indicators per element. It displays the last indicator in the array, and if there are more, the Rhapsody Systems Engineering UI displays a number next to this indicator notifiying you that there are more indicators. If you click on this indicator, the Rhapsody Systems Engineering UI adds all the indicators in a tooltip. The following is a sample indicator data structure:

const indicators = [
	    {
	        indicatorURL: "http://localhost:3002/assets/diamond-exclamation.png",
	        indicatorTooltip: "ExtensionError",
			indicatorDescription: "An error occurred during the publishing process. This could be due to a variety of reasons such as network issues, server problems, or invalid data inputs. Please check the system logs for more detailed information about the cause of the error, and try to publish again after resolving any identified issues."
	    },
	    {
	        indicatorURL: "http://localhost:3002/assets/check-circle.png",
	        indicatorTooltip: "Extension - Published successfully",
			indicatorDescription: "The content was published successfully"
	    },
	    {
	        indicatorURL: "http://localhost:3002/assets/rotate-square.png",
	        indicatorTooltip: "Extension - Synced successfully",
			indicatorDescription: "Synchronization completed successfully"
	    },
	    {
	        indicatorURL: "http://localhost:3002/assets/triangle-warning.png",
	        indicatorTooltip: "Extension - Warning",
			indicatorDescription: "There is a warning that needs your attention"
	    }
	];