From 51a152456fb7cb5c213e684a2302873f0681c19c Mon Sep 17 00:00:00 2001 From: Domas Date: Wed, 20 Oct 2021 15:45:26 +0300 Subject: [PATCH] fix unified alerting enabled checks (#40693) --- public/app/features/alerting/state/ThresholdMapper.ts | 2 +- .../components/DeleteDashboard/DeleteDashboardModal.tsx | 2 +- public/app/features/dashboard/utils/panel.ts | 2 +- .../query/state/DashboardQueryRunner/DashboardQueryRunner.ts | 2 +- public/app/plugins/panel/graph/thresholds_form.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/public/app/features/alerting/state/ThresholdMapper.ts b/public/app/features/alerting/state/ThresholdMapper.ts index 107067a0def..5e089484b40 100644 --- a/public/app/features/alerting/state/ThresholdMapper.ts +++ b/public/app/features/alerting/state/ThresholdMapper.ts @@ -4,7 +4,7 @@ import { PanelModel } from 'app/features/dashboard/state'; export const hiddenReducerTypes = ['percent_diff', 'percent_diff_abs']; export class ThresholdMapper { static alertToGraphThresholds(panel: PanelModel) { - if (!panel.alert || config.featureToggles.ngalert) { + if (!panel.alert || config.unifiedAlertingEnabled) { return false; // no update when no alerts } diff --git a/public/app/features/dashboard/components/DeleteDashboard/DeleteDashboardModal.tsx b/public/app/features/dashboard/components/DeleteDashboard/DeleteDashboardModal.tsx index 2b41ddb4291..97ea543fb3e 100644 --- a/public/app/features/dashboard/components/DeleteDashboard/DeleteDashboardModal.tsx +++ b/public/app/features/dashboard/components/DeleteDashboard/DeleteDashboardModal.tsx @@ -42,7 +42,7 @@ export const DeleteDashboardModal: React.FC = ({ hide const getModalBody = (panels: PanelModel[], title: string) => { const totalAlerts = sumBy(panels, (panel) => (panel.alert ? 1 : 0)); - return totalAlerts > 0 && !config.featureToggles.ngalert ? ( + return totalAlerts > 0 && !config.unifiedAlertingEnabled ? ( <>

Do you want to delete this dashboard?

diff --git a/public/app/features/dashboard/utils/panel.ts b/public/app/features/dashboard/utils/panel.ts index 4e4e8defb4d..8911ff69dae 100644 --- a/public/app/features/dashboard/utils/panel.ts +++ b/public/app/features/dashboard/utils/panel.ts @@ -26,7 +26,7 @@ export const removePanel = (dashboard: DashboardModel, panel: PanelModel, ask: b // confirm deletion if (ask !== false) { const text2 = - panel.alert && !config.featureToggles.ngalert + panel.alert && !config.unifiedAlertingEnabled ? 'Panel includes an alert rule. removing the panel will also remove the alert rule' : undefined; const confirmText = panel.alert ? 'YES' : undefined; diff --git a/public/app/features/query/state/DashboardQueryRunner/DashboardQueryRunner.ts b/public/app/features/query/state/DashboardQueryRunner/DashboardQueryRunner.ts index 8061be2dfee..cae76d671aa 100644 --- a/public/app/features/query/state/DashboardQueryRunner/DashboardQueryRunner.ts +++ b/public/app/features/query/state/DashboardQueryRunner/DashboardQueryRunner.ts @@ -31,7 +31,7 @@ class DashboardQueryRunnerImpl implements DashboardQueryRunner { private readonly dashboard: DashboardModel, private readonly timeSrv: TimeSrv = getTimeSrv(), private readonly workers: DashboardQueryRunnerWorker[] = [ - config.featureToggles.ngalert ? new UnifiedAlertStatesWorker() : new AlertStatesWorker(), + config.unifiedAlertingEnabled ? new UnifiedAlertStatesWorker() : new AlertStatesWorker(), new SnapshotWorker(), new AnnotationsWorker(), ] diff --git a/public/app/plugins/panel/graph/thresholds_form.ts b/public/app/plugins/panel/graph/thresholds_form.ts index 9fb20b9c735..7afb615eb17 100644 --- a/public/app/plugins/panel/graph/thresholds_form.ts +++ b/public/app/plugins/panel/graph/thresholds_form.ts @@ -12,7 +12,7 @@ export class ThresholdFormCtrl { $onInit() { this.panel = this.panelCtrl.panel; - if (this.panel.alert && !config.featureToggles.ngalert) { + if (this.panel.alert && !config.unifiedAlertingEnabled) { this.disabled = true; }