From 244d0cf46ab0ca7d2eec4d89e6bb8ee45f685dae Mon Sep 17 00:00:00 2001 From: "grafana-delivery-bot[bot]" <132647405+grafana-delivery-bot[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 13:36:39 +0300 Subject: [PATCH] [v11.1.x] Alerting: Skip loading alert rules for dashboards when disabled (#89905) Alerting: Skip loading alert rules for dashboards when disabled (#89361) (cherry picked from commit 781e39411830baddf591e015d4b83dcf0c19cb54) Co-authored-by: Gilles De Mey --- .../app/features/alerting/unified/initAlerting.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/public/app/features/alerting/unified/initAlerting.tsx b/public/app/features/alerting/unified/initAlerting.tsx index b00d24d6457..92e593e4361 100644 --- a/public/app/features/alerting/unified/initAlerting.tsx +++ b/public/app/features/alerting/unified/initAlerting.tsx @@ -14,15 +14,17 @@ const AlertRulesToolbarButton = React.lazy( export function initAlerting() { const grafanaRulesPermissions = getRulesPermissions(GRAFANA_RULES_SOURCE_NAME); + const alertingEnabled = config.unifiedAlertingEnabled; if (contextSrv.hasPermission(grafanaRulesPermissions.read)) { addCustomRightAction({ - show: () => config.unifiedAlertingEnabled, - component: ({ dashboard }) => ( - - {dashboard && } - - ), + show: () => alertingEnabled, + component: ({ dashboard }) => + alertingEnabled ? ( + + {dashboard && } + + ) : null, index: -2, }); }