Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion cyclops-ui/src/components/form/fields/map/MapField.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import { Button, Col, Divider, Form, Input, Row } from "antd";
import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
import TextArea from "antd/es/input/TextArea";

interface Props {
field: any;
Expand Down Expand Up @@ -72,7 +73,7 @@ export const MapField = ({
rules={[{ required: true, message: "Missing value" }]}
style={{ margin: 0, flex: 1, marginRight: "12px" }}
>
<Input style={{ margin: 0 }} />
<TextArea style={{ margin: 0 }} rows={1} />
</Form.Item>
</Col>
<MinusCircleOutlined onClick={() => remove(arrField.name)} />
Expand Down
9 changes: 9 additions & 0 deletions cyclops-ui/src/components/pages/EditModule/EditModule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
Template,
} from "../../../utils/api/template";
import TemplateFormFields from "../../form/TemplateFormFields";
import YAML from "yaml";

const { Title } = Typography;
const layout = {
Expand Down Expand Up @@ -166,6 +167,14 @@ const EditModule = () => {
}

Object.keys(values[field.name]).forEach((key) => {
if (typeof values[field.name][key] === "object") {
object.push({
key: key,
value: YAML.stringify(values[field.name][key], null, 4),
});
return;
}

object.push({
key: key,
value: values[field.name][key],
Expand Down
8 changes: 8 additions & 0 deletions cyclops-ui/src/components/pages/NewModule/NewModule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,14 @@ const NewModule = () => {
}

Object.keys(values[field.name]).forEach((key) => {
if (typeof values[field.name][key] === "object") {
object.push({
key: key,
value: YAML.stringify(values[field.name][key], null, 4),
});
return;
}

object.push({
key: key,
value: values[field.name][key],
Expand Down
4 changes: 3 additions & 1 deletion cyclops-ui/src/utils/form.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import YAML from "yaml";

export function fileExtension(fileExt: string): string {
switch (fileExt) {
case "json":
Expand Down Expand Up @@ -104,7 +106,7 @@ export function findMaps(fields: any[], values: any, initialValues: any): any {

let object: any = {};
valuesList.forEach((valueFromList) => {
object[valueFromList.key] = valueFromList.value;
object[valueFromList.key] = YAML.parse(valueFromList.value);
});
out[field.name] = object;
break;
Expand Down
Loading