From 7eb985b616c12aed261fbef74a47c5a928c03e61 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Mon, 15 Jul 2024 19:12:01 +0100 Subject: feat(gui): add runbook list, ability to create and delete, sql storage (#2282) * wip * saving works :)) * functioning delete button * persist selection properly --- .../runbooks/editor/blocks/RunBlock/index.tsx | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'ui/src/components/runbooks/editor/blocks') diff --git a/ui/src/components/runbooks/editor/blocks/RunBlock/index.tsx b/ui/src/components/runbooks/editor/blocks/RunBlock/index.tsx index 78928876..9b2fe515 100644 --- a/ui/src/components/runbooks/editor/blocks/RunBlock/index.tsx +++ b/ui/src/components/runbooks/editor/blocks/RunBlock/index.tsx @@ -23,17 +23,20 @@ interface RunBlockProps { isEditable: boolean; } -const RunBlock = ({ onPlay, id, code, isEditable }: RunBlockProps) => { +const RunBlock = ({ + onChange, + onPlay, + id, + code, + isEditable, +}: RunBlockProps) => { + console.log(code); const [isRunning, setIsRunning] = useState(false); const [showTerminal, setShowTerminal] = useState(false); const [value, setValue] = useState(code); const [pty, setPty] = useState(null); - const onChange = (val: any) => { - setValue(val); - }; - const handleToggle = async (event: any) => { event.stopPropagation(); @@ -88,7 +91,10 @@ const RunBlock = ({ onPlay, id, code, isEditable }: RunBlockProps) => { editable={isEditable} width="100%" autoFocus - onChange={onChange} + onChange={(val) => { + setValue(val); + onChange(val); + }} extensions={[...extensions(), langs.shell()]} basicSetup={false} /> @@ -123,14 +129,15 @@ export default createReactBlockSpec( editor.updateBlock(block, { props: { ...block.props, code: val }, }); + console.log(block.props); }; return ( ); -- cgit v1.3.1