From 3928d0c5313aa282ed7e4648b8b2a187807405f0 Mon Sep 17 00:00:00 2001 From: Sofia Papagiannaki Date: Mon, 12 Oct 2020 21:14:08 +0300 Subject: [PATCH] Alerting: remove obsolete notifiers (after user confirmation) (#28190) * Alerting: remove obsolete notifiers (after user confirmation) * Additional text in confirmation modal --- public/app/features/alerting/AlertTabCtrl.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/public/app/features/alerting/AlertTabCtrl.ts b/public/app/features/alerting/AlertTabCtrl.ts index 775cc665348..9acccba931b 100644 --- a/public/app/features/alerting/AlertTabCtrl.ts +++ b/public/app/features/alerting/AlertTabCtrl.ts @@ -225,6 +225,19 @@ export class AlertTabCtrl { // fallback to using id if uid is missing if (!model) { model = _.find(this.notifications, { id: addedNotification.id }); + if (!model) { + appEvents.emit(CoreEvents.showConfirmModal, { + title: 'Notifier with invalid ID is detected', + text: `Do you want to delete notifier with invalid ID: ${addedNotification.id} from the dashboard JSON?`, + text2: 'After successful deletion, make sure to save the dashboard for storing the update JSON.', + icon: 'trash-alt', + confirmText: 'Delete', + yesText: 'Delete', + onConfirm: async () => { + this.removeNotification(addedNotification); + }, + }); + } } if (model && model.isDefault === false) {