From 015ab370b09d8019ab2df115a53375b9bb47d82f Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Mon, 16 Sep 2019 20:59:22 -0700 Subject: [PATCH] Alerts: show a warning/error if transformations are configured (#19027) --- .../app/core/components/AlertBox/AlertBox.tsx | 6 ++++++ public/app/features/alerting/AlertTab.tsx | 20 ++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/public/app/core/components/AlertBox/AlertBox.tsx b/public/app/core/components/AlertBox/AlertBox.tsx index c9e19920fbb..852a1e51cfb 100644 --- a/public/app/core/components/AlertBox/AlertBox.tsx +++ b/public/app/core/components/AlertBox/AlertBox.tsx @@ -15,6 +15,12 @@ function getIconFromSeverity(severity: AppNotificationSeverity): string { case AppNotificationSeverity.Error: { return 'fa fa-exclamation-triangle'; } + case AppNotificationSeverity.Warning: { + return 'fa fa-exclamation-triangle'; + } + case AppNotificationSeverity.Info: { + return 'fa fa-info-circle'; + } case AppNotificationSeverity.Success: { return 'fa fa-check'; } diff --git a/public/app/features/alerting/AlertTab.tsx b/public/app/features/alerting/AlertTab.tsx index 43857304cbf..91fe65c0b9c 100644 --- a/public/app/features/alerting/AlertTab.tsx +++ b/public/app/features/alerting/AlertTab.tsx @@ -15,6 +15,8 @@ import 'app/features/alerting/AlertTabCtrl'; import { DashboardModel } from '../dashboard/state/DashboardModel'; import { PanelModel } from '../dashboard/state/PanelModel'; import { TestRuleResult } from './TestRuleResult'; +import { AlertBox } from 'app/core/components/AlertBox/AlertBox'; +import { AppNotificationSeverity } from 'app/types'; interface Props { angularPanel?: AngularComponent; @@ -127,7 +129,16 @@ export class AlertTab extends PureComponent { }; render() { - const { alert } = this.props.panel; + const { alert, transformations } = this.props.panel; + const hasTransformations = transformations && transformations.length; + + if (!alert && hasTransformations) { + return ( + + + + ); + } const toolbarItems = alert ? [this.stateHistory(), this.testRule(), this.deleteAlert()] : []; @@ -141,6 +152,13 @@ export class AlertTab extends PureComponent { return ( <> + {alert && hasTransformations && ( + + )} +
(this.element = element)} /> {!alert && }