Skip to content

Commit fe6cfb3

Browse files
committed
fix: добавлена поддержка типа select в PluginSettingsDialog
Поддержка типа select была добавлена только в PluginSettingsForm, но не в PluginSettingsDialog, что вызывало ошибку "Неизвестный тип настройки: select" при открытии настроек плагина через диалог.
1 parent 39aba61 commit fe6cfb3

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

frontend/src/components/PluginSettingsDialog.jsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,29 @@ function SettingField({ settingKey, config, value, onChange, readOnly }) {
201201
{config.description && <p className="text-sm text-muted-foreground">{config.description}</p>}
202202
</div>
203203
);
204+
case 'select':
205+
return (
206+
<div className="space-y-2">
207+
<Label htmlFor={id}>{config.label}</Label>
208+
<Select value={value || config.default || ''} onValueChange={readOnly ? undefined : ((newValue) => onChange(settingKey, newValue))} disabled={readOnly}>
209+
<SelectTrigger id={id}>
210+
<SelectValue placeholder="Выберите значение" />
211+
</SelectTrigger>
212+
<SelectContent>
213+
{(config.options || []).map((option) => {
214+
const optionValue = typeof option === 'string' ? option : option.value;
215+
const optionLabel = typeof option === 'string' ? option : option.label;
216+
return (
217+
<SelectItem key={optionValue} value={optionValue}>
218+
{optionLabel}
219+
</SelectItem>
220+
);
221+
})}
222+
</SelectContent>
223+
</Select>
224+
{config.description && <p className="text-sm text-muted-foreground">{config.description}</p>}
225+
</div>
226+
);
204227
case 'json_file':
205228
return (
206229
<div className="space-y-2">

0 commit comments

Comments
 (0)