Commit dde11215 by Sofia Papagiannaki Committed by GitHub

Alerting: Fix modal text for deleting obsolete notifier (#31171)

parent 23621357
...@@ -219,25 +219,28 @@ export class AlertTabCtrl { ...@@ -219,25 +219,28 @@ export class AlertTabCtrl {
ThresholdMapper.alertToGraphThresholds(this.panel); ThresholdMapper.alertToGraphThresholds(this.panel);
for (const addedNotification of alert.notifications) { for (const addedNotification of alert.notifications) {
let identifier = addedNotification.uid;
// lookup notifier type by uid // lookup notifier type by uid
let model: any = _.find(this.notifications, { uid: addedNotification.uid }); let model: any = _.find(this.notifications, { uid: identifier });
// fallback using id if uid is missing
if (!model && addedNotification.id) {
identifier = addedNotification.id;
model = _.find(this.notifications, { id: identifier });
}
// fallback to using id if uid is missing
if (!model) { if (!model) {
model = _.find(this.notifications, { id: addedNotification.id }); appEvents.emit(CoreEvents.showConfirmModal, {
if (!model) { title: 'Notifier with invalid identifier is detected',
appEvents.emit(CoreEvents.showConfirmModal, { text: `Do you want to delete notifier with invalid identifier: ${identifier} from the dashboard JSON?`,
title: 'Notifier with invalid ID is detected', text2: 'After successful deletion, make sure to save the dashboard for storing the update JSON.',
text: `Do you want to delete notifier with invalid ID: ${addedNotification.id} from the dashboard JSON?`, icon: 'trash-alt',
text2: 'After successful deletion, make sure to save the dashboard for storing the update JSON.', confirmText: 'Delete',
icon: 'trash-alt', yesText: 'Delete',
confirmText: 'Delete', onConfirm: async () => {
yesText: 'Delete', this.removeNotification(addedNotification);
onConfirm: async () => { },
this.removeNotification(addedNotification); });
},
});
}
} }
if (model && model.isDefault === false) { if (model && model.isDefault === false) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment