|
|
|
@ -2,7 +2,11 @@ import { useEffect, useMemo, useState } from "react";
|
|
|
|
import { Formik } from "formik";
|
|
|
|
import { Formik } from "formik";
|
|
|
|
import { XIcon } from "@heroicons/react/outline";
|
|
|
|
import { XIcon } from "@heroicons/react/outline";
|
|
|
|
import General from "./General";
|
|
|
|
import General from "./General";
|
|
|
|
import type { CallbackFunction, IVolumeNodeItem } from "../../../types";
|
|
|
|
import type {
|
|
|
|
|
|
|
|
CallbackFunction,
|
|
|
|
|
|
|
|
IEditVolumeForm,
|
|
|
|
|
|
|
|
IVolumeNodeItem
|
|
|
|
|
|
|
|
} from "../../../types";
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
getFinalValues,
|
|
|
|
getFinalValues,
|
|
|
|
getInitialValues,
|
|
|
|
getInitialValues,
|
|
|
|
@ -10,6 +14,8 @@ import {
|
|
|
|
validationSchema
|
|
|
|
validationSchema
|
|
|
|
} from "./form-utils";
|
|
|
|
} from "./form-utils";
|
|
|
|
import { classNames } from "../../../utils/styles";
|
|
|
|
import { classNames } from "../../../utils/styles";
|
|
|
|
|
|
|
|
import { toaster } from "../../../utils";
|
|
|
|
|
|
|
|
import { reportErrorsAndSubmit } from "../../../utils/forms";
|
|
|
|
|
|
|
|
|
|
|
|
interface IEditVolumeModal {
|
|
|
|
interface IEditVolumeModal {
|
|
|
|
node: IVolumeNodeItem;
|
|
|
|
node: IVolumeNodeItem;
|
|
|
|
@ -28,8 +34,10 @@ const EditVolumeModal = (props: IEditVolumeModal) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, [node]);
|
|
|
|
}, [node]);
|
|
|
|
|
|
|
|
|
|
|
|
const handleUpdate = (values: any) => {
|
|
|
|
const handleUpdate = (values: IEditVolumeForm) => {
|
|
|
|
onUpdateEndpoint(getFinalValues(values, selectedNode));
|
|
|
|
onUpdateEndpoint(getFinalValues(values, selectedNode));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
toaster(`Updated "${values.entryName}" volume successfully`, "success");
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const initialValues = useMemo(
|
|
|
|
const initialValues = useMemo(
|
|
|
|
@ -103,7 +111,7 @@ const EditVolumeModal = (props: IEditVolumeModal) => {
|
|
|
|
<button
|
|
|
|
<button
|
|
|
|
className="btn-util"
|
|
|
|
className="btn-util"
|
|
|
|
type="button"
|
|
|
|
type="button"
|
|
|
|
onClick={formik.submitForm}
|
|
|
|
onClick={reportErrorsAndSubmit(formik)}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
Save
|
|
|
|
Save
|
|
|
|
</button>
|
|
|
|
</button>
|
|
|
|
|