diff --git a/web/src/components/apps/HelmVMViewNode.jsx b/web/src/components/apps/HelmVMViewNode.jsx deleted file mode 100644 index 53dd21fe62..0000000000 --- a/web/src/components/apps/HelmVMViewNode.jsx +++ /dev/null @@ -1,251 +0,0 @@ -import { MaterialReactTable } from "material-react-table"; -import { useMemo } from "react"; -import { useQuery } from "@tanstack/react-query"; -import { Link, useParams } from "react-router-dom"; -import Loader from "@components/shared/Loader"; - -const testData = undefined; -// const testData = { -// 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: [ -// { -// name: "example-es-85fc9df74-8x8l6", -// status: "Running", -// namespace: "helmvm", -// cpu: "0.0345789345 GB", -// memory: 0, -// }, -// ], -// }; - -const HelmVMViewNode = () => { - const { slug, nodeName } = useParams(); - const { data: nodeData, isLoading: nodeLoading } = useQuery({ - queryKey: ["helmVmNode", nodeName], - queryFn: async ({ queryKey }) => { - const [, nodeName] = queryKey; - return ( - await fetch(`${process.env.API_ENDPOINT}/helmvm/node/${nodeName}`, { - headers: { - Accept: "application/json", - }, - credentials: "include", - method: "GET", - }) - ).json(); - }, - onError: (err) => { - if (err.status === 401) { - Utilities.logoutUser(); - return; - } - console.log( - "failed to get node status list, unexpected status code", - err.status - ); - }, - onSuccess: (data) => { - setState({ - // if cluster doesn't support ha, then primary will be disabled. Force into secondary - selectedNodeType: !data.ha ? "secondary" : state.selectedNodeType, - }); - }, - config: { - retry: false, - }, - }); - - const node = nodeData || testData; - - // #region table data - const columns = useMemo( - () => [ - { - accessorKey: "name", - header: "Name", - enableHiding: false, - enableColumnDragging: false, - size: 150, - }, - { - accessorKey: "namespace", - header: "Namespace", - size: 150, - }, - { - accessorKey: "status", - header: "Status", - size: 150, - }, - { - accessorKey: "cpu", - header: "CPU", - size: 150, - muiTableBodyCellProps: { - align: "right", - }, - }, - { - accessorKey: "memory", - header: "Memory", - size: 150, - muiTableBodyCellProps: { - align: "right", - }, - }, - // { - // accessorKey: "delete", - // header: "Delete", - // size: 80, - // }, - ], - [] - ); - - const mappedPods = useMemo(() => { - return node?.podList?.map((p) => ({ - name: p.name, - namespace: p.namespace, - status: p.status, - cpu: p.cpu, - memory: p.memory, - delete: ( - <> - - > - ), - })); - }, [node?.podList?.toString()]); - // #endregion - - return ( -
- - Cluster Nodes - {" "} - / {nodeName} -
- - {nodeLoading && ( -- {node?.name} -
-- kubelet version -
-{node?.kubeletVersion}
-- kube-proxy version -
-{node?.kubeProxyVersion}
-- kernel version -
-{node?.kernelVersion}
-Pods
-- Troubleshooting -
-- Danger Zone -
- -