|
|
|
|
@ -7,7 +7,7 @@ import Environment from "./Environment";
|
|
|
|
|
import Volumes from "./Volumes";
|
|
|
|
|
import Labels from "./Labels";
|
|
|
|
|
import type { CallbackFunction, IServiceNodeItem } from "../../../types";
|
|
|
|
|
import { getInitialValues, validationSchema } from "./form-utils";
|
|
|
|
|
import { getInitialValues, transform, validationSchema } from "./form-utils";
|
|
|
|
|
|
|
|
|
|
export interface IModalServiceProps {
|
|
|
|
|
node: IServiceNodeItem;
|
|
|
|
|
@ -15,20 +15,7 @@ export interface IModalServiceProps {
|
|
|
|
|
onUpdateEndpoint: CallbackFunction;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ModalServiceEdit = (props: IModalServiceProps) => {
|
|
|
|
|
const { node, onHide, onUpdateEndpoint } = props;
|
|
|
|
|
const [openTab, setOpenTab] = useState("General");
|
|
|
|
|
const [selectedNode, setSelectedNode] = useState<IServiceNodeItem>();
|
|
|
|
|
|
|
|
|
|
const handleUpdate = (values: any) => {
|
|
|
|
|
// TODO
|
|
|
|
|
const updated = { ...selectedNode };
|
|
|
|
|
updated.canvasConfig = values.canvasConfig;
|
|
|
|
|
updated.serviceConfig = values.serviceConfig;
|
|
|
|
|
onUpdateEndpoint(updated);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const tabs = [
|
|
|
|
|
const tabs = [
|
|
|
|
|
{
|
|
|
|
|
name: "General",
|
|
|
|
|
href: "#",
|
|
|
|
|
@ -53,7 +40,16 @@ const ModalServiceEdit = (props: IModalServiceProps) => {
|
|
|
|
|
current: false,
|
|
|
|
|
hidden: false
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const ModalServiceEdit = (props: IModalServiceProps) => {
|
|
|
|
|
const { node, onHide, onUpdateEndpoint } = props;
|
|
|
|
|
const [openTab, setOpenTab] = useState("General");
|
|
|
|
|
const [selectedNode, setSelectedNode] = useState<IServiceNodeItem>();
|
|
|
|
|
|
|
|
|
|
const handleUpdate = (values: any) => {
|
|
|
|
|
onUpdateEndpoint(transform(values, selectedNode));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const initialValues = useMemo(
|
|
|
|
|
() => getInitialValues(selectedNode),
|
|
|
|
|
|