mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
fix: don't allow editing rule types for existing rules (#47512)
This commit is contained in:
parent
b31c7d3654
commit
c530100d45
@ -38,27 +38,24 @@ export const AlertTypeStep: FC<Props> = ({ editingExistingRule }) => {
|
||||
|
||||
return (
|
||||
<RuleEditorSection stepNo={1} title="Rule type">
|
||||
<Field
|
||||
disabled={editingExistingRule}
|
||||
error={errors.type?.message}
|
||||
invalid={!!errors.type?.message}
|
||||
data-testid="alert-type-picker"
|
||||
>
|
||||
<InputControl
|
||||
render={({ field: { onChange } }) => (
|
||||
<RuleTypePicker
|
||||
aria-label="Rule type"
|
||||
selected={getValues('type') ?? RuleFormType.grafana}
|
||||
onChange={onChange}
|
||||
/>
|
||||
)}
|
||||
name="type"
|
||||
control={control}
|
||||
rules={{
|
||||
required: { value: true, message: 'Please select alert type' },
|
||||
}}
|
||||
/>
|
||||
</Field>
|
||||
{!editingExistingRule && (
|
||||
<Field error={errors.type?.message} invalid={!!errors.type?.message} data-testid="alert-type-picker">
|
||||
<InputControl
|
||||
render={({ field: { onChange } }) => (
|
||||
<RuleTypePicker
|
||||
aria-label="Rule type"
|
||||
selected={getValues('type') ?? RuleFormType.grafana}
|
||||
onChange={onChange}
|
||||
/>
|
||||
)}
|
||||
name="type"
|
||||
control={control}
|
||||
rules={{
|
||||
required: { value: true, message: 'Please select alert type' },
|
||||
}}
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
|
||||
<Field
|
||||
className={styles.formInput}
|
||||
|
Loading…
Reference in New Issue
Block a user