|
|
|
@ -45,6 +45,7 @@ export const RoutingSettings = ({ alertManager }: RoutingSettingsProps) => { |
|
|
|
|
const overrideGrouping = watch(`contactPoints.${alertManager}.overrideGrouping`); |
|
|
|
|
const overrideTimings = watch(`contactPoints.${alertManager}.overrideTimings`); |
|
|
|
|
const requiredFieldsInGroupBy = ['grafana_folder', 'alertname']; |
|
|
|
|
const disableGrouping = '...'; |
|
|
|
|
const styles = useStyles2(getStyles); |
|
|
|
|
return ( |
|
|
|
|
<Stack direction="column"> |
|
|
|
@ -72,6 +73,10 @@ export const RoutingSettings = ({ alertManager }: RoutingSettingsProps) => { |
|
|
|
|
if (!value || value.length === 0) { |
|
|
|
|
return 'At least one group by option is required.'; |
|
|
|
|
} |
|
|
|
|
// if value includes only the allowedSingleFieldInGroupBy, it is valid
|
|
|
|
|
if (value.length === 1 && value[0] === disableGrouping) { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
// we need to make sure that the required fields are included
|
|
|
|
|
const requiredFieldsIncluded = requiredFieldsInGroupBy.every((field) => value.includes(field)); |
|
|
|
|
if (!requiredFieldsIncluded) { |
|
|
|
|