Alerting UI: Update help button and descriptions for recording rules (#96047)

* Hide `Instances` field in RuleDetails view for recording rules

* Alerting UI: add `helpLink` to Recording Rules docs

* Make the Metric input placeholder more explicit for recording rules
This commit is contained in:
Pepe Cano
2024-11-11 11:59:53 +01:00
committed by GitHub
parent 154a2e0d06
commit 7112a79b35
3 changed files with 13 additions and 7 deletions
@@ -72,7 +72,7 @@ export const AlertRuleNameAndMetric = () => {
pattern: recordingRuleNameValidationPattern(RuleFormType.grafanaRecording),
})}
aria-label="metric"
placeholder={`Give your metric a name`}
placeholder={`Give the name of the new recorded metric`}
/>
</Field>
)}
@@ -13,14 +13,14 @@ export const DESCRIPTIONS: Record<RuleFormType, FormDescriptions> = {
helpLabel: 'Define your recording rule',
helpContent:
'Pre-compute frequently needed or computationally expensive expressions and save their result as a new set of time series.',
helpLink: '',
helpLink: 'https://grafana.com/docs/grafana/latest/alerting/alerting-rules/create-recording-rules/',
},
[RuleFormType.grafanaRecording]: {
sectionTitle: 'Define recording rule',
helpLabel: 'Define your recording rule',
helpContent:
'Pre-compute frequently needed or computationally expensive expressions and save their result as a new set of time series.',
helpLink: '',
helpLink: 'https://grafana.com/docs/grafana/latest/alerting/alerting-rules/create-recording-rules/',
},
[RuleFormType.grafana]: {
sectionTitle: 'Define query and alert condition',
@@ -7,7 +7,7 @@ import { CombinedRule } from 'app/types/unified-alerting';
import { usePendingPeriod } from '../../hooks/rules/usePendingPeriod';
import { useCleanAnnotations } from '../../utils/annotations';
import { isGrafanaRecordingRule } from '../../utils/rules';
import { isGrafanaRecordingRule, isRecordingRule, isRecordingRulerRule } from '../../utils/rules';
import { isNullDate } from '../../utils/time';
import { AlertLabels } from '../AlertLabels';
import { DetailsField } from '../DetailsField';
@@ -53,9 +53,15 @@ export const RuleDetails = ({ rule }: Props) => {
<RuleDetailsDataSources rulesSource={rulesSource} rule={rule} />
</div>
</div>
<DetailsField label="Instances" horizontal={true}>
<RuleDetailsMatchingInstances rule={rule} itemsDisplayLimit={INSTANCES_DISPLAY_LIMIT} />
</DetailsField>
{!(
isRecordingRulerRule(rule.rulerRule) ||
isRecordingRule(rule.promRule) ||
isGrafanaRecordingRule(rule.rulerRule)
) && (
<DetailsField label="Instances" horizontal={true}>
<RuleDetailsMatchingInstances rule={rule} itemsDisplayLimit={INSTANCES_DISPLAY_LIMIT} />
</DetailsField>
)}
</div>
);
};