From 97d978c267f2819714cf2df4999dba56bdde31d5 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Tue, 16 Jul 2024 11:32:14 +0100 Subject: [PATCH] fix(gui): terminal resize overflow (#2285) --- ui/src/App.tsx | 7 +++- ui/src/components/runbooks/editor/Editor.tsx | 2 +- .../runbooks/editor/blocks/RunBlock/index.tsx | 41 ++++++++++--------- .../editor/blocks/RunBlock/terminal.tsx | 7 ++-- ui/src/main.tsx | 2 +- ui/src/pages/Home.tsx | 2 +- ui/src/pages/Runbooks.tsx | 2 +- 7 files changed, 34 insertions(+), 29 deletions(-) diff --git a/ui/src/App.tsx b/ui/src/App.tsx index 2f804b1b..27c57207 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -130,8 +130,11 @@ function App() { ]; return ( -
-
+
+
icon diff --git a/ui/src/components/runbooks/editor/Editor.tsx b/ui/src/components/runbooks/editor/Editor.tsx index 8ed52660..b70436de 100644 --- a/ui/src/components/runbooks/editor/Editor.tsx +++ b/ui/src/components/runbooks/editor/Editor.tsx @@ -124,7 +124,7 @@ export default function Editor() { // Renders the editor instance. return ( -
+
-
- -
+ + {isRunning ? : } + + +
+
{ setValue(val); @@ -99,7 +100,7 @@ const RunBlock = ({ basicSetup={false} />
diff --git a/ui/src/components/runbooks/editor/blocks/RunBlock/terminal.tsx b/ui/src/components/runbooks/editor/blocks/RunBlock/terminal.tsx index e5ca0fca..fa203fc9 100644 --- a/ui/src/components/runbooks/editor/blocks/RunBlock/terminal.tsx +++ b/ui/src/components/runbooks/editor/blocks/RunBlock/terminal.tsx @@ -55,6 +55,7 @@ const TerminalComponent = ({ pty }: any) => { terminal.loadAddon(fitAddon); terminal.onResize(onResize(pty)); + fitAddon.fit(); const windowResize = () => { fitAddon.fit(); }; @@ -67,8 +68,6 @@ const TerminalComponent = ({ pty }: any) => { window.addEventListener("resize", windowResize); - fitAddon.fit(); - // Customize further as needed return () => { terminal.dispose(); @@ -76,7 +75,9 @@ const TerminalComponent = ({ pty }: any) => { }; }, [pty]); - return
; + return ( +
+ ); }; export default TerminalComponent; diff --git a/ui/src/main.tsx b/ui/src/main.tsx index 074552f7..58cfd77b 100644 --- a/ui/src/main.tsx +++ b/ui/src/main.tsx @@ -8,7 +8,7 @@ ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
-
+
diff --git a/ui/src/pages/Home.tsx b/ui/src/pages/Home.tsx index b7c4503d..0f0b5dcf 100644 --- a/ui/src/pages/Home.tsx +++ b/ui/src/pages/Home.tsx @@ -36,7 +36,7 @@ function Header({ name }: any) { return (
-
+

{greeting}

diff --git a/ui/src/pages/Runbooks.tsx b/ui/src/pages/Runbooks.tsx index 0452a578..6b517553 100644 --- a/ui/src/pages/Runbooks.tsx +++ b/ui/src/pages/Runbooks.tsx @@ -6,7 +6,7 @@ export default function Runbooks() { const currentRunbook = useStore((store) => store.currentRunbook); return ( -
+
{currentRunbook && }