Skip to content

Commit e713fe6

Browse files
committed
feat(ui): Disable advisor option inputs for fixed values
If a plugin config template sets an option to a fixed value, disable the form input. Also show an explanatory text. Signed-off-by: Martin Nonnenmacher <[email protected]>
1 parent 81a8e14 commit e713fe6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ui/src/components/form/plugin-multi-select-field.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ export const PluginMultiSelectField = <
167167
<Checkbox
168168
checked={field.value as CheckedState}
169169
onCheckedChange={field.onChange}
170+
disabled={option.isFixed}
170171
/>
171172
) : option.isRequired ? (
172173
<Input
@@ -178,6 +179,7 @@ export const PluginMultiSelectField = <
178179
: 'text'
179180
}
180181
value={field.value}
182+
disabled={option.isFixed}
181183
/>
182184
) : (
183185
<OptionalInput
@@ -189,9 +191,16 @@ export const PluginMultiSelectField = <
189191
: 'text'
190192
}
191193
value={field.value}
194+
disabled={option.isFixed}
192195
/>
193196
)}
194197
</FormControl>
198+
{option.isFixed && (
199+
<FormDescription className='text-muted-foreground font-semibold text-yellow-700'>
200+
This option is set by an administrator and cannot
201+
be changed.
202+
</FormDescription>
203+
)}
195204
</FormItem>
196205
)}
197206
/>

0 commit comments

Comments
 (0)