@@ -7,14 +7,15 @@ import Button from '@mui/joy/Button';
77import FormControl from '@mui/joy/FormControl' ;
88import FormLabel from '@mui/joy/FormLabel' ;
99import Input from '@mui/joy/Input' ;
10- import Textarea from '@mui/joy/Textarea' ;
1110import {
1211 FormHelperText ,
1312 ModalClose ,
1413 ModalDialog ,
1514 Sheet ,
1615 Stack ,
1716 Typography ,
17+ Checkbox ,
18+ Alert ,
1819} from '@mui/joy' ;
1920import { FolderIcon } from 'lucide-react' ;
2021import { Editor } from '@monaco-editor/react' ;
@@ -57,6 +58,7 @@ export default function EditTaskModal({
5758 const [ accelerators , setAccelerators ] = React . useState ( '' ) ;
5859 const [ numNodes , setNumNodes ] = React . useState ( '' ) ;
5960 const [ setup , setSetup ] = React . useState ( '' ) ;
61+ const [ shutdownAfterCompletion , setShutdownAfterCompletion ] = React . useState ( false ) ;
6062 const [ saving , setSaving ] = React . useState ( false ) ;
6163
6264 const setupEditorRef = useRef < any > ( null ) ;
@@ -74,6 +76,7 @@ export default function EditTaskModal({
7476 setAccelerators ( cfg . accelerators != null ? String ( cfg . accelerators ) : '' ) ;
7577 setNumNodes ( cfg . num_nodes != null ? String ( cfg . num_nodes ) : '' ) ;
7678 setSetup ( cfg . setup != null ? String ( cfg . setup ) : '' ) ;
79+ setShutdownAfterCompletion ( cfg . shutdown_after_completion || false ) ;
7780 } , [ task ] ) ;
7881
7982 // Keep Monaco editors in sync if the state changes after mount
@@ -156,6 +159,7 @@ export default function EditTaskModal({
156159 accelerators : accelerators || undefined ,
157160 num_nodes : numNodes ? parseInt ( numNodes , 10 ) : undefined ,
158161 setup : setupValue || undefined ,
162+ shutdown_after_completion : shutdownAfterCompletion ,
159163 } as any ;
160164
161165 const body = {
@@ -363,6 +367,26 @@ export default function EditTaskModal({
363367 </ FormHelperText >
364368 </ FormControl >
365369
370+ < FormControl sx = { { mt : 2 } } >
371+ < Checkbox
372+ checked = { shutdownAfterCompletion }
373+ onChange = { ( e ) => setShutdownAfterCompletion ( e . target . checked ) }
374+ label = "Shutdown machine after execution"
375+ />
376+ < FormHelperText >
377+ When enabled, the remote instance will be automatically shut
378+ down after the task completes.
379+ </ FormHelperText >
380+ </ FormControl >
381+
382+ { shutdownAfterCompletion && (
383+ < Alert color = "warning" sx = { { mt : 1 } } >
384+ < strong > Warning:</ strong > This will destroy all data on the
385+ remote machine that is not logged or saved elsewhere. Make sure
386+ to save any important results before the task completes.
387+ </ Alert >
388+ ) }
389+
366390 { /* Show uploaded directory indicator if present */ }
367391 { task &&
368392 ( ( ) => {
0 commit comments