From 99293b0b4900c03081977382973b98799b33225e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Padez?= Date: Thu, 23 Jul 2026 15:57:42 +0000 Subject: [PATCH] jobs: after creating a job, show a View/Close confirmation instead of navigating away Co-Authored-By: Claude Opus 4.8 --- .../components/TaskRunnerModal.tsx | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/components/TaskRunnerModal.tsx b/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/components/TaskRunnerModal.tsx index 628cbca7..ddac20f4 100644 --- a/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/components/TaskRunnerModal.tsx +++ b/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/components/TaskRunnerModal.tsx @@ -740,9 +740,10 @@ type ScriptRunnerProps = { entryType?: 'file' | 'directory'; filePath?: string; selectedNames?: string[]; + onClose: () => void; }; -const ScriptRunner = ({ taskDirName, autoInputs, context, cwd, entryType, filePath, selectedNames }: ScriptRunnerProps) => { +const ScriptRunner = ({ taskDirName, autoInputs, context, cwd, entryType, filePath, selectedNames, onClose }: ScriptRunnerProps) => { const runner = useTaskRunner(); const client = useClient(); const navigate = useNavigate(); @@ -751,6 +752,8 @@ const ScriptRunner = ({ taskDirName, autoInputs, context, cwd, entryType, filePa const [inline, setInline] = useState(false); // Is a job already running? (drives the Run vs Queue affordance). const [jobRunning, setJobRunning] = useState(false); + // After a job is created, show a confirmation (View / Close) rather than navigating away. + const [created, setCreated] = useState<{ jobId: string; action: 'start' | 'queue' } | null>(null); const bottomRef = useRef(null); const [inputDefs, setInputDefs] = useState | null>(null); const [formValues, setFormValues] = useState>({}); @@ -938,12 +941,42 @@ const ScriptRunner = ({ taskDirName, autoInputs, context, cwd, entryType, filePa const submitJob = async (action: 'start' | 'queue') => { try { const { jobId } = await client.post<{ jobId: string }>('/jobs', { taskDirName, inputs: buildAllInputs(), cwd, action }); - navigate(action === 'queue' ? '/jobs' : `/jobs/${jobId}`); + setCreated({ jobId, action }); } catch { /* stays on the modal so the user can retry */ } }; + if (created) { + return ( +
+ +
+
+ {created.action === 'queue' ? 'Job queued' : 'Job started'} +
+
+ {created.action === 'queue' ? 'It will run when the current job finishes.' : "It’s running in the background."} +
+
+
+ + +
+
+ ); + } + if (runner.phase === 'ready') { return (
@@ -1475,6 +1508,7 @@ export const TaskRunnerModal = ({ open, onOpenChange, task, entryName, entryFull entryType={effectiveEntryType} filePath={multi ? cwd.path || undefined : entryName ? (cwd.path ? `${cwd.path}/${entryName}` : entryName) : undefined} selectedNames={multi ? selectedNames : undefined} + onClose={() => onOpenChange(false)} /> ) : (