From dc3b5563125a486f41ace7f483936a16cefbde29 Mon Sep 17 00:00:00 2001 From: Star Richardson <67430892+alicenstar@users.noreply.github.com> Date: Thu, 19 Oct 2023 17:38:42 -0600 Subject: [PATCH] wip: add test data for dev, start adding edit and delete buttons --- web/src/Root.tsx | 32 ++++++------- .../apps/HelmVMClusterManagement.tsx | 46 +++++++++++++++++-- 2 files changed, 59 insertions(+), 19 deletions(-) diff --git a/web/src/Root.tsx b/web/src/Root.tsx index 04a656426b..31a3cbbff2 100644 --- a/web/src/Root.tsx +++ b/web/src/Root.tsx @@ -586,22 +586,22 @@ const Root = () => { } /> )} - {(state.adminConsoleMetadata?.isKurl || - state.adminConsoleMetadata?.isHelmVM) && ( - - ) : ( - - ) - } - /> - )} - {state.adminConsoleMetadata?.isHelmVM && ( - } /> - )} + {/* {(state.adminConsoleMetadata?.isKurl || + state.adminConsoleMetadata?.isHelmVM) && ( */} + + ) : ( + + ) + } + /> + {/* )} + {state.adminConsoleMetadata?.isHelmVM && ( */} + } /> + {/* )} */} } diff --git a/web/src/components/apps/HelmVMClusterManagement.tsx b/web/src/components/apps/HelmVMClusterManagement.tsx index 799cd767c7..55ee8398d5 100644 --- a/web/src/components/apps/HelmVMClusterManagement.tsx +++ b/web/src/components/apps/HelmVMClusterManagement.tsx @@ -1,3 +1,4 @@ +import { MenuItem } from "@mui/material"; import { useQuery } from "@tanstack/react-query"; import classNames from "classnames"; import MaterialReactTable, { MRT_ColumnDef } from "material-react-table"; @@ -14,6 +15,35 @@ import CodeSnippet from "../shared/CodeSnippet"; import "@src/scss/components/apps/HelmVMClusterManagement.scss"; +const testData = { + nodes: [ + { + name: "laverya-helmvm", + isConnected: true, + isReady: true, + isPrimaryNode: true, + canDelete: false, + kubeletVersion: "v1.28.2+k0s", + kubeProxyVersion: "v1.28.2+k0s", + operatingSystem: "linux", + kernelVersion: "5.10.0-26-cloud-amd64", + cpu: { capacity: 4, used: 1.9364847660000002 }, + memory: { capacity: 15.633056640625, used: 3.088226318359375 }, + pods: { capacity: 110, used: 27 }, + labels: ["controller"], + conditions: { + memoryPressure: false, + diskPressure: false, + pidPressure: false, + ready: true, + }, + podList: [], + }, + ], + ha: true, + isHelmVMEnabled: true, +}; + type State = { displayAddNode: boolean; confirmDeleteNode: string; @@ -199,6 +229,7 @@ const HelmVMClusterManagement = ({ }; // #endregion + // #region table logic type NodeColumns = { name: string | JSX.Element; roles: JSX.Element; @@ -260,7 +291,7 @@ const HelmVMClusterManagement = ({ const mappedNodes = useMemo(() => { return ( - nodesData?.nodes?.map((n) => ({ + (nodesData?.nodes || testData.nodes)?.map((n) => ({ name: slug ? ( n.name ) : ( @@ -335,12 +366,12 @@ const HelmVMClusterManagement = ({ {nodesError?.message}

)} - {nodesData?.nodes && ( + {(nodesData?.nodes || testData.nodes) && ( [ + console.info("Edit")}> + Edit + , + console.info("Delete")}> + Delete + , + ]} /> )}