2024-01-29 16:09:10 +01:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
|
|
import { LoadingPlaceholder } from '@grafana/ui';
|
|
|
|
|
|
|
|
|
|
import { RulesTable } from '../components/rules/RulesTable';
|
2024-05-10 12:27:06 +02:00
|
|
|
import { useCombinedRules } from '../hooks/useCombinedRuleNamespaces';
|
2024-01-29 16:09:10 +01:00
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
dashboardUid: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default function AlertRulesDrawerContent({ dashboardUid }: Props) {
|
2024-05-10 12:27:06 +02:00
|
|
|
const { loading, result: grafanaNamespaces } = useCombinedRules(dashboardUid);
|
|
|
|
|
const rules = grafanaNamespaces ? grafanaNamespaces.flatMap((ns) => ns.groups).flatMap((g) => g.rules) : [];
|
2024-02-16 14:47:03 +01:00
|
|
|
|
2024-01-29 16:09:10 +01:00
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
{loading ? (
|
|
|
|
|
<LoadingPlaceholder text="Loading alert rules" />
|
|
|
|
|
) : (
|
2024-03-14 15:36:35 +01:00
|
|
|
<RulesTable rules={rules} showNextEvaluationColumn={false} showGroupColumn={false} />
|
2024-01-29 16:09:10 +01:00
|
|
|
)}
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|