Merge pull request #730 from getmaxun/schedule-ui
fix: schedule modal ui update
This commit is contained in:
@@ -14,7 +14,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
interface RecordingsProps {
|
interface RecordingsProps {
|
||||||
handleEditRecording: (id: string, fileName: string) => void;
|
handleEditRecording: (id: string, fileName: string) => void;
|
||||||
handleRunRecording: (settings: RunSettings) => void;
|
handleRunRecording: (settings: RunSettings) => void;
|
||||||
handleScheduleRecording: (settings: ScheduleSettings) => void;
|
handleScheduleRecording: (settings: ScheduleSettings) => Promise<boolean>;
|
||||||
setRecordingInfo: (id: string, name: string) => void;
|
setRecordingInfo: (id: string, name: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { getSchedule, deleteSchedule } from '../../api/storage';
|
|||||||
|
|
||||||
interface ScheduleSettingsProps {
|
interface ScheduleSettingsProps {
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
handleStart: (settings: ScheduleSettings) => void;
|
handleStart: (settings: ScheduleSettings) => Promise<boolean>;
|
||||||
handleClose: () => void;
|
handleClose: () => void;
|
||||||
initialSettings?: ScheduleSettings | null;
|
initialSettings?: ScheduleSettings | null;
|
||||||
}
|
}
|
||||||
@@ -272,7 +272,12 @@ export const ScheduleSettingsModal = ({ isOpen, handleStart, handleClose, initia
|
|||||||
</Dropdown>
|
</Dropdown>
|
||||||
</Box>
|
</Box>
|
||||||
<Box mt={2} display="flex" justifyContent="flex-end">
|
<Box mt={2} display="flex" justifyContent="flex-end">
|
||||||
<Button onClick={() => handleStart(settings)} variant="contained" color="primary">
|
<Button onClick={async () => {
|
||||||
|
const success = await handleStart(settings);
|
||||||
|
if (success) {
|
||||||
|
await getRobotSchedule();
|
||||||
|
}
|
||||||
|
}} variant="contained" color="primary">
|
||||||
{t('schedule_settings.buttons.save_schedule')}
|
{t('schedule_settings.buttons.save_schedule')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -235,15 +235,14 @@ export const MainPage = ({ handleEditRecording, initialContent }: MainPageProps)
|
|||||||
}
|
}
|
||||||
}, [runningRecordingName, sockets, ids, debugMessageHandler, user?.id, t, notify, setRerenderRuns, setQueuedRuns, navigate, setContent, setIds]);
|
}, [runningRecordingName, sockets, ids, debugMessageHandler, user?.id, t, notify, setRerenderRuns, setQueuedRuns, navigate, setContent, setIds]);
|
||||||
|
|
||||||
const handleScheduleRecording = (settings: ScheduleSettings) => {
|
const handleScheduleRecording = async (settings: ScheduleSettings) => {
|
||||||
scheduleStoredRecording(runningRecordingId, settings)
|
const { message, runId }: ScheduleRunResponse = await scheduleStoredRecording(runningRecordingId, settings);
|
||||||
.then(({ message, runId }: ScheduleRunResponse) => {
|
if (message === 'success') {
|
||||||
if (message === 'success') {
|
notify('success', t('main_page.notifications.schedule_success', { name: runningRecordingName }));
|
||||||
notify('success', t('main_page.notifications.schedule_success', { name: runningRecordingName }));
|
} else {
|
||||||
} else {
|
notify('error', t('main_page.notifications.schedule_failed', { name: runningRecordingName }));
|
||||||
notify('error', t('main_page.notifications.schedule_failed', { name: runningRecordingName }));
|
}
|
||||||
}
|
return message === 'success';
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const DisplayContent = () => {
|
const DisplayContent = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user