diff --git a/cyclops-ui/src/components/pages/EditModule.tsx b/cyclops-ui/src/components/pages/EditModule/EditModule.tsx
similarity index 81%
rename from cyclops-ui/src/components/pages/EditModule.tsx
rename to cyclops-ui/src/components/pages/EditModule/EditModule.tsx
index 289fa041..4412e345 100644
--- a/cyclops-ui/src/components/pages/EditModule.tsx
+++ b/cyclops-ui/src/components/pages/EditModule/EditModule.tsx
@@ -37,21 +37,25 @@ import "ace-builds/src-noconflict/mode-toml";
import "ace-builds/src-noconflict/mode-javascript";
import "ace-builds/src-noconflict/mode-typescript";
import "ace-builds/src-noconflict/snippets/yaml";
-import { fileExtension, findMaps, flattenObjectKeys } from "../../utils/form";
+import {
+ fileExtension,
+ findMaps,
+ flattenObjectKeys,
+} from "../../../utils/form";
import "./custom.css";
-import { numberInputValidators } from "../../utils/validators/number";
-import { stringInputValidators } from "../../utils/validators/string";
-import { templateRef } from "../../utils/templateRef";
+import { numberInputValidators } from "../../../utils/validators/number";
+import { stringInputValidators } from "../../../utils/validators/string";
+import { templateRef } from "../../../utils/templateRef";
import {
FeedbackError,
FormValidationErrors,
-} from "../errors/FormValidationErrors";
-import { mapResponseError } from "../../utils/api/errors";
+} from "../../errors/FormValidationErrors";
+import { mapResponseError } from "../../../utils/api/errors";
import {
getTemplate,
getTemplateInitialValues,
Template,
-} from "../../utils/api/template";
+} from "../../../utils/api/template";
const { Title } = Typography;
const layout = {
@@ -427,6 +431,10 @@ const EditModule = () => {
{...arrayField}
name={formItemName}
rules={[{ required: isRequired }]}
+ style={{
+ paddingTop: "8px",
+ marginBottom: "12px",
+ }}
label={
{field.display_name}
@@ -459,6 +467,10 @@ const EditModule = () => {
{field.display_name}
@@ -494,49 +506,168 @@ const EditModule = () => {
};
const arrayInnerField = (
+ fieldName: string,
+ uniqueFieldName: string[],
+ formItemName: any,
field: any,
- parentFieldID: string[],
- parent: string,
level: number,
- arrayField: any,
- remove: Function,
+ header: React.JSX.Element,
) => {
- if (!field.items || typeof field.items === "string") {
+ if (!field.items || field.items.type === "string") {
return (
-
-
-
-
- remove(arrayField.name)}
- />
-
+
+ {field.display_name}
+
+ {field.description}
+
+
+ }
+ >
+
+ {(arrFields, { add, remove }) => (
+
+ {arrFields.map((arrField, index) => (
+
+
+
+
+
+ remove(arrField.name)}
+ />
+
+ {arrFields !== null &&
+ arrFields !== undefined &&
+ index + 1 === arrFields.length ? (
+
+ ) : (
+ <>>
+ )}
+
+ ))}
+
+
+
+
+ )}
+
+
);
}
- if (field.items === "object") {
+ if (field.items.type === "object") {
return (
-
- {mapFields(
- field.items.properties,
- parentFieldID,
- "",
- level + 1,
- 2,
- arrayField,
- field.items.required,
- )}
- remove(arrayField.name)}
- />
-
+
+
+
+
+ {(arrFields, { add, remove }) => (
+ <>
+ {arrFields.map((arrField) => (
+
+
+ {mapFields(
+ field.items.properties,
+ [...uniqueFieldName, String(arrField.name)],
+ "",
+ level + 1,
+ 2,
+ arrField,
+ field.items.required,
+ )}
+ remove(arrField.name)}
+ />
+
+
+ ))}
+
+
+
+ >
+ )}
+
+
+
+
);
}
};
@@ -617,6 +748,10 @@ const EditModule = () => {
{field.display_name}
@@ -641,6 +776,10 @@ const EditModule = () => {
{...arrayField}
initialValue={field.initialValue}
name={formItemName}
+ style={{
+ paddingTop: "8px",
+ marginBottom: "12px",
+ }}
label={
{field.display_name}
@@ -679,6 +818,10 @@ const EditModule = () => {
initialValue={field.initialValue}
name={fieldName}
id={fieldName}
+ style={{
+ paddingTop: "8px",
+ marginBottom: "12px",
+ }}
label={
{field.display_name}
@@ -727,7 +870,8 @@ const EditModule = () => {
span={level === 0 ? 16 : 24}
offset={level === 0 ? 2 : 0}
style={{
- paddingBottom: "15px",
+ paddingTop: "8px",
+ paddingBottom: "8px",
paddingLeft: "0px",
paddingRight: "0px",
marginLeft: "0px",
@@ -736,6 +880,7 @@ const EditModule = () => {
>
{
span={level === 0 ? 16 : 24}
offset={level === 0 ? 2 : 0}
style={{
- paddingBottom: "15px",
- marginLeft: "0px",
- marginRight: "0px",
+ paddingTop: "8px",
+ paddingBottom: "8px",
paddingLeft: "0px",
paddingRight: "0px",
+ marginLeft: "0px",
+ marginRight: "0px",
}}
>
-
-
-
- {(arrFields, { add, remove }) => (
- <>
- {arrFields.map((arrField) => (
-
- {arrayInnerField(
- field,
- [...uniqueFieldName, String(arrField.name)],
- "",
- level + 1,
- arrField,
- remove,
- )}
-
-
- ))}
-
-
-
-
- >
- )}
-
-
-
+ {arrayInnerField(
+ fieldName,
+ uniqueFieldName,
+ formItemName,
+ field,
+ level + 1,
+ header,
+ )}
,
);
return;
@@ -881,6 +982,10 @@ const EditModule = () => {
wrapperCol={{ span: level === 0 ? 16 : 24 }}
name={fieldName}
rules={[{ required: isRequired }]}
+ style={{
+ paddingTop: "8px",
+ marginBottom: "12px",
+ }}
label={
{field.display_name}
@@ -947,9 +1052,7 @@ const EditModule = () => {
))}
-
+
-
{
{...arrayField}
name={formItemName}
rules={[{ required: isRequired }]}
+ style={{
+ paddingTop: "8px",
+ marginBottom: "12px",
+ }}
label={
{field.display_name}
@@ -441,6 +450,10 @@ const NewModule = () => {
{field.display_name}
@@ -476,49 +489,168 @@ const NewModule = () => {
};
const arrayInnerField = (
+ fieldName: string,
+ uniqueFieldName: string[],
+ formItemName: any,
field: any,
- parentFieldID: string[],
- parent: string,
level: number,
- arrayField: any,
- remove: Function,
+ header: React.JSX.Element,
) => {
- if (!field.items || typeof field.items === "string") {
+ if (!field.items || field.items.type === "string") {
return (
-
-
-
-
- remove(arrayField.name)}
- />
-
+
+ {field.display_name}
+
+ {field.description}
+
+
+ }
+ >
+
+ {(arrFields, { add, remove }) => (
+
+ {arrFields.map((arrField, index) => (
+
+
+
+
+
+ remove(arrField.name)}
+ />
+
+ {arrFields !== null &&
+ arrFields !== undefined &&
+ index + 1 === arrFields.length ? (
+
+ ) : (
+ <>>
+ )}
+
+ ))}
+
+
+
+
+ )}
+
+
);
}
- if (field.items === "object") {
+ if (field.items.type === "object") {
return (
-
- {mapFields(
- field.items.properties,
- parentFieldID,
- "",
- level + 1,
- 2,
- arrayField,
- field.items.required,
- )}
- remove(arrayField.name)}
- />
-
+
+
+
+
+ {(arrFields, { add, remove }) => (
+ <>
+ {arrFields.map((arrField) => (
+
+
+ {mapFields(
+ field.items.properties,
+ [...uniqueFieldName, String(arrField.name)],
+ "",
+ level + 1,
+ 2,
+ arrField,
+ field.items.required,
+ )}
+ remove(arrField.name)}
+ />
+
+
+ ))}
+
+
+
+ >
+ )}
+
+
+
+
);
}
};
@@ -604,6 +736,10 @@ const NewModule = () => {
{field.display_name}
@@ -628,6 +764,10 @@ const NewModule = () => {
{...arrayField}
initialValue={field.initialValue}
name={formItemName}
+ style={{
+ paddingTop: "8px",
+ marginBottom: "12px",
+ }}
label={
{field.display_name}
@@ -665,6 +805,10 @@ const NewModule = () => {
name={fieldName}
id={fieldName}
valuePropName={checked}
+ style={{
+ paddingTop: "8px",
+ marginBottom: "12px",
+ }}
label={
{field.display_name}
@@ -712,7 +856,8 @@ const NewModule = () => {
span={level === 0 ? 16 : 24}
offset={level === 0 ? 2 : 0}
style={{
- paddingBottom: "15px",
+ paddingTop: "8px",
+ paddingBottom: "8px",
marginLeft: "0px",
marginRight: "0px",
paddingLeft: "0px",
@@ -721,6 +866,7 @@ const NewModule = () => {
>
{
span={level === 0 ? 16 : 24}
offset={level === 0 ? 2 : 0}
style={{
- paddingBottom: "15px",
- marginLeft: "0px",
- marginRight: "0px",
+ paddingTop: "8px",
+ paddingBottom: "8px",
paddingLeft: "0px",
paddingRight: "0px",
+ marginLeft: "0px",
+ marginRight: "0px",
}}
>
-
-
-
- {(arrFields, { add, remove }) => (
- <>
- {arrFields.map((arrField) => (
-
- {arrayInnerField(
- field,
- [...uniqueFieldName, String(arrField.name)],
- "",
- level + 1,
- arrField,
- remove,
- )}
-
-
- ))}
-
-
-
-
- >
- )}
-
-
-
+ {arrayInnerField(
+ fieldName,
+ uniqueFieldName,
+ formItemName,
+ field,
+ level + 1,
+ header,
+ )}
,
);
return;
@@ -863,6 +965,10 @@ const NewModule = () => {
wrapperCol={{ span: level === 0 ? 16 : 24 }}
name={fieldName}
rules={[{ required: isRequired }]}
+ style={{
+ paddingTop: "8px",
+ marginBottom: "12px",
+ }}
label={
{field.display_name}
@@ -929,9 +1035,7 @@ const NewModule = () => {
))}
-
+