fix unified alerting enabled checks (#40693)

This commit is contained in:
Domas 2021-10-20 15:45:26 +03:00 committed by GitHub
parent 6dbb6408d4
commit 51a152456f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 5 deletions

View File

@ -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
}

View File

@ -42,7 +42,7 @@ export const DeleteDashboardModal: React.FC<DeleteDashboardModalProps> = ({ 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 ? (
<>
<p>Do you want to delete this dashboard?</p>
<p>

View File

@ -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;

View File

@ -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(),
]

View File

@ -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;
}