diff --git a/web_interface/static/v3/js/widgets/notification.js b/web_interface/static/v3/js/widgets/notification.js index 5fa43f0d..f1cf9405 100644 --- a/web_interface/static/v3/js/widgets/notification.js +++ b/web_interface/static/v3/js/widgets/notification.js @@ -58,6 +58,9 @@ // Track active notifications let activeNotifications = []; + // onAction callbacks for notifications with an inline action button, + // keyed by notification id (cleaned up on dismiss). + const actionCallbacks = {}; let notificationCounter = 0; /** @@ -113,6 +116,7 @@ // Remove from tracking array activeNotifications = activeNotifications.filter(id => id !== notificationId); + delete actionCallbacks[notificationId]; } /** @@ -158,6 +162,20 @@ html += `${escapeHtml(message)}`; + // Optional inline action button (e.g. "Restart Now" on a restart nudge). + // The callback is stored by id and invoked via triggerAction, which + // also dismisses the notification. + if (options.actionLabel && typeof options.onAction === 'function') { + actionCallbacks[notificationId] = options.onAction; + html += ` + + `; + } + if (dismissible) { html += `