feat(wip): scheduler

This commit is contained in:
karishmas6
2024-09-10 06:41:22 +05:30
parent fc56a395b8
commit 5107bc2b2b

View File

@@ -72,9 +72,10 @@ interface Data {
interface RecordingsTableProps { interface RecordingsTableProps {
handleEditRecording: (fileName: string) => void; handleEditRecording: (fileName: string) => void;
handleRunRecording: (fileName: string, params: string[]) => void; handleRunRecording: (fileName: string, params: string[]) => void;
handleScheduleRecording: (fileName: string, params: string[]) => void;
} }
export const RecordingsTable = ({ handleEditRecording, handleRunRecording }: RecordingsTableProps) => { export const RecordingsTable = ({ handleEditRecording, handleRunRecording, handleScheduleRecording }: RecordingsTableProps) => {
const [page, setPage] = React.useState(0); const [page, setPage] = React.useState(0);
const [rowsPerPage, setRowsPerPage] = React.useState(10); const [rowsPerPage, setRowsPerPage] = React.useState(10);
const [rows, setRows] = React.useState<Data[]>([]); const [rows, setRows] = React.useState<Data[]>([]);
@@ -171,7 +172,7 @@ export const RecordingsTable = ({ handleEditRecording, handleRunRecording }: Rec
case 'schedule': case 'schedule':
return ( return (
<TableCell key={column.id} align={column.align}> <TableCell key={column.id} align={column.align}>
<ScheduleButton handleSchedule={() => {/* todo: schedule logic here */ }} /> <ScheduleButton handleSchedule={() => handleScheduleRecording(row.name, row.params || []) } />
</TableCell> </TableCell>
); );
case 'delete': case 'delete':
@@ -230,18 +231,20 @@ const InterpretButton = ({ handleInterpret }: InterpretButtonProps) => {
) )
} }
interface ScheduleButtonProps { interface ScheduleButtonProps {
handleSchedule: () => void; handleSchedule: () => void;
} }
const ScheduleButton = ({ handleSchedule }: ScheduleButtonProps) => { const ScheduleButton = ({ handleSchedule }: ScheduleButtonProps) => {
return ( return (
<IconButton <IconButton aria-label="add" size="small" onClick={() => {
aria-label="schedule" handleSchedule();
size="small" }}
onClick={handleSchedule}
sx={{ '&:hover': { color: '#1976d2', backgroundColor: 'transparent' } }}> sx={{ '&:hover': { color: '#1976d2', backgroundColor: 'transparent' } }}>
<Assignment /> <PlayCircle />
</IconButton> </IconButton>
); )
}; }