Skip to content

Commit

Permalink
refactor(robot-page): 🎉 update robot-page layout
Browse files Browse the repository at this point in the history
  • Loading branch information
gokhangunduz committed Dec 18, 2023
1 parent e119787 commit 23dd089
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 20 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"dependencies": {
"@emotion/css": "^11.10.6",
"@fontsource/inter": "^5.0.8",
"@melloware/react-logviewer": "^5.0.2",
"@monaco-editor/react": "^4.5.0",
"@react-hook/mouse-position": "^4.1.3",
"@react-keycloak/web": "^3.4.0",
Expand Down
4 changes: 4 additions & 0 deletions public/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1738,6 +1738,10 @@ video {
overflow: hidden !important;
}

.overflow-hidden {
overflow: hidden;
}

.overflow-x-auto {
overflow-x: auto;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/CodeEditorSwitcher/CodeEditorSwitcher.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Dispatch, ReactElement, SetStateAction } from "react";
import { ReactElement } from "react";
import Card from "../Card/Card";

interface ICodeEditorSwitcher {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Fragment, ReactElement, useState } from "react";
import useMain from "../../hooks/useMain";
import StateCell from "../TableInformationCells/StateCell";
import LogModal from "../../modals/LogModal";
import { RxOpenInNewWindow } from "react-icons/rx";
import ServiceLogModal from "../../modals/ServiceLogModal";

export default function WidgetSystemBackendCell(): ReactElement {
const { pagesState } = useMain();
Expand Down Expand Up @@ -34,7 +34,7 @@ export default function WidgetSystemBackendCell(): ReactElement {
</div>
</div>
{isOpenModal && (
<LogModal
<ServiceLogModal
log={pagesState?.instance?.systemStatus?.[1]?.log}
handleCloseModal={() => setIsOpenModal(false)}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Fragment, ReactElement, useState } from "react";
import useMain from "../../hooks/useMain";
import StateCell from "../TableInformationCells/StateCell";
import LogModal from "../../modals/LogModal";
import ServiceLogModal from "../../modals/ServiceLogModal";
import { RxOpenInNewWindow } from "react-icons/rx";

export default function WidgetSystemOperatorCell(): ReactElement {
Expand Down Expand Up @@ -34,7 +34,7 @@ export default function WidgetSystemOperatorCell(): ReactElement {
</div>
</div>
{isOpenModal && (
<LogModal
<ServiceLogModal
log={pagesState?.instance?.systemStatus?.[0]?.log}
handleCloseModal={() => setIsOpenModal(false)}
/>
Expand Down
8 changes: 3 additions & 5 deletions src/modals/LogModal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ReactElement } from "react";
import { Dialog } from "primereact/dialog";
import Terminal from "../components/Terminal/Terminal";
import { LazyLog } from "@melloware/react-logviewer";

interface ILogModal {
log?: string;
Expand All @@ -15,12 +15,10 @@ export default function LogModal({
<Dialog
header={`Logs`}
visible={true}
className=" w-[80vw]"
className=" w-[90vw]"
onHide={() => handleCloseModal()}
>
<div className="flex h-full w-full flex-col gap-8">
<Terminal value={log || ""} />
</div>
<LazyLog text={log} height={752} scrollToLine={9999999} />
</Dialog>
);
}
24 changes: 14 additions & 10 deletions src/modals/ServiceLogModal.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { ReactElement } from "react";
import { Dialog } from "primereact/dialog";
import useRobot from "../hooks/useRobot";
import Terminal from "../components/Terminal/Terminal";
import { LazyLog } from "@melloware/react-logviewer";

interface IServiceLogModal {
type: "ide" | "vdi";
type?: "ide" | "vdi";
log?: string;
handleCloseModal: () => void;
}

export default function ServiceLogModal({
type,
log,
handleCloseModal,
}: IServiceLogModal): ReactElement {
const { responseRobot } = useRobot();
Expand All @@ -18,18 +20,20 @@ export default function ServiceLogModal({
<Dialog
header={`${type === "ide" ? "IDE" : "VDI"} Service Log`}
visible={true}
className="w-[80vw]"
className="h-full w-[90vw]"
onHide={() => handleCloseModal()}
>
<div className="flex w-full flex-col gap-8">
<Terminal
value={
type === "ide"
<LazyLog
text={
type
? type === "ide"
? responseRobot?.ideApplicationLog
: responseRobot?.vdiApplicationLog
}
/>
</div>
: log
}
height={752}
scrollToLine={9999999}
/>
</Dialog>
);
}

0 comments on commit 23dd089

Please sign in to comment.