mirror of
https://github.com/sct/overseerr.git
synced 2025-09-17 17:24:35 +02:00
feat(jobs): allow modifying job schedules (#1440)
* feat(jobs): backend implementation * feat(jobs): initial frontend implementation * feat(jobs): store job settings as Record * feat(jobs): use heroicons/react instead of inline svgs * feat(jobs): use presets instead of cron expressions * feat(jobs): ran `yarn i18n:extract` * feat(jobs): suggested changes - use job ids in settings - add intervalDuration to jobs to allow choosing only minutes or hours for the job schedule - move job schedule defaults to settings.json - better TS types for jobs in settings cache component - make suggested changes to wording - plural form for label when job schedule can be defined in minutes - add fixed job interval duration - add predefined interval choices for minutes and hours - add new schema for job to overseerr api * feat(jobs): required change for CI to not fail * feat(jobs): suggested changes * fix(jobs): revert offending type refactor
This commit is contained in:

committed by
GitHub

parent
5683f55ebf
commit
82614ca441
@@ -215,6 +215,18 @@ interface NotificationSettings {
|
||||
agents: NotificationAgents;
|
||||
}
|
||||
|
||||
interface JobSettings {
|
||||
schedule: string;
|
||||
}
|
||||
|
||||
export type JobId =
|
||||
| 'plex-recently-added-scan'
|
||||
| 'plex-full-scan'
|
||||
| 'radarr-scan'
|
||||
| 'sonarr-scan'
|
||||
| 'download-sync'
|
||||
| 'download-sync-reset';
|
||||
|
||||
interface AllSettings {
|
||||
clientId: string;
|
||||
vapidPublic: string;
|
||||
@@ -225,6 +237,7 @@ interface AllSettings {
|
||||
sonarr: SonarrSettings[];
|
||||
public: PublicSettings;
|
||||
notifications: NotificationSettings;
|
||||
jobs: Record<JobId, JobSettings>;
|
||||
}
|
||||
|
||||
const SETTINGS_PATH = process.env.CONFIG_DIRECTORY
|
||||
@@ -346,6 +359,26 @@ class Settings {
|
||||
},
|
||||
},
|
||||
},
|
||||
jobs: {
|
||||
'plex-recently-added-scan': {
|
||||
schedule: '0 */5 * * * *',
|
||||
},
|
||||
'plex-full-scan': {
|
||||
schedule: '0 0 3 * * *',
|
||||
},
|
||||
'radarr-scan': {
|
||||
schedule: '0 0 4 * * *',
|
||||
},
|
||||
'sonarr-scan': {
|
||||
schedule: '0 30 4 * * *',
|
||||
},
|
||||
'download-sync': {
|
||||
schedule: '0 * * * * *',
|
||||
},
|
||||
'download-sync-reset': {
|
||||
schedule: '0 0 1 * * *',
|
||||
},
|
||||
},
|
||||
};
|
||||
if (initialSettings) {
|
||||
this.data = merge(this.data, initialSettings);
|
||||
@@ -428,6 +461,14 @@ class Settings {
|
||||
this.data.notifications = data;
|
||||
}
|
||||
|
||||
get jobs(): Record<JobId, JobSettings> {
|
||||
return this.data.jobs;
|
||||
}
|
||||
|
||||
set jobs(data: Record<JobId, JobSettings>) {
|
||||
this.data.jobs = data;
|
||||
}
|
||||
|
||||
get clientId(): string {
|
||||
if (!this.data.clientId) {
|
||||
this.data.clientId = randomUUID();
|
||||
|
Reference in New Issue
Block a user