diff --git a/services/frontend/src/components/Modal/Network/General.tsx b/services/frontend/src/components/Modal/Network/General.tsx index 00639c8..7d006fd 100644 --- a/services/frontend/src/components/Modal/Network/General.tsx +++ b/services/frontend/src/components/Modal/Network/General.tsx @@ -1,32 +1,11 @@ -const General = (props: any) => { - const { formik } = props; +import TextField from "../../global/FormElements/InputField"; +const General = () => { return ( <> -
-
-
- -
- -
-
-
-
+ ); }; + export default General; diff --git a/services/frontend/src/components/Modal/Network/IPam.tsx b/services/frontend/src/components/Modal/Network/IPam.tsx index 05b471f..2ea3f71 100644 --- a/services/frontend/src/components/Modal/Network/IPam.tsx +++ b/services/frontend/src/components/Modal/Network/IPam.tsx @@ -1,6 +1,5 @@ -const IPam = (props: any) => { - const { formik } = props; - +const IPam = () => { return <>; }; + export default IPam; diff --git a/services/frontend/src/components/Modal/Network/Labels.tsx b/services/frontend/src/components/Modal/Network/Labels.tsx index 9838a34..12d9e27 100644 --- a/services/frontend/src/components/Modal/Network/Labels.tsx +++ b/services/frontend/src/components/Modal/Network/Labels.tsx @@ -1,6 +1,5 @@ -const Labels = (props: any) => { - const { formik } = props; - +const Labels = () => { return <>; }; + export default Labels; diff --git a/services/frontend/src/components/Modal/Network/index.tsx b/services/frontend/src/components/Modal/Network/index.tsx index c65ccf4..7aa3694 100644 --- a/services/frontend/src/components/Modal/Network/index.tsx +++ b/services/frontend/src/components/Modal/Network/index.tsx @@ -1,5 +1,6 @@ import { useState } from "react"; -import { useFormik } from "formik"; +import { Formik } from "formik"; +import * as yup from "yup"; import { XIcon } from "@heroicons/react/outline"; import General from "./General"; import IPam from "./IPam"; @@ -14,12 +15,14 @@ interface IModalNetworkProps { const ModalNetwork = (props: IModalNetworkProps) => { const { onHide } = props; const [openTab, setOpenTab] = useState("General"); - - const formik = useFormik({ - initialValues: { - ...topLevelNetworkConfigInitialValues() - }, - onSubmit: () => undefined + const handleCreate = (values: any, formik: any) => { + formik.resetForm(); + }; + const validationSchema = yup.object({ + name: yup + .string() + .max(256, "name should be 256 characters or less") + .required("name is required") }); const tabs = [ { @@ -66,54 +69,72 @@ const ModalNetwork = (props: IModalNetworkProps) => { -
-
-
- -
-
+ { + handleCreate(values, formik); + }} + validationSchema={validationSchema} + > + {(formik) => ( + <> +
+
+ +
+
-
-
- {openTab === "General" && } - {openTab === "IPam" && } - {openTab === "Labels" && } - -
-
+
+ {openTab === "General" && } + {openTab === "IPam" && } + {openTab === "Labels" && } +
-
- -
+
+ +
+ + )} +