From 256848986ceffb543cb91760eb0d9a59a4b13dd6 Mon Sep 17 00:00:00 2001 From: Star Richardson <67430892+alicenstar@users.noreply.github.com> Date: Thu, 19 Oct 2023 09:30:35 -0600 Subject: [PATCH] update percentages, add pods, fix link, show expiry --- .../apps/HelmVMClusterManagement.tsx | 79 +++++++++---------- 1 file changed, 36 insertions(+), 43 deletions(-) diff --git a/web/src/components/apps/HelmVMClusterManagement.tsx b/web/src/components/apps/HelmVMClusterManagement.tsx index 45971a563f..8b5228d93c 100644 --- a/web/src/components/apps/HelmVMClusterManagement.tsx +++ b/web/src/components/apps/HelmVMClusterManagement.tsx @@ -248,26 +248,6 @@ const HelmVMClusterManagement = ({ }, enabled: selectedNodeTypes.length > 0, }); - - // TODO: import useMutation - // const { - // mutate: addNodeType, - // isLoading: addNodeTypeLoading, - // error: addNodeTypeError, - // } = useMutation({ - // mutationFn: async () => { - // return ( - // await fetch(`${process.env.API_ENDPOINT}/helmvm/nodes`, { - // headers: { - // "Content-Type": "application/json", - // Accept: "application/json", - // }, - // credentials: "include", - // method: "POST", - // }) - // ).json(); - // }, - // }); // #endregion const onAddNodeClick = () => { @@ -323,11 +303,6 @@ const HelmVMClusterManagement = ({ header: "Status", size: 150, }, - { - accessorKey: "disk", - header: "Disk", - size: 150, - }, { accessorKey: "cpu", header: "CPU", @@ -338,6 +313,11 @@ const HelmVMClusterManagement = ({ header: "Memory", size: 150, }, + { + accessorKey: "pods", + header: "Pods", + size: 150, + }, { accessorKey: "pause", header: "Pause", @@ -352,31 +332,39 @@ const HelmVMClusterManagement = ({ [] ); + const calculateUtilization = (capacity: number, available: number) => { + const used = capacity - available; + return Math.round((used / capacity) * 100); + }; + const mappedNodes = useMemo(() => { return (nodesData?.nodes || testData.nodes).map((n) => ({ name: slug ? ( + > + {n.name} + ) : ( n.name ), roles: (
Generating command...
@@ -547,16 +535,21 @@ const HelmVMClusterManagement = ({ )} {!generateAddNodeCommandLoading && generateAddNodeCommand?.command && ( -+ Command expires: {generateAddNodeCommand?.expiry} +
+ > )}