mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-18 07:33:12 +09:00
Merge pull request #701 from Cooldude2606/feature/enum-config-input
This commit is contained in:
1 parent
45ae20051f
commit
583d484573
7 files changed
+21
-10
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import React, { useContext, useEffect, useState } from "react";
|
||||
import {
|
||||
Button, Card, Checkbox, Form, FormInstance, Input, InputNumber, Space, Spin, Tooltip, Tree, Typography,
|
||||
Button, Card, Checkbox, Form, FormInstance, Input, InputNumber, Select, Space, Spin, Tooltip, Tree, Typography,
|
||||
} from "antd";
|
||||
import ReloadOutlined from "@ant-design/icons/ReloadOutlined";
|
||||
|
||||
@@ -46,6 +46,15 @@ function renderInput(inputComponents: Record<string, InputComponent>, def: lib.F
|
||||
if (def.credential) {
|
||||
return <Input.Password autoComplete={def.autoComplete ?? "new-password"} disabled={readonly} />;
|
||||
}
|
||||
if (def.enum) {
|
||||
return <Select
|
||||
showSearch
|
||||
style={{ minWidth: 175 }}
|
||||
options={def.enum.map(value => ({ label: value, value: value }))}
|
||||
allowClear={def.optional}
|
||||
disabled={readonly}
|
||||
/>;
|
||||
}
|
||||
return <Input autoComplete={def.autoComplete} disabled={readonly} />;
|
||||
}
|
||||
if (def.type === "number") {
|
||||
|
||||
Reference in new issue
Block a user