mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
Alerting: Skip loading alert rules for dashboards when disabled (#89361)
This commit is contained in:
parent
64e134c601
commit
781e394118
@ -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 }) => (
|
||||
<React.Suspense fallback={null} key="alert-rules-button">
|
||||
{dashboard && <AlertRulesToolbarButton dashboardUid={dashboard.uid} />}
|
||||
</React.Suspense>
|
||||
),
|
||||
show: () => alertingEnabled,
|
||||
component: ({ dashboard }) =>
|
||||
alertingEnabled ? (
|
||||
<React.Suspense fallback={null} key="alert-rules-button">
|
||||
{dashboard && <AlertRulesToolbarButton dashboardUid={dashboard.uid} />}
|
||||
</React.Suspense>
|
||||
) : null,
|
||||
index: -2,
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user