Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/#148array validation expanded #630

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 40 additions & 15 deletions cyclops-ui/src/components/form/fields/array/ArrayField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {
Input,
Row,
Tooltip,
Checkbox,
InputNumber,
} from "antd";
import {
InfoCircleOutlined,
Expand Down Expand Up @@ -117,15 +119,9 @@ export const ArrayField = ({
onClick={() => remove(arrField.name)}
/>
</Row>
{arrFields !== null &&
arrFields !== undefined &&
index + 1 === arrFields.length ? (
<Divider
style={{ marginTop: "4px", marginBottom: "12px" }}
/>
) : (
<></>
)}
{index + 1 === arrFields.length ? (
<Divider style={{ marginTop: "4px", marginBottom: "12px" }} />
) : null}
</Col>
))}
<Form.Item style={{ marginBottom: "0" }}>
Expand All @@ -144,6 +140,35 @@ export const ArrayField = ({
</Form.Item>
);
}

if (field.items.type === "number") {
return (
<Form.Item
wrapperCol={{ span: 16 }}
name={fieldName}
label={field.display_name}
style={{ marginBottom: "12px" }}
>
<InputNumber disabled={field.immutable && isModuleEdit} />
</Form.Item>
);
}

if (field.items.type === "boolean") {
Ujj1225 marked this conversation as resolved.
Show resolved Hide resolved
return (
<Form.Item
wrapperCol={{ span: 16 }}
name={fieldName}
valuePropName="checked"
style={{ marginBottom: "12px" }}
>
<Checkbox disabled={field.immutable && isModuleEdit}>
{field.display_name}
</Checkbox>
</Form.Item>
);
}

if (field.items.type === "object") {
return (
<Collapse
Expand All @@ -162,11 +187,11 @@ export const ArrayField = ({
}}
forceRender={true}
>
<Form.Item
wrapperCol={{ span: 16 }}
style={{
paddingTop: "8px",
marginBottom: "0",
<Form.Item
wrapperCol={{ span: 16 }}
style={{
paddingTop: "8px",
marginBottom: "0",
}}
>
<Form.List name={formItemName}>
Expand Down Expand Up @@ -248,4 +273,4 @@ export const ArrayField = ({
)}
</Col>
);
};
};