diff --git a/src/components/InstanceNetworkCell/InstanceNetworkCell.tsx b/src/components/InstanceNetworkCell/InstanceNetworkCell.tsx index f2bba463..3b7bd529 100644 --- a/src/components/InstanceNetworkCell/InstanceNetworkCell.tsx +++ b/src/components/InstanceNetworkCell/InstanceNetworkCell.tsx @@ -16,7 +16,7 @@ export default function InstanceNetworkCell({
{typeof mbps === "number" ? ( -

{mbps}

+

{mbps || "0.000"}

Mbps

) : ( diff --git a/src/components/InstanceUsagesCell/InstanceUsagesCell.tsx b/src/components/InstanceUsagesCell/InstanceUsagesCell.tsx index 7383e244..aaf6896a 100644 --- a/src/components/InstanceUsagesCell/InstanceUsagesCell.tsx +++ b/src/components/InstanceUsagesCell/InstanceUsagesCell.tsx @@ -10,13 +10,11 @@ interface IInstanceUsagesCell { export default function InstanceUsagesCell({ data, }: IInstanceUsagesCell): ReactElement { - console.log("GG", data); - return (
{/* */} void; } @@ -19,14 +19,12 @@ export default function TableActionButton({ } switch (type) { - case "edit": { - return "text-layer-primary-500 border-layer-primary-500"; - } - case "delete": { return "text-red-500 border-red-500"; } } + + return "text-layer-primary-500 border-layer-primary-500"; } return ( @@ -37,10 +35,15 @@ export default function TableActionButton({ case "edit": { return ; } - case "delete": { return ; } + case "start": { + return ; + } + case "stop": { + return ; + } } })()} onClick={onClick} diff --git a/src/components/TableActionButtons/TableActionButtons.tsx b/src/components/TableActionButtons/TableActionButtons.tsx index c5a9d6ba..001507c7 100644 --- a/src/components/TableActionButtons/TableActionButtons.tsx +++ b/src/components/TableActionButtons/TableActionButtons.tsx @@ -4,19 +4,27 @@ import { ReactElement } from "react"; interface ITableActionButtons { showEditButton?: boolean; showDeleteButton?: boolean; + showStartStopButton?: boolean; disabledEditButton?: boolean; disabledDeleteButton?: boolean; + disabledStartStopButton?: boolean; onClickEditButton?: () => void; onClickDeleteButton?: () => void; + onClickStartStopButton?: () => void; + instanceState?: "running" | "stopped"; } export default function TableActionButtons({ showEditButton, showDeleteButton, + showStartStopButton, disabledEditButton, disabledDeleteButton, + disabledStartStopButton, onClickEditButton, onClickDeleteButton, + onClickStartStopButton, + instanceState, }: ITableActionButtons): ReactElement { return (
diff --git a/src/components/TableActionCells/InstanceActionCells.tsx b/src/components/TableActionCells/InstanceActionCells.tsx index 6f3a85f5..65424898 100644 --- a/src/components/TableActionCells/InstanceActionCells.tsx +++ b/src/components/TableActionCells/InstanceActionCells.tsx @@ -1,13 +1,8 @@ -import { - envCreateInstance, - envOnPremiseFleet, - envOnPremiseRobot, -} from "../../helpers/envProvider"; +import { envCreateInstance } from "../../helpers/envProvider"; import ChangeStateInstanceModal from "../../modals/ChangeStateInstanceModal"; import TerminateInstanceModal from "../../modals/TerminateInstanceModal"; -import { BiTrash, BiStopCircle, BiPlayCircle } from "react-icons/bi"; -import { Fragment, ReactElement, useEffect, useState } from "react"; -import Button from "../Button/Button"; +import { Fragment, ReactElement, useState } from "react"; +import TableActionButtons from "../TableActionButtons/TableActionButtons"; interface IInstanceActionCells { data: any; reload: () => void; @@ -21,88 +16,20 @@ export default function InstanceActionCells({ useState(false); const [isTerminateModalVisible, setIsTerminateModalVisible] = useState(false); - const [isApplicationMode, setIsApplicationMode] = useState(false); - - useEffect(() => { - setIsApplicationMode(envOnPremiseRobot || envOnPremiseFleet); - }, []); return ( -
-
+ setIsTerminateModalVisible(true)} + /> + {isChangeStateModalVisible && ( setIsChangeStateModalVisible(false)} - visibleModal={isChangeStateModalVisible} /> )} {isTerminateModalVisible && ( @@ -110,7 +37,6 @@ export default function InstanceActionCells({ data={data} reload={reload} handleCloseModal={() => setIsTerminateModalVisible(false)} - visibleModal={isTerminateModalVisible} /> )}
diff --git a/src/controllers/RegionTableData.tsx b/src/controllers/RegionTableData.tsx index fc186970..9027210c 100644 --- a/src/controllers/RegionTableData.tsx +++ b/src/controllers/RegionTableData.tsx @@ -100,11 +100,6 @@ export function RegionTableData() { ); } - console.log( - "res", - responseInstances?.[0]?.cloudInstanceResource?.networkUsage?.[0], - ); - const data: IInstanceDashboardData[] = useMemo( () => responseInstances?.map((instance: IInstance) => { @@ -122,7 +117,7 @@ export function RegionTableData() { ), architecture: instance?.cloudInstanceResource?.architecture, OSResources: `${instance?.cloudInstanceResource?.operatingSystemDistro} - (${instance?.cloudInstanceResource?.operatingSystem}}) + (${instance?.cloudInstanceResource?.operatingSystem}) `, kernel: instance?.cloudInstanceResource?.kernelVersion, k8s: instance?.cloudInstanceResource?.kubernetesVersion, @@ -179,7 +174,14 @@ export function RegionTableData() { [pagesState, responseInstances], ); - const columns: any = useMemo( + const columns: { + key: string; + header: string; + sortable?: boolean; + filter?: boolean; + align: "left" | "right" | "center"; + body?: (rowData: any) => JSX.Element; + }[] = useMemo( () => [ { key: "name", @@ -210,7 +212,7 @@ export function RegionTableData() { filter: false, align: "left", body: (rowData: { organization: string }) => { - return ; + return ; }, }, { @@ -230,6 +232,7 @@ export function RegionTableData() { filter: false, align: "left", body: (rowData: { OSResources: string }) => { + console.log("x", rowData?.OSResources); return ; }, }, @@ -293,12 +296,12 @@ export function RegionTableData() { return ( setReload((prevState: boolean) => !prevState)} /> diff --git a/src/modals/ChangeStateInstanceModal.tsx b/src/modals/ChangeStateInstanceModal.tsx index 2a0a29c2..afeb9d20 100644 --- a/src/modals/ChangeStateInstanceModal.tsx +++ b/src/modals/ChangeStateInstanceModal.tsx @@ -7,14 +7,12 @@ import { startInstance, stopInstance } from "../toolkit/InstanceSlice"; interface IChangeInstanceModal { data: any; reload: () => void; - visibleModal: boolean; handleCloseModal: () => void; } export default function ChangeInstanceModal({ data, reload, - visibleModal, handleCloseModal, }: IChangeInstanceModal): ReactElement { const [isLoading, setIsLoading] = useState(false); @@ -51,7 +49,7 @@ export default function ChangeInstanceModal({ return ( handleCloseModal()} > diff --git a/src/modals/TerminateInstanceModal.tsx b/src/modals/TerminateInstanceModal.tsx index 4ad04492..2f183807 100644 --- a/src/modals/TerminateInstanceModal.tsx +++ b/src/modals/TerminateInstanceModal.tsx @@ -7,14 +7,12 @@ import { terminateInstance } from "../toolkit/InstanceSlice"; interface ITerminateInstanceModal { data: any; reload: () => void; - visibleModal: boolean; handleCloseModal: () => void; } export default function TerminateInstanceModal({ data, reload, - visibleModal, handleCloseModal, }: ITerminateInstanceModal): ReactElement { const [isLoading, setIsLoading] = useState(false); @@ -40,7 +38,7 @@ export default function TerminateInstanceModal({ return ( handleCloseModal()} > diff --git a/src/pages/DashboardsPage/RegionDashboard/RegionDashboard.tsx b/src/pages/DashboardsPage/RegionDashboard/RegionDashboard.tsx index 25d92606..4482449f 100644 --- a/src/pages/DashboardsPage/RegionDashboard/RegionDashboard.tsx +++ b/src/pages/DashboardsPage/RegionDashboard/RegionDashboard.tsx @@ -83,7 +83,7 @@ export default function RegionDashboard(): ReactElement { title="Cloud Instances" data={data} columns={columns} - loading={Array.isArray(responseInstances) ? false : true} + loading={!Array.isArray(responseInstances)} handleReload={handleReload} /> }