From f47c28d412ef0d6308f9ed29bc7b53196b5097d9 Mon Sep 17 00:00:00 2001 From: Hebi Li Date: Mon, 8 May 2023 05:34:11 -0700 Subject: [PATCH] add clear result button (#290) --- ui/src/components/nodes/Code.tsx | 32 +++++++++++++++++++++++-------- ui/src/lib/store/runtimeSlice.tsx | 2 ++ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/ui/src/components/nodes/Code.tsx b/ui/src/components/nodes/Code.tsx index 546f57df..5f8ba468 100644 --- a/ui/src/components/nodes/Code.tsx +++ b/ui/src/components/nodes/Code.tsx @@ -62,6 +62,7 @@ import { NodeResizeControl, NodeResizer } from "reactflow"; import "@reactflow/node-resizer/dist/style.css"; import { NewPodButtons, ResizeIcon } from "./utils"; import { timeDifference } from "../../lib/utils"; +import { ButtonGroup } from "@mui/material"; function Timer({ lastExecutedAt }) { const [counter, setCounter] = useState(0); @@ -85,6 +86,7 @@ export const ResultBlock = memo(function ResultBlock({ id }) { (state) => state.pods[id].lastExecutedAt ); const [showOutput, setShowOutput] = useState(true); + const clearResults = useStore(store, (state) => state.clearResults); return ( (function ResultBlock({ id }) { maxHeight="1000px" border="1px" > - {/* Error */} - + + + + {stdout && ( = ( state.pods[id].result = null; state.pods[id].stdout = ""; state.pods[id].error = null; + state.pods[id].dirty = true; }) ); }, @@ -505,6 +506,7 @@ export const createRuntimeSlice: StateCreator = ( state.pods[id].result = null; state.pods[id].stdout = ""; state.pods[id].error = null; + state.pods[id].dirty = true; }); }) );