Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add more texts
  • Loading branch information
aine-etke committed Apr 5, 2025
commit 2d430d2894a90eadb3c3ef29f5b7daeece2406a1
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ const ServerSchedulesPage = () => {

<Box sx={{ mt: 2 }}>
<Typography variant="h5">
<ScheduleIcon sx={{ verticalAlign: "middle", mr: 1 }} /> Scheduled commands:
<ScheduleIcon sx={{ verticalAlign: "middle", mr: 1 }} /> Scheduled commands
</Typography>
<Typography variant="body1">
The following commands are scheduled to run at specific times. You can view their details and modify them as needed.
More details about the mode can be found <Link href="https://etke.cc/help/extras/scheduler/#schedule" target="_blank">here</Link>.
</Typography>
<ScheduledCommandsList />
</Box>
Expand All @@ -30,7 +34,12 @@ const ServerSchedulesPage = () => {

<Box sx={{ mt: 2 }}>
<Typography variant="h5">
<RestoreIcon sx={{ verticalAlign: "middle", mr: 1 }} /> Recurring commands:
<RestoreIcon sx={{ verticalAlign: "middle", mr: 1 }} /> Recurring commands
</Typography>
<Typography variant="body1">
The following commands are set to run at specific weekday and time (weekly).
You can view their details and modify them as needed.
More details about the mode can be found <Link href="https://etke.cc/help/extras/scheduler/#recurring" target="_blank">here</Link>.
</Typography>
<RecurringCommandsList />
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import {
CardContent,
CardHeader,
Box,
Alert,
Typography,
Link,
} from "@mui/material";
import { useAppContext } from "../../../../../Context";
import { useRecurringCommands } from "../../hooks/useRecurringCommands";
Expand Down Expand Up @@ -156,6 +159,13 @@ const RecurringCommandEdit = () => {
<Card>
<CardHeader title={pageTitle} />
<CardContent>
{command && (
<Alert severity="info">
<Typography variant="body" sx={{ px: 2 }}>
You can find more details about the command <Link href={`https://etke.cc/help/extras/scheduler/#${command.command}`} target="_blank">here</Link>.
</Typography>
</Alert>
)}
<Form defaultValues={command || undefined} onSubmit={handleSubmit} record={command || undefined} warnWhenUnsavedChanges>
<Box display="flex" flexDirection="column" gap={2}>
{!isCreating && <TextInput readOnly source="id" label="ID" fullWidth required />}
Expand All @@ -180,4 +190,4 @@ const RecurringCommandEdit = () => {
);
};

export default RecurringCommandEdit;
export default RecurringCommandEdit;
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ const RecurringCommandsList = () => {
<Paper>
<Datagrid bulkActionButtons={false} rowClick="edit">
<TextField source="command" />
<TextField source="args" />
<TextField source="args" label="Arguments" />
<TextField source="time" label="Time (UTC)" />
<DateField options={DATE_FORMAT} showTime source="scheduled_at" label="Scheduled at (local time)" />
<DateField options={DATE_FORMAT} showTime source="scheduled_at" label="Next run at (local time)" />
</Datagrid>
</Paper>
</ListContextProvider>
</ResourceContextProvider>
);
};

export default RecurringCommandsList;
export default RecurringCommandsList;
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
} from "@mui/material";
import { useAppContext } from "../../../../../Context";
import { useScheduledCommands } from "../../hooks/useScheduledCommands";
import { Typography, Link } from "@mui/material";
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
import { ScheduledCommand } from "../../../../../synapse/dataProvider";
import ScheduleDeleteButton from "./ScheduledDeleteButton";
Expand Down Expand Up @@ -109,13 +110,17 @@ const ScheduledCommandEdit = () => {

<Card>
<CardHeader title={pageTitle} />
{command && (
<Typography variant="body" sx={{ px: 2 }}>
You can find more details about the command <Link href={`https://etke.cc/help/extras/scheduler/#${command.command}`} target="_blank">here</Link>.
</Typography>
)}
<CardContent>
<Form defaultValues={command || undefined} onSubmit={handleSubmit} record={command || undefined} warnWhenUnsavedChanges>
<Box display="flex" flexDirection="column" gap={2}>
{command && <TextInput readOnly source="id" label="ID" fullWidth required />}
<SelectInput readOnly={!isCreating} source="command" choices={commandChoices} label="Command" fullWidth required />
<ArgumentsField serverCommands={serverCommands} />
{!isCreating && <BooleanInput readOnly={!isCreating} source="is_recurring" label="Is recurring" />}
<DateTimeInput source="scheduled_at" label="Scheduled at" fullWidth required />
<Box mt={2} display="flex" justifyContent="space-between">
<SaveButton label={isCreating ? "Create" : "Update"} />
Expand All @@ -129,4 +134,4 @@ const ScheduledCommandEdit = () => {
);
};

export default ScheduledCommandEdit;
export default ScheduledCommandEdit;
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
DateField,
RecordContextProvider,
} from "react-admin";
import { Alert, Box, Card, CardContent, CardHeader } from "@mui/material";
import { Alert, Box, Card, CardContent, CardHeader, Typography, Link } from "@mui/material";
import { useAppContext } from "../../../../../Context";
import { useScheduledCommands } from "../../hooks/useScheduledCommands";
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
Expand Down Expand Up @@ -47,6 +47,7 @@ const ScheduledCommandShow = () => {
// navigate("/server_schedules");
return null;
}
console.log(command);

return (
<Box sx={{ mt: 2 }}>
Expand All @@ -61,14 +62,25 @@ const ScheduledCommandShow = () => {
<Card>
<CardHeader title="Scheduled Command Details" />
<CardContent>
{command && (
<Alert severity="info">
<Typography variant="body" sx={{ px: 2 }}>
You can find more details about the command <Link href={`https://etke.cc/help/extras/scheduler/#${command.command}`} target="_blank">here</Link>.
</Typography>
</Alert>
)}
<SimpleShowLayout>
<TextField source="id" label="ID" />
<TextField source="command" label="Command" />
<TextField source="args" label="Arguments" />
{command.args && (
<TextField source="args" label="Arguments" />
)}
<BooleanField source="is_recurring" label="Is recurring" />
<DateField source="scheduled_at" label="Scheduled at" showTime />
</SimpleShowLayout>
<Alert severity="warning">Recurring commands are not editable as they will be regenerated on the next run.</Alert>
{command.is_recurring && (
<Alert severity="warning">Scheduled commands created from a recurring one are not editable as they will be regenerated automatically. Please edit the recurring command instead.</Alert>
)}
</CardContent>
</Card>
<Box display="flex" justifyContent="flex-end" mt={2}>
Expand All @@ -79,4 +91,4 @@ const ScheduledCommandShow = () => {
);
};

export default ScheduledCommandShow;
export default ScheduledCommandShow;
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ const ScheduledCommandsList = () => {
return `/${resource}/${id}`;
}} >
<TextField source="command" />
<TextField source="args" />
<BooleanField source="is_recurring" />
<DateField options={DATE_FORMAT} showTime source="scheduled_at" label="Scheduled at (local time)" />
<TextField source="args" label="Arguments" />
<BooleanField source="is_recurring" label="Is recurring?"/>
<DateField options={DATE_FORMAT} showTime source="scheduled_at" label="Run at (local time)" />
</Datagrid>
</Paper>
</ListContextProvider>
</ResourceContextProvider>
);
};

export default ScheduledCommandsList;
export default ScheduledCommandsList;