diff --git a/skyvern-frontend/src/routes/workflows/editor/WorkflowHeader.tsx b/skyvern-frontend/src/routes/workflows/editor/WorkflowHeader.tsx index 68e94381..3c827597 100644 --- a/skyvern-frontend/src/routes/workflows/editor/WorkflowHeader.tsx +++ b/skyvern-frontend/src/routes/workflows/editor/WorkflowHeader.tsx @@ -19,7 +19,6 @@ import { TooltipTrigger, } from "@/components/ui/tooltip"; import { Input } from "@/components/ui/input"; -import { useUser } from "@/hooks/useUser"; import { statusIsRunningOrQueued } from "@/routes/tasks/types"; import { useGlobalWorkflowsQuery } from "../hooks/useGlobalWorkflowsQuery"; import { EditableNodeTitle } from "./nodes/components/EditableNodeTitle"; @@ -85,7 +84,6 @@ function WorkflowHeader({ const debugStore = useDebugStore(); const workflowRunIsRunningOrQueued = workflowRun && statusIsRunningOrQueued(workflowRun); - const user = useUser().get(); const [chosenCacheKeyValue, setChosenCacheKeyValue] = useState( cacheKeyValue ?? null, ); @@ -107,6 +105,9 @@ function WorkflowHeader({ // eslint-disable-next-line react-hooks/exhaustive-deps }, [cacheKeyValue]); + const shouldShowCacheControls = + !isGeneratingCode && (cacheKeyValues?.total_count ?? 0) > 0; + if (!globalWorkflows) { return null; // this should be loaded already by some other components } @@ -134,79 +135,77 @@ function WorkflowHeader({ />
- {user && - !isGeneratingCode && - (cacheKeyValues?.total_count ?? 0) > 0 && ( - <> - {debugStore.isDebugMode && ( - - )} -
+ {debugStore.isDebugMode && ( + + )} +
+ { + setChosenCacheKeyValue(e.target.value); + onCacheKeyValuesFilter(e.target.value); + }} + onMouseDown={() => { + if (!cacheKeyValuesPanelOpen) { + onCacheKeyValuesClick(); + } + }} + onKeyDown={(e) => { + if (e.key === "Enter") { + const numFiltered = cacheKeyValues?.values?.length ?? 0; - if (numFiltered === 1) { - const first = cacheKeyValues?.values?.[0]; - if (first) { - setChosenCacheKeyValue(first); - onCacheKeyValueAccept(first); - } - return; + if (numFiltered === 1) { + const first = cacheKeyValues?.values?.[0]; + if (first) { + setChosenCacheKeyValue(first); + onCacheKeyValueAccept(first); } - - setChosenCacheKeyValue(chosenCacheKeyValue); - onCacheKeyValueAccept(chosenCacheKeyValue); + return; } - onCacheKeyValuesKeydown(e); - }} - placeholder="Code Key Value" - value={chosenCacheKeyValue ?? undefined} - onBlur={(e) => { - onCacheKeyValuesBlurred(e.target.value); - setChosenCacheKeyValue(e.target.value); + + setChosenCacheKeyValue(chosenCacheKeyValue); + onCacheKeyValueAccept(chosenCacheKeyValue); + } + onCacheKeyValuesKeydown(e); + }} + placeholder="Code Key Value" + value={chosenCacheKeyValue ?? undefined} + onBlur={(e) => { + onCacheKeyValuesBlurred(e.target.value); + setChosenCacheKeyValue(e.target.value); + }} + /> + {cacheKeyValuesPanelOpen ? ( + + ) : ( + { + dom.input.current?.focus(); + onCacheKeyValuesClick(); }} /> - {cacheKeyValuesPanelOpen ? ( - - ) : ( - { - dom.input.current?.focus(); - onCacheKeyValuesClick(); - }} - /> - )} -
- - )} + )} +
+ + )} {isGeneratingCode && (