diff --git a/react/src/App.tsx b/react/src/App.tsx index 6d8539205a..6964007206 100644 --- a/react/src/App.tsx +++ b/react/src/App.tsx @@ -60,6 +60,20 @@ const InteractiveLoginPage = React.lazy( ); const ImportAndRunPage = React.lazy(() => import('./pages/ImportAndRunPage')); +const RedirectToSummary = () => { + useSuspendedBackendaiClient(); + const pathName = '/summary'; + document.dispatchEvent( + new CustomEvent('move-to-from-react', { + detail: { + path: pathName, + // params: options?.params, + }, + }), + ); + return ; +}; + const router = createBrowserRouter([ { path: '/interactive-login', @@ -91,17 +105,17 @@ const router = createBrowserRouter([ children: [ { path: '/', - element: , + element: , }, { //for electron dev mode path: '/build/electron-app/app/index.html', - element: , + element: , }, { //for electron prod mode path: '/app/index.html', - element: , + element: , }, { path: '/summary', diff --git a/react/src/components/BatchSessionScheduledTimeSetting.tsx b/react/src/components/BatchSessionScheduledTimeSetting.tsx index 4179bf03c7..89a30da568 100644 --- a/react/src/components/BatchSessionScheduledTimeSetting.tsx +++ b/react/src/components/BatchSessionScheduledTimeSetting.tsx @@ -4,8 +4,9 @@ import { useWebComponentInfo } from './DefaultProviders'; import Flex from './Flex'; import { useToggle } from 'ahooks'; import { Typography, Checkbox, theme } from 'antd'; +import { GetRef } from 'antd/lib'; import dayjs from 'dayjs'; -import React from 'react'; +import React, { useRef } from 'react'; import { useTranslation } from 'react-i18next'; interface Props extends DatePickerISOProps {} @@ -24,6 +25,8 @@ const BatchSessionScheduledTimeSetting: React.FC = ({ dispatchEvent('change', value); }; + const datePickerRef = useRef>(null); + return ( <> @@ -32,7 +35,7 @@ const BatchSessionScheduledTimeSetting: React.FC = ({ { + onChange={(v) => { toggleChecked(); const newScheduleTime = v ? dayjs().add(2, 'minutes').toISOString() @@ -44,11 +47,13 @@ const BatchSessionScheduledTimeSetting: React.FC = ({ { - return date.isBefore(dayjs().startOf('minute')); + return date.isBefore(dayjs().startOf('day')); }} + localFormat disabled={!isChecked} showTime={{ hideDisabledOptions: true, @@ -57,8 +62,11 @@ const BatchSessionScheduledTimeSetting: React.FC = ({ onChange={(value) => { dispatchAndSetScheduleTime(value); }} - onBlur={() => { - dispatchAndSetScheduleTime(scheduleTime); + onCalendarChange={() => { + datePickerRef.current?.focus(); + }} + onPanelChange={() => { + datePickerRef.current?.focus(); }} status={ isChecked && !scheduleTime @@ -67,29 +75,26 @@ const BatchSessionScheduledTimeSetting: React.FC = ({ ? 'error' : undefined } + needConfirm={false} + showNow={false} /> - {isChecked && scheduleTime && ( - - ({t('session.launcher.StartAfter')} - { - // Add 2 minutes if the schedule time is in the past - const leftTime = dayjs(scheduleTime).diff(dayjs()); - if (leftTime < 0) { - dispatchAndSetScheduleTime( - dayjs(scheduleTime).add(2, 'minutes').toISOString(), - ); - } - return dayjs(scheduleTime).fromNow(); - }} - delay={1000} - /> - ) - - )} + {isChecked && + scheduleTime && + !dayjs(scheduleTime).isBefore(dayjs()) && ( + + ({t('session.launcher.StartAfter')} + { + return dayjs(scheduleTime).fromNow(); + }} + delay={1000} + /> + ) + + )} {isChecked && !scheduleTime && ( = ({ {t('session.launcher.StartTimeDoesNotApply')} )} + {isChecked && + scheduleTime && + dayjs(scheduleTime).isBefore(dayjs()) && ( + + {t('session.launcher.StartTimeMustBeInTheFuture')} + + )} diff --git a/react/src/components/DatePickerISO.tsx b/react/src/components/DatePickerISO.tsx index cf6f7f654f..bde619f4a1 100644 --- a/react/src/components/DatePickerISO.tsx +++ b/react/src/components/DatePickerISO.tsx @@ -1,6 +1,7 @@ import { useControllableValue } from 'ahooks'; import { DatePicker } from 'antd'; import { PickerProps } from 'antd/es/date-picker/generatePicker'; +import { GetRef } from 'antd/lib'; import dayjs, { Dayjs } from 'dayjs'; import _ from 'lodash'; import React from 'react'; @@ -11,12 +12,10 @@ export interface DatePickerISOProps onChange?: (value: string | undefined) => void; localFormat?: boolean; } -const DatePickerISO: React.FC = ({ - value, - onChange, - localFormat, - ...pickerProps -}) => { +const DatePickerISO = React.forwardRef< + GetRef, + DatePickerISOProps +>(({ value, onChange, localFormat, ...pickerProps }, ref) => { const [, setControllableValue] = useControllableValue({ value, onChange, @@ -24,6 +23,7 @@ const DatePickerISO: React.FC = ({ return ( { if (_.isArray(value)) { @@ -38,6 +38,6 @@ const DatePickerISO: React.FC = ({ {...pickerProps} /> ); -}; +}); export default DatePickerISO; diff --git a/react/src/components/lablupTalkativotUI/LLMPlaygroundPage.tsx b/react/src/components/lablupTalkativotUI/LLMPlaygroundPage.tsx index 7b578eb6fe..bcf3cc8c28 100644 --- a/react/src/components/lablupTalkativotUI/LLMPlaygroundPage.tsx +++ b/react/src/components/lablupTalkativotUI/LLMPlaygroundPage.tsx @@ -59,7 +59,7 @@ const LLMPlaygroundPage: React.FC = ({ ...props }) => { > - {t('chatui.Sync')} + {t('chatui.SyncInput')}