Alerting: Disable Alertmanager picker if there's only one Alertmanager (#45781)

This commit is contained in:
Peter Holmberg
2022-02-25 11:17:28 +01:00
committed by GitHub
parent 2ca79ca0c7
commit 9d61dcb02b
@@ -33,16 +33,11 @@ export const AlertManagerPicker: FC<Props> = ({ onChange, current, disabled = fa
];
}, []);
// no need to show the picker if there's only one option
if (options.length === 1) {
return null;
}
return (
<Field
className={styles.field}
label={disabled ? 'Alertmanager' : 'Choose Alertmanager'}
disabled={disabled}
disabled={disabled || options.length === 1}
data-testid="alertmanager-picker"
>
<Select