{appDataPath}/cache/images
.',
imagecachecount: 'Images Cached',
imagecachesize: 'Total Cache Size',
});
interface Job {
id: JobId;
name: string;
type: 'process' | 'command';
interval: 'seconds' | 'minutes' | 'hours' | 'fixed';
cronSchedule: string;
nextExecutionTime: string;
running: boolean;
}
type JobModalState = {
isOpen?: boolean;
job?: Job;
scheduleHours: number;
scheduleMinutes: number;
scheduleSeconds: number;
};
type JobModalAction =
| { type: 'set'; hours?: number; minutes?: number; seconds?: number }
| {
type: 'close';
}
| { type: 'open'; job?: Job };
const jobModalReducer = (
state: JobModalState,
action: JobModalAction
): JobModalState => {
switch (action.type) {
case 'close':
return {
...state,
isOpen: false,
};
case 'open':
return {
isOpen: true,
job: action.job,
scheduleHours: 1,
scheduleMinutes: 5,
scheduleSeconds: 30,
};
case 'set':
return {
...state,
scheduleHours: action.hours ?? state.scheduleHours,
scheduleMinutes: action.minutes ?? state.scheduleMinutes,
scheduleSeconds: action.seconds ?? state.scheduleSeconds,
};
}
};
const SettingsJobs = () => {
const intl = useIntl();
const { locale } = useLocale();
const { addToast } = useToasts();
const {
data,
error,
mutate: revalidate,
} = useSWR{intl.formatMessage(messages.jobsDescription)}
{intl.formatMessage(messages.cacheDescription)}
{intl.formatMessage(messages.imagecacheDescription, {
code: (msg: React.ReactNode) => (
{msg}
),
appDataPath: appData ? appData.appDataPath : '/app/config',
})}