import React from 'react';
import { useFormContext } from 'react-hook-form';
import { RuleFormType, RuleFormValues } from '../../types/rule-form';
import AnnotationsField from './AnnotationsField';
import { GroupAndNamespaceFields } from './GroupAndNamespaceFields';
import { RuleEditorSection } from './RuleEditorSection';
function getDescription(ruleType: RuleFormType | undefined) {
if (ruleType === RuleFormType.cloudRecording) {
return 'Select the Namespace and Group for your recording rule.';
}
const docsLink =
'https://grafana.com/docs/grafana/latest/alerting/fundamentals/annotation-label/variables-label-annotation';
const LinkToDocs = () => (
Click{' '}
here{' '}
for documentation on how to template annotations and labels.
);
if (ruleType === RuleFormType.grafana) {
return (
{' '}
Write a summary to help you better manage your alerts.
);
}
if (ruleType === RuleFormType.cloudAlerting) {
return (
{' '}
Select the Namespace and evaluation group for your alert. Write a summary to help you better manage your alerts.{' '}
);
}
return '';
}
export function DetailsStep() {
const { watch } = useFormContext();
const ruleFormType = watch('type');
const dataSourceName = watch('dataSourceName');
const type = watch('type');
return (
{(ruleFormType === RuleFormType.cloudRecording || ruleFormType === RuleFormType.cloudAlerting) &&
dataSourceName && }
{type !== RuleFormType.cloudRecording && }
);
}