[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 781e394118)
Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
This commit is contained in:
co-authored by
Gilles De Mey
parent
fbcdaccb6d
commit
244d0cf46a
@@ -14,15 +14,17 @@ const AlertRulesToolbarButton = React.lazy(
|
|||||||
|
|
||||||
export function initAlerting() {
|
export function initAlerting() {
|
||||||
const grafanaRulesPermissions = getRulesPermissions(GRAFANA_RULES_SOURCE_NAME);
|
const grafanaRulesPermissions = getRulesPermissions(GRAFANA_RULES_SOURCE_NAME);
|
||||||
|
const alertingEnabled = config.unifiedAlertingEnabled;
|
||||||
|
|
||||||
if (contextSrv.hasPermission(grafanaRulesPermissions.read)) {
|
if (contextSrv.hasPermission(grafanaRulesPermissions.read)) {
|
||||||
addCustomRightAction({
|
addCustomRightAction({
|
||||||
show: () => config.unifiedAlertingEnabled,
|
show: () => alertingEnabled,
|
||||||
component: ({ dashboard }) => (
|
component: ({ dashboard }) =>
|
||||||
<React.Suspense fallback={null} key="alert-rules-button">
|
alertingEnabled ? (
|
||||||
{dashboard && <AlertRulesToolbarButton dashboardUid={dashboard.uid} />}
|
<React.Suspense fallback={null} key="alert-rules-button">
|
||||||
</React.Suspense>
|
{dashboard && <AlertRulesToolbarButton dashboardUid={dashboard.uid} />}
|
||||||
),
|
</React.Suspense>
|
||||||
|
) : null,
|
||||||
index: -2,
|
index: -2,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user