mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Fix modal text for deleting obsolete notifier (#31171)
This commit is contained in:
committed by
GitHub
parent
23621357b0
commit
dde11215e9
@@ -219,16 +219,20 @@ 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) {
|
|
||||||
model = _.find(this.notifications, { id: addedNotification.id });
|
|
||||||
if (!model) {
|
if (!model) {
|
||||||
appEvents.emit(CoreEvents.showConfirmModal, {
|
appEvents.emit(CoreEvents.showConfirmModal, {
|
||||||
title: 'Notifier with invalid ID is detected',
|
title: 'Notifier with invalid identifier is detected',
|
||||||
text: `Do you want to delete notifier with invalid ID: ${addedNotification.id} from the dashboard JSON?`,
|
text: `Do you want to delete notifier with invalid identifier: ${identifier} from the dashboard JSON?`,
|
||||||
text2: 'After successful deletion, make sure to save the dashboard for storing the update JSON.',
|
text2: 'After successful deletion, make sure to save the dashboard for storing the update JSON.',
|
||||||
icon: 'trash-alt',
|
icon: 'trash-alt',
|
||||||
confirmText: 'Delete',
|
confirmText: 'Delete',
|
||||||
@@ -238,7 +242,6 @@ export class AlertTabCtrl {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (model && model.isDefault === false) {
|
if (model && model.isDefault === false) {
|
||||||
model.iconClass = this.getNotificationIcon(model.type);
|
model.iconClass = this.getNotificationIcon(model.type);
|
||||||
|
|||||||
Reference in New Issue
Block a user