diff --git a/react/src/pages/SessionLauncherPage.tsx b/react/src/pages/SessionLauncherPage.tsx index 4d96e2b84d..90b8029656 100644 --- a/react/src/pages/SessionLauncherPage.tsx +++ b/react/src/pages/SessionLauncherPage.tsx @@ -89,6 +89,7 @@ import { Switch, Table, Tag, + TimePicker, Tooltip, Typography, theme, @@ -96,6 +97,7 @@ import { import dayjs from 'dayjs'; import { useAtomValue } from 'jotai'; import _ from 'lodash'; +import { Check } from 'lucide-react'; import React, { useEffect, useMemo, useState } from 'react'; import { ErrorBoundary } from 'react-error-boundary'; import { Trans, useTranslation } from 'react-i18next'; @@ -147,6 +149,8 @@ interface SessionLauncherValue { enabled: boolean; scheduleDate?: string; command?: string; + enabledTimeout?: boolean; + timeout?: string; }; allocationPreset: string; envvars: EnvVarFormListValue[]; @@ -963,6 +967,68 @@ const SessionLauncherPage = () => { + + + + { + if ( + e.target.checked && + _.isEmpty( + form.getFieldValue(['batch', 'timeout']), + ) + ) { + form.setFieldValue( + ['batch', 'timeout'], + dayjs('00:00:00', 'HH:mm:ss'), + ); + } else if (e.target.checked === false) { + form.setFieldValue( + ['batch', 'timeout'], + undefined, + ); + } + form.validateFields([['batch', 'timeout']]); + }} + > + {t('session.launcher.Enable')} + + + { + return ( + prev.batch?.timeoutEnabled !== + next.batch?.timeoutEnabled + ); + }} + > + {() => { + const disabled = + form.getFieldValue('batch')?.timeoutEnabled !== + true; + return ( + <> + + + + + ); + }} + + + )}