From 037264b0bf23dd23c2cad943b4327198fc5134c8 Mon Sep 17 00:00:00 2001 From: Andrew Henry Date: Tue, 12 Feb 2019 11:32:23 -0800 Subject: [PATCH] Quick compatibility fix to support dismissing notifications from legacy list (#2283) --- .../commonUI/dialog/res/templates/message.html | 10 ++++++++++ .../src/NotificationIndicatorController.js | 15 ++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/platform/commonUI/dialog/res/templates/message.html b/platform/commonUI/dialog/res/templates/message.html index 4a41f43a69..c655faaffd 100644 --- a/platform/commonUI/dialog/res/templates/message.html +++ b/platform/commonUI/dialog/res/templates/message.html @@ -10,6 +10,16 @@ ng-show="ngModel.progressPerc !== undefined">
+ + {{dialogOption.label}} + + + {{ngModel.primaryOption.label}} +
diff --git a/platform/commonUI/notification/src/NotificationIndicatorController.js b/platform/commonUI/notification/src/NotificationIndicatorController.js index 9f695c1b6c..ced8b5b87e 100644 --- a/platform/commonUI/notification/src/NotificationIndicatorController.js +++ b/platform/commonUI/notification/src/NotificationIndicatorController.js @@ -43,12 +43,25 @@ define( * Launch a dialog showing a list of current notifications. */ $scope.showNotificationsList = function () { + let notificationsList = openmct.notifications.notifications.map(notification => { + if (notification.model.severity === 'alert' || notification.model.severity === 'info') { + notification.model.primaryOption = { + label: 'Dismiss', + callback: () => { + let currentIndex = notificationsList.indexOf(notification); + notification.dismiss(); + notificationsList.splice(currentIndex, 1); + } + } + } + return notification; + }) dialogService.getDialogResponse('overlay-message-list', { dialog: { title: "Messages", //Launch the message list dialog with the models // from the notifications - messages: openmct.notifications.notifications + messages: notificationsList } });