From ebb0cab7658d0452c0fe8a8808920865f75c1eff Mon Sep 17 00:00:00 2001 From: gokhangunduz Date: Wed, 3 Jan 2024 18:51:49 +0300 Subject: [PATCH] refactor(data-science): :tada: add new ds feature --- public/css/style.css | 8 ++ src/components/Connections/Connections.tsx | 35 +++++-- .../TableInformationCells/StartStopCell.tsx | 55 +++++++++++ .../TableInformationCells/ToggleCell.tsx | 8 +- src/controllers/DataScienceTableData.tsx | 97 ++++++++++++++----- src/modals/StartStopModal.tsx | 48 +++++++++ 6 files changed, 214 insertions(+), 37 deletions(-) create mode 100644 src/components/TableInformationCells/StartStopCell.tsx create mode 100644 src/modals/StartStopModal.tsx diff --git a/public/css/style.css b/public/css/style.css index 4bfeb6d4..fbab2659 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -1370,6 +1370,14 @@ video { width: max-content; } +.\!w-20 { + width: 5rem !important; +} + +.\!w-28 { + width: 7rem !important; +} + .min-w-\[12rem\] { min-width: 12rem; } diff --git a/src/components/Connections/Connections.tsx b/src/components/Connections/Connections.tsx index 83b58346..22614a42 100644 --- a/src/components/Connections/Connections.tsx +++ b/src/components/Connections/Connections.tsx @@ -4,10 +4,12 @@ import { envApplication } from "../../helpers/envProvider"; import { useKeycloak } from "@react-keycloak/web"; import useRobot from "../../hooks/useRobot"; import { ReactElement } from "react"; +import useCreateRobot from "../../hooks/useCreateRobot"; export default function Connections(): ReactElement { const { responseRobot, connectionsReducer } = useRobot(); const { keycloak } = useKeycloak(); + const { robotData } = useCreateRobot(); return (
@@ -19,8 +21,8 @@ export default function Connections(): ReactElement { connectionsReducer?.ros === null ? "Waiting" : connectionsReducer?.ros === true - ? "Connected" - : "Warning" + ? "Connected" + : "Warning" } />
@@ -37,8 +39,8 @@ export default function Connections(): ReactElement { connectionsReducer?.virtualIDE === null ? "Waiting" : connectionsReducer?.virtualIDE - ? "Connected" - : "Warning" + ? "Connected" + : "Warning" } /> @@ -53,8 +55,8 @@ export default function Connections(): ReactElement { connectionsReducer?.physicalIDE === null ? "Waiting" : connectionsReducer?.physicalIDE - ? "Connected" - : "Warning" + ? "Connected" + : "Warning" } /> @@ -74,11 +76,28 @@ export default function Connections(): ReactElement { connectionsReducer?.vdi === null ? "Waiting" : connectionsReducer?.vdi - ? "Connected" - : "Warning" + ? "Connected" + : "Warning" } /> + {robotData.step1?.jupyterNotebook?.appEndpoint && ( +
+ + +
+ )} ); } diff --git a/src/components/TableInformationCells/StartStopCell.tsx b/src/components/TableInformationCells/StartStopCell.tsx new file mode 100644 index 00000000..f8044d66 --- /dev/null +++ b/src/components/TableInformationCells/StartStopCell.tsx @@ -0,0 +1,55 @@ +import { Fragment, ReactElement, useState } from "react"; +import Button from "../Button/Button"; +import StartStopModal from "../../modals/StartStopModal"; + +interface IStartStopCell { + isRunning: boolean; + loading?: boolean; + disabled?: boolean; + modalText?: string; + handleStart: () => void; + handleStop: () => void; +} + +export default function StartStopCell({ + isRunning, + loading, + disabled, + modalText, + handleStart, + handleStop, +}: IStartStopCell): ReactElement { + const [isOpenModal, setIsOpenModal] = useState(false); + + return ( + + {loading ? ( + loading + ) : ( +