feat: get schedule of robot
This commit is contained in:
@@ -5,6 +5,8 @@ import { Dropdown } from "../atoms/DropdownMui";
|
|||||||
import Button from "@mui/material/Button";
|
import Button from "@mui/material/Button";
|
||||||
import { modalStyle } from "./AddWhereCondModal";
|
import { modalStyle } from "./AddWhereCondModal";
|
||||||
import { validMomentTimezones } from '../../constants/const';
|
import { validMomentTimezones } from '../../constants/const';
|
||||||
|
import { useGlobalInfoStore } from '../../context/globalInfo';
|
||||||
|
import { getSchedule } from '../../api/storage';
|
||||||
|
|
||||||
interface ScheduleSettingsProps {
|
interface ScheduleSettingsProps {
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
@@ -85,6 +87,26 @@ export const ScheduleSettingsModal = ({ isOpen, handleStart, handleClose, initia
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const { recordingId } = useGlobalInfoStore();
|
||||||
|
|
||||||
|
const getRobotSchedule = async () => {
|
||||||
|
if (recordingId) {
|
||||||
|
const schedule = await getSchedule(recordingId);
|
||||||
|
if (schedule) {
|
||||||
|
setSettings(schedule);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.error('No recording id provided');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isOpen) {
|
||||||
|
getRobotSchedule();
|
||||||
|
}
|
||||||
|
}, [isOpen]);
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GenericModal
|
<GenericModal
|
||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
@@ -182,6 +204,14 @@ export const ScheduleSettingsModal = ({ isOpen, handleStart, handleClose, initia
|
|||||||
</Dropdown>
|
</Dropdown>
|
||||||
</Box>
|
</Box>
|
||||||
</>
|
</>
|
||||||
|
<Box mt={2} display="flex" justifyContent="flex-end">
|
||||||
|
<Button onClick={() => handleStart(settings)} variant="contained" color="primary">
|
||||||
|
Save Schedule
|
||||||
|
</Button>
|
||||||
|
<Button onClick={handleClose} color="primary" variant="outlined" style={{ marginLeft: '10px' }}>
|
||||||
|
Cancel
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
|
||||||
<Box mt={2} display="flex" justifyContent="space-between">
|
<Box mt={2} display="flex" justifyContent="space-between">
|
||||||
<Button
|
<Button
|
||||||
@@ -192,15 +222,6 @@ export const ScheduleSettingsModal = ({ isOpen, handleStart, handleClose, initia
|
|||||||
Delete Schedule
|
Delete Schedule
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Box mt={2} display="flex" justifyContent="flex-end">
|
|
||||||
<Button onClick={() => handleStart(settings)} variant="contained" color="primary">
|
|
||||||
Save Schedule
|
|
||||||
</Button>
|
|
||||||
<Button onClick={handleClose} color="primary" variant="outlined" style={{ marginLeft: '10px' }}>
|
|
||||||
Cancel
|
|
||||||
</Button>
|
|
||||||
</Box>
|
|
||||||
</Box>
|
</Box>
|
||||||
</GenericModal>
|
</GenericModal>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user