The purpose of this document is to provide ZAP developers with simple instructions on how to add a notification.
Session notifications are set after a session is created. To add a session notification, call the setNotification function in zap/src-electron/query-session-notification.js. setNotification takes the following arguments:
For example,
async function iscDataLoader(db, state, sessionId) {
let endpointTypes = state.endpointTypes
let promises = []
await querySessionNotification.setNotification(
db,
'UPGRADE',
'ISC FILE UPGRADED TO ZAP FILE. PLEASE SAVE AS TO SAVE OFF NEWLY CREATED ZAP FILE.',
sessionId,
1,
0,
)
}
When calling the setNotification function, ensure a valid session Id is accessible within the current scope
For testing you can navigate to zap/src/pages/NotificationPage.vue, which queries the SESSION_NOTICE table and returns all notifications with the same SESSION_REF.
For example, the picture below is the result of importing an isc file in the notification page.
Package notifications are set when processing and loading a specific package. To add a package notification, call the setNotification function in zap/src-electron/query-package-notification.js. setNotification takes the following arguments:
For example,
function prepareEnumOrBitmap(db, packageId, a, dataType, typeMap) {
let message = 'Check type contradiction in XML metadata for ' +
a.$.name + ' with type ' + a.$.type
env.logWarning(message)
queryPackageNotification.setNotification(
db,
"WARNING",
message,
packageId,
2
)
}
When calling the setNotification function, ensure a valid package Id is accessible within the current scope
For testing you can navigate to zap/src/pages/ZapConfig.vue which queries the PACKAGE_NOTICE table and returns all notifications from packages referenced by the current session.
For example, in the pictures below, clicking the warning icon will lead you to a dialog showing all notifications for that package.
zap/src/pages/NotificationPage.vue will display all notifications from packages chosen or imported by the user, like shown in the picture below