|
|
|
@ -7,8 +7,8 @@ import Volumes from "./Volumes";
|
|
|
|
import Labels from "./Labels";
|
|
|
|
import Labels from "./Labels";
|
|
|
|
import { CallbackFunction } from "../../../types";
|
|
|
|
import { CallbackFunction } from "../../../types";
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
getInitialValues,
|
|
|
|
|
|
|
|
getFinalValues,
|
|
|
|
getFinalValues,
|
|
|
|
|
|
|
|
getInitialValues,
|
|
|
|
validationSchema
|
|
|
|
validationSchema
|
|
|
|
} from "./form-utils";
|
|
|
|
} from "./form-utils";
|
|
|
|
|
|
|
|
|
|
|
|
@ -48,9 +48,9 @@ const ModalServiceCreate = (props: IModalServiceProps) => {
|
|
|
|
const { onHide, onAddEndpoint } = props;
|
|
|
|
const { onHide, onAddEndpoint } = props;
|
|
|
|
const [openTab, setOpenTab] = useState("General");
|
|
|
|
const [openTab, setOpenTab] = useState("General");
|
|
|
|
const handleCreate = (values: any, formik: any) => {
|
|
|
|
const handleCreate = (values: any, formik: any) => {
|
|
|
|
// TODO: This modal should not be aware of endpoints. Seperation of concerns.
|
|
|
|
|
|
|
|
onAddEndpoint(getFinalValues(values));
|
|
|
|
onAddEndpoint(getFinalValues(values));
|
|
|
|
formik.resetForm();
|
|
|
|
formik.resetForm();
|
|
|
|
|
|
|
|
onHide();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const initialValues = useMemo(() => getInitialValues(), []);
|
|
|
|
const initialValues = useMemo(() => getInitialValues(), []);
|
|
|
|
@ -83,9 +83,7 @@ const ModalServiceCreate = (props: IModalServiceProps) => {
|
|
|
|
<Formik
|
|
|
|
<Formik
|
|
|
|
initialValues={initialValues}
|
|
|
|
initialValues={initialValues}
|
|
|
|
enableReinitialize={true}
|
|
|
|
enableReinitialize={true}
|
|
|
|
onSubmit={(values, formik) => {
|
|
|
|
onSubmit={handleCreate}
|
|
|
|
handleCreate(values, formik);
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
validationSchema={validationSchema}
|
|
|
|
validationSchema={validationSchema}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{(formik) => (
|
|
|
|
{(formik) => (
|
|
|
|
|