Skip to content

Commit

Permalink
fix redirect, add column types (#4092)
Browse files Browse the repository at this point in the history
  • Loading branch information
alicenstar authored Oct 19, 2023
1 parent f977068 commit 40d416a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
6 changes: 4 additions & 2 deletions web/src/components/apps/AppDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ function AppDetailPage(props: Props) {
navigate(`/app/${appsList[0].slug}`, { replace: true });
} else if (props.isHelmManaged) {
navigate("/install-with-helm", { replace: true });
} else if (props.isHelmVM) {
navigate(`/${selectedApp?.slug}/cluster/manage`, { replace: true });
} else {
navigate("/upload-license", { replace: true });
}
Expand Down Expand Up @@ -324,6 +322,10 @@ function AppDetailPage(props: Props) {
const firstVersion = downstream.pendingVersions.find(
(version: Version) => version?.sequence === 0
);
if (props.isHelmVM) {
navigate(`/${appNeedsConfiguration.slug}/cluster/manage`);
return;
}
if (firstVersion?.status === "pending_config") {
navigate(`/${appNeedsConfiguration.slug}/config`);
return;
Expand Down
26 changes: 15 additions & 11 deletions web/src/components/apps/HelmVMClusterManagement.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useQuery } from "@tanstack/react-query";
import classNames from "classnames";
import MaterialReactTable from "material-react-table";
import MaterialReactTable, { MRT_ColumnDef } from "material-react-table";
import React, { ChangeEvent, useMemo, useReducer, useState } from "react";
import Modal from "react-modal";
import { Link, useParams } from "react-router-dom";
Expand Down Expand Up @@ -199,7 +199,17 @@ const HelmVMClusterManagement = ({
};
// #endregion

const columns = useMemo(
type NodeColumns = {
name: string | JSX.Element;
roles: JSX.Element;
status: string;
cpu: string;
memory: string;
pause: JSX.Element;
delete: JSX.Element;
};

const columns = useMemo<MRT_ColumnDef<NodeColumns>[]>(
() => [
{
accessorKey: "name",
Expand All @@ -211,7 +221,7 @@ const HelmVMClusterManagement = ({
{
accessorKey: "roles",
header: "Role(s)",
size: 404,
size: 150,
},
{
accessorKey: "status",
Expand All @@ -234,11 +244,6 @@ const HelmVMClusterManagement = ({
align: "right",
},
},
{
accessorKey: "pods",
header: "Pods",
size: 150,
},
// {
// accessorKey: "pause",
// header: "Pause",
Expand Down Expand Up @@ -280,10 +285,9 @@ const HelmVMClusterManagement = ({
),
status: n.isReady ? "Ready" : "Not Ready",
cpu: `${n.cpu.used.toFixed(2)} / ${n.cpu.capacity.toFixed(2)}`,
memory: `${n.memory.used.toFixed(2)}GB / ${n.memory.capacity.toFixed(
memory: `${n.memory.used.toFixed(2)} / ${n.memory.capacity.toFixed(
2
)}GB`,
pods: `${n.pods.used} / ${n.pods.capacity}`,
)} GB`,
pause: (
<>
<button className="btn secondary">Pause</button>
Expand Down
6 changes: 4 additions & 2 deletions web/src/components/apps/HelmVMViewNode.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,10 @@ const HelmVMViewNode = () => {
<p className="tw-text-gray-400">{node?.kubeProxyVersion}</p>
</div>
<div className="tw-flex tw-gap-2">
<p className="tw-text-gray-800 tw-font-semibold">OS</p>
<p className="tw-text-gray-400">{node?.operatingSystem}</p>
<p className="tw-text-gray-800 tw-font-semibold">
kernel version
</p>
<p className="tw-text-gray-400">{node?.kernelVersion}</p>
</div>
</div>
</div>
Expand Down

0 comments on commit 40d416a

Please sign in to comment.