mirror of
https://github.com/Cleanuparr/Cleanuparr.git
synced 2026-02-23 01:56:22 -05:00
Fix cron expression inputs (#203)
This commit is contained in:
@@ -64,7 +64,10 @@ export class ConfigurationService {
|
||||
* Update queue cleaner configuration
|
||||
*/
|
||||
updateQueueCleanerConfig(config: QueueCleanerConfig): Observable<QueueCleanerConfig> {
|
||||
config.cronExpression = this.convertJobScheduleToCron(config.jobSchedule!);
|
||||
// Generate cron expression if using basic scheduling
|
||||
if (!config.useAdvancedScheduling && config.jobSchedule) {
|
||||
config.cronExpression = this.convertJobScheduleToCron(config.jobSchedule);
|
||||
}
|
||||
return this.http.put<QueueCleanerConfig>(this.ApplicationPathService.buildApiUrl('/configuration/queue_cleaner'), config).pipe(
|
||||
catchError((error) => {
|
||||
console.error("Error updating queue cleaner config:", error);
|
||||
@@ -113,32 +116,32 @@ export class ConfigurationService {
|
||||
*/
|
||||
private tryExtractJobScheduleFromCron(cronExpression: string): JobSchedule | undefined {
|
||||
// Patterns we support:
|
||||
// Seconds: */n * * ? * * *
|
||||
// Minutes: 0 */n * ? * * *
|
||||
// Hours: 0 0 */n ? * * *
|
||||
// Seconds: */n * * ? * * * or 0/n * * ? * * * (Quartz.NET format)
|
||||
// Minutes: 0 */n * ? * * * or 0 0/n * ? * * * (Quartz.NET format)
|
||||
// Hours: 0 0 */n ? * * * or 0 0 0/n ? * * * (Quartz.NET format)
|
||||
try {
|
||||
const parts = cronExpression.split(" ");
|
||||
|
||||
if (parts.length !== 7) return undefined;
|
||||
|
||||
// Every n seconds
|
||||
if (parts[0].startsWith("*/") && parts[1] === "*") {
|
||||
// Every n seconds - handle both */n and 0/n formats
|
||||
if ((parts[0].startsWith("*/") || parts[0].startsWith("0/")) && parts[1] === "*") {
|
||||
const seconds = parseInt(parts[0].substring(2));
|
||||
if (!isNaN(seconds) && seconds > 0 && seconds < 60) {
|
||||
return { every: seconds, type: ScheduleUnit.Seconds };
|
||||
}
|
||||
}
|
||||
|
||||
// Every n minutes
|
||||
if (parts[0] === "0" && parts[1].startsWith("*/")) {
|
||||
// Every n minutes - handle both */n and 0/n formats
|
||||
if (parts[0] === "0" && (parts[1].startsWith("*/") || parts[1].startsWith("0/"))) {
|
||||
const minutes = parseInt(parts[1].substring(2));
|
||||
if (!isNaN(minutes) && minutes > 0 && minutes < 60) {
|
||||
return { every: minutes, type: ScheduleUnit.Minutes };
|
||||
}
|
||||
}
|
||||
|
||||
// Every n hours
|
||||
if (parts[0] === "0" && parts[1] === "0" && parts[2].startsWith("*/")) {
|
||||
// Every n hours - handle both */n and 0/n formats
|
||||
if (parts[0] === "0" && parts[1] === "0" && (parts[2].startsWith("*/") || parts[2].startsWith("0/"))) {
|
||||
const hours = parseInt(parts[2].substring(2));
|
||||
if (!isNaN(hours) && hours > 0 && hours < 24) {
|
||||
return { every: hours, type: ScheduleUnit.Hours };
|
||||
@@ -156,31 +159,31 @@ export class ConfigurationService {
|
||||
*/
|
||||
private convertJobScheduleToCron(schedule: JobSchedule): string {
|
||||
if (!schedule || schedule.every <= 0) {
|
||||
return "0 0/5 * * * ?"; // Default: every 5 minutes
|
||||
return "0 0/5 * * * ?"; // Default: every 5 minutes (Quartz.NET format)
|
||||
}
|
||||
|
||||
switch (schedule.type) {
|
||||
case ScheduleUnit.Seconds:
|
||||
if (schedule.every < 60) {
|
||||
return `*/${schedule.every} * * ? * * *`;
|
||||
return `0/${schedule.every} * * ? * * *`; // Quartz.NET format
|
||||
}
|
||||
break;
|
||||
|
||||
case ScheduleUnit.Minutes:
|
||||
if (schedule.every < 60) {
|
||||
return `0 */${schedule.every} * ? * * *`;
|
||||
return `0 0/${schedule.every} * ? * * *`; // Quartz.NET format
|
||||
}
|
||||
break;
|
||||
|
||||
case ScheduleUnit.Hours:
|
||||
if (schedule.every < 24) {
|
||||
return `0 0 */${schedule.every} ? * * *`;
|
||||
return `0 0 0/${schedule.every} ? * * *`; // Quartz.NET format
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Fallback to default
|
||||
return "0 0/5 * * * ?";
|
||||
return "0 0/5 * * * ?"; // Default: every 5 minutes (Quartz.NET format)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -189,32 +192,32 @@ export class ConfigurationService {
|
||||
*/
|
||||
private tryExtractContentBlockerJobScheduleFromCron(cronExpression: string): ContentBlockerJobSchedule | undefined {
|
||||
// Patterns we support:
|
||||
// Seconds: */n * * ? * * *
|
||||
// Minutes: 0 */n * ? * * *
|
||||
// Hours: 0 0 */n ? * * *
|
||||
// Seconds: */n * * ? * * * or 0/n * * ? * * * (Quartz.NET format)
|
||||
// Minutes: 0 */n * ? * * * or 0 0/n * ? * * * (Quartz.NET format)
|
||||
// Hours: 0 0 */n ? * * * or 0 0 0/n ? * * * (Quartz.NET format)
|
||||
try {
|
||||
const parts = cronExpression.split(" ");
|
||||
|
||||
if (parts.length !== 7) return undefined;
|
||||
|
||||
// Every n seconds
|
||||
if (parts[0].startsWith("*/") && parts[1] === "*") {
|
||||
// Every n seconds - handle both */n and 0/n formats
|
||||
if ((parts[0].startsWith("*/") || parts[0].startsWith("0/")) && parts[1] === "*") {
|
||||
const seconds = parseInt(parts[0].substring(2));
|
||||
if (!isNaN(seconds) && seconds > 0 && seconds < 60) {
|
||||
return { every: seconds, type: ContentBlockerScheduleUnit.Seconds };
|
||||
}
|
||||
}
|
||||
|
||||
// Every n minutes
|
||||
if (parts[0] === "0" && parts[1].startsWith("*/")) {
|
||||
// Every n minutes - handle both */n and 0/n formats
|
||||
if (parts[0] === "0" && (parts[1].startsWith("*/") || parts[1].startsWith("0/"))) {
|
||||
const minutes = parseInt(parts[1].substring(2));
|
||||
if (!isNaN(minutes) && minutes > 0 && minutes < 60) {
|
||||
return { every: minutes, type: ContentBlockerScheduleUnit.Minutes };
|
||||
}
|
||||
}
|
||||
|
||||
// Every n hours
|
||||
if (parts[0] === "0" && parts[1] === "0" && parts[2].startsWith("*/")) {
|
||||
// Every n hours - handle both */n and 0/n formats
|
||||
if (parts[0] === "0" && parts[1] === "0" && (parts[2].startsWith("*/") || parts[2].startsWith("0/"))) {
|
||||
const hours = parseInt(parts[2].substring(2));
|
||||
if (!isNaN(hours) && hours > 0 && hours < 24) {
|
||||
return { every: hours, type: ContentBlockerScheduleUnit.Hours };
|
||||
@@ -232,31 +235,31 @@ export class ConfigurationService {
|
||||
*/
|
||||
private convertContentBlockerJobScheduleToCron(schedule: ContentBlockerJobSchedule): string {
|
||||
if (!schedule || schedule.every <= 0) {
|
||||
return "0 0/5 * * * ?"; // Default: every 5 minutes
|
||||
return "0/5 * * * * ?"; // Default: every 5 seconds (Quartz.NET format)
|
||||
}
|
||||
|
||||
switch (schedule.type) {
|
||||
case ContentBlockerScheduleUnit.Seconds:
|
||||
if (schedule.every < 60) {
|
||||
return `*/${schedule.every} * * ? * * *`;
|
||||
return `0/${schedule.every} * * ? * * *`; // Quartz.NET format
|
||||
}
|
||||
break;
|
||||
|
||||
case ContentBlockerScheduleUnit.Minutes:
|
||||
if (schedule.every < 60) {
|
||||
return `0 */${schedule.every} * ? * * *`;
|
||||
return `0 0/${schedule.every} * ? * * *`; // Quartz.NET format
|
||||
}
|
||||
break;
|
||||
|
||||
case ContentBlockerScheduleUnit.Hours:
|
||||
if (schedule.every < 24) {
|
||||
return `0 0 */${schedule.every} ? * * *`;
|
||||
return `0 0 0/${schedule.every} ? * * *`; // Quartz.NET format
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Fallback to default
|
||||
return "0 0/5 * * * ?";
|
||||
return "0/5 * * * * ?"; // Default: every 5 seconds (Quartz.NET format)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -122,22 +122,22 @@ export class ContentBlockerConfigStore extends signalStore(
|
||||
*/
|
||||
generateCronExpression(schedule: JobSchedule): string {
|
||||
if (!schedule) {
|
||||
return "0/5 * * * * ?"; // Default: every 5 seconds
|
||||
return "0/5 * * * * ?"; // Default: every 5 seconds (Quartz.NET format)
|
||||
}
|
||||
|
||||
// Cron format: Seconds Minutes Hours Day-of-month Month Day-of-week Year
|
||||
switch (schedule.type) {
|
||||
case ScheduleUnit.Seconds:
|
||||
return `0/${schedule.every} * * ? * * *`; // Every n seconds
|
||||
return `0/${schedule.every} * * ? * * *`; // Every n seconds (Quartz.NET format)
|
||||
|
||||
case ScheduleUnit.Minutes:
|
||||
return `0 0/${schedule.every} * ? * * *`; // Every n minutes
|
||||
return `0 0/${schedule.every} * ? * * *`; // Every n minutes (Quartz.NET format)
|
||||
|
||||
case ScheduleUnit.Hours:
|
||||
return `0 0 0/${schedule.every} ? * * *`; // Every n hours
|
||||
return `0 0 0/${schedule.every} ? * * *`; // Every n hours (Quartz.NET format)
|
||||
|
||||
default:
|
||||
return "0/5 * * * * ?"; // Default: every 5 seconds
|
||||
return "0/5 * * * * ?"; // Default: every 5 seconds (Quartz.NET format)
|
||||
}
|
||||
}
|
||||
})),
|
||||
|
||||
@@ -127,7 +127,7 @@ export class ContentBlockerSettingsComponent implements OnDestroy, CanComponentD
|
||||
cronExpression: [{ value: '', disabled: true }, [Validators.required]],
|
||||
jobSchedule: this.formBuilder.group({
|
||||
every: [{ value: 5, disabled: true }, [Validators.required, Validators.min(1)]],
|
||||
type: [{ value: ScheduleUnit.Minutes, disabled: true }],
|
||||
type: [{ value: ScheduleUnit.Seconds, disabled: true }],
|
||||
}),
|
||||
|
||||
ignorePrivate: [{ value: false, disabled: true }],
|
||||
@@ -167,7 +167,7 @@ export class ContentBlockerSettingsComponent implements OnDestroy, CanComponentD
|
||||
cronExpression: config.cronExpression,
|
||||
jobSchedule: config.jobSchedule || {
|
||||
every: 5,
|
||||
type: ScheduleUnit.Minutes
|
||||
type: ScheduleUnit.Seconds
|
||||
},
|
||||
ignorePrivate: config.ignorePrivate,
|
||||
deletePrivate: config.deletePrivate,
|
||||
@@ -569,6 +569,11 @@ export class ContentBlockerSettingsComponent implements OnDestroy, CanComponentD
|
||||
blocklistPath: "",
|
||||
blocklistType: BlocklistType.Blacklist,
|
||||
},
|
||||
readarr: {
|
||||
enabled: false,
|
||||
blocklistPath: "",
|
||||
blocklistType: BlocklistType.Blacklist,
|
||||
},
|
||||
});
|
||||
|
||||
// Manually update control states after reset
|
||||
@@ -576,6 +581,7 @@ export class ContentBlockerSettingsComponent implements OnDestroy, CanComponentD
|
||||
this.updateBlocklistDependentControls('sonarr', false);
|
||||
this.updateBlocklistDependentControls('radarr', false);
|
||||
this.updateBlocklistDependentControls('lidarr', false);
|
||||
this.updateBlocklistDependentControls('readarr', false);
|
||||
|
||||
// Mark form as dirty so the save button is enabled after reset
|
||||
this.contentBlockerForm.markAsDirty();
|
||||
@@ -614,7 +620,7 @@ export class ContentBlockerSettingsComponent implements OnDestroy, CanComponentD
|
||||
} else if (scheduleType === ScheduleUnit.Hours) {
|
||||
return this.scheduleValueOptions[ScheduleUnit.Hours];
|
||||
}
|
||||
return this.scheduleValueOptions[ScheduleUnit.Minutes]; // Default to minutes
|
||||
return this.scheduleValueOptions[ScheduleUnit.Seconds]; // Default to seconds
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -362,21 +362,27 @@ export class DownloadCleanerSettingsComponent implements OnDestroy, CanComponent
|
||||
.pipe(takeUntil(this.destroy$))
|
||||
.subscribe(useAdvanced => {
|
||||
const enabled = this.downloadCleanerForm.get('enabled')?.value || false;
|
||||
if (enabled) {
|
||||
const cronExpressionControl = this.downloadCleanerForm.get('cronExpression');
|
||||
const jobScheduleGroup = this.downloadCleanerForm.get('jobSchedule') as FormGroup;
|
||||
const everyControl = jobScheduleGroup?.get('every');
|
||||
const typeControl = jobScheduleGroup?.get('type');
|
||||
|
||||
if (useAdvanced) {
|
||||
if (cronExpressionControl) cronExpressionControl.enable();
|
||||
if (everyControl) everyControl.disable();
|
||||
if (typeControl) typeControl.disable();
|
||||
} else {
|
||||
if (cronExpressionControl) cronExpressionControl.disable();
|
||||
if (everyControl) everyControl.enable();
|
||||
if (typeControl) typeControl.enable();
|
||||
}
|
||||
const cronExpressionControl = this.downloadCleanerForm.get('cronExpression');
|
||||
const jobScheduleGroup = this.downloadCleanerForm.get('jobSchedule') as FormGroup;
|
||||
const everyControl = jobScheduleGroup?.get('every');
|
||||
const typeControl = jobScheduleGroup?.get('type');
|
||||
|
||||
// Update scheduling controls based on mode, regardless of enabled state
|
||||
if (useAdvanced) {
|
||||
if (cronExpressionControl) cronExpressionControl.enable();
|
||||
if (everyControl) everyControl.disable();
|
||||
if (typeControl) typeControl.disable();
|
||||
} else {
|
||||
if (cronExpressionControl) cronExpressionControl.disable();
|
||||
if (everyControl) everyControl.enable();
|
||||
if (typeControl) typeControl.enable();
|
||||
}
|
||||
|
||||
// Then respect the main enabled state - if disabled, disable all scheduling controls
|
||||
if (!enabled) {
|
||||
cronExpressionControl?.disable();
|
||||
everyControl?.disable();
|
||||
typeControl?.disable();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -463,19 +469,14 @@ export class DownloadCleanerSettingsComponent implements OnDestroy, CanComponent
|
||||
* Update form control disabled states based on the configuration
|
||||
*/
|
||||
private updateFormControlDisabledStates(config: DownloadCleanerConfig): void {
|
||||
// Update main controls based on enabled state
|
||||
// Update main form controls based on the 'enabled' state
|
||||
this.updateMainControlsState(config.enabled);
|
||||
|
||||
// Update schedule controls based on advanced scheduling
|
||||
const cronControl = this.downloadCleanerForm.get('cronExpression');
|
||||
const jobScheduleControl = this.downloadCleanerForm.get('jobSchedule');
|
||||
|
||||
if (config.useAdvancedScheduling) {
|
||||
jobScheduleControl?.disable({ emitEvent: false });
|
||||
cronControl?.enable({ emitEvent: false });
|
||||
} else {
|
||||
cronControl?.disable({ emitEvent: false });
|
||||
jobScheduleControl?.enable({ emitEvent: false });
|
||||
// Update other dependent controls only if the main feature is enabled
|
||||
if (config.enabled) {
|
||||
// Update unlinked controls based on current unlinkedEnabled value
|
||||
const unlinkedEnabled = config.unlinkedEnabled || false;
|
||||
this.updateUnlinkedControlsState(unlinkedEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -552,14 +553,17 @@ export class DownloadCleanerSettingsComponent implements OnDestroy, CanComponent
|
||||
// Get form values including disabled controls
|
||||
const formValues = this.downloadCleanerForm.getRawValue();
|
||||
|
||||
// Determine the correct cron expression to use
|
||||
const cronExpression: string = formValues.useAdvancedScheduling ?
|
||||
formValues.cronExpression :
|
||||
// If in basic mode, generate cron expression from the schedule
|
||||
this.downloadCleanerStore.generateCronExpression(formValues.jobSchedule);
|
||||
|
||||
// Create config object from form values
|
||||
const config: DownloadCleanerConfig = {
|
||||
enabled: formValues.enabled,
|
||||
useAdvancedScheduling: formValues.useAdvancedScheduling,
|
||||
cronExpression: formValues.useAdvancedScheduling ?
|
||||
formValues.cronExpression :
|
||||
// If in basic mode, generate cron expression from the schedule
|
||||
this.downloadCleanerStore.generateCronExpression(formValues.jobSchedule),
|
||||
cronExpression: cronExpression,
|
||||
jobSchedule: formValues.jobSchedule,
|
||||
categories: formValues.categories,
|
||||
deletePrivate: formValues.deletePrivate,
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('displaySupportBanner')"
|
||||
title="View documentation for support banner display">
|
||||
title="Click for documentation">
|
||||
</i>
|
||||
Display Support Banner
|
||||
</label>
|
||||
@@ -42,7 +42,7 @@
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('dryRun')"
|
||||
title="View documentation for dry run mode">
|
||||
title="Click for documentation">
|
||||
</i>
|
||||
Dry Run
|
||||
</label>
|
||||
@@ -57,7 +57,7 @@
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('httpMaxRetries')"
|
||||
title="View documentation for HTTP retry configuration">
|
||||
title="Click for documentation">
|
||||
</i>
|
||||
Maximum HTTP Retries
|
||||
</label>
|
||||
@@ -81,7 +81,7 @@
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('httpTimeout')"
|
||||
title="View documentation for HTTP timeout configuration">
|
||||
title="Click for documentation">
|
||||
</i>
|
||||
HTTP Timeout (seconds)
|
||||
</label>
|
||||
@@ -105,7 +105,7 @@
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('httpCertificateValidation')"
|
||||
title="View documentation for certificate validation options">
|
||||
title="Click for documentation">
|
||||
</i>
|
||||
Certificate Validation
|
||||
</label>
|
||||
@@ -126,7 +126,7 @@
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('searchEnabled')"
|
||||
title="View documentation for automatic search functionality">
|
||||
title="Click for documentation">
|
||||
</i>
|
||||
Enable Search
|
||||
</label>
|
||||
@@ -140,7 +140,7 @@
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('searchDelay')"
|
||||
title="View documentation for search delay configuration">
|
||||
title="Click for documentation">
|
||||
</i>
|
||||
Search Delay (seconds)
|
||||
</label>
|
||||
@@ -165,7 +165,7 @@
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('logLevel')"
|
||||
title="View documentation for log level configuration">
|
||||
title="Click for documentation">
|
||||
</i>
|
||||
Log Level
|
||||
</label>
|
||||
@@ -186,7 +186,7 @@
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('ignoredDownloads')"
|
||||
title="View documentation for download ignore patterns">
|
||||
title="Click for documentation">
|
||||
</i>
|
||||
Ignored Downloads
|
||||
</label>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('notifiarr.apiKey')"
|
||||
title="View documentation for Notifiarr API key setup">
|
||||
title="Click for documentation">
|
||||
</i>
|
||||
API Key
|
||||
</label>
|
||||
@@ -50,12 +50,12 @@
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('notifiarr.channelId')"
|
||||
title="View documentation for Discord channel ID setup">
|
||||
title="Click for documentation">
|
||||
</i>
|
||||
Channel ID
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('notifiarr.channelId')"
|
||||
title="View documentation for Discord channel ID setup">
|
||||
title="Click for documentation">
|
||||
</i>
|
||||
</label>
|
||||
<div class="field-input">
|
||||
@@ -69,7 +69,7 @@
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('eventTriggers')"
|
||||
title="View documentation for notification event types">
|
||||
title="Click for documentation">
|
||||
</i>
|
||||
Event Triggers
|
||||
</label>
|
||||
@@ -115,7 +115,7 @@
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('apprise.url')"
|
||||
title="View documentation for Apprise server URL setup">
|
||||
title="Click for documentation">
|
||||
</i>
|
||||
URL
|
||||
</label>
|
||||
@@ -130,7 +130,7 @@
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('apprise.key')"
|
||||
title="View documentation for Apprise configuration key">
|
||||
title="Click for documentation">
|
||||
</i>
|
||||
Key
|
||||
</label>
|
||||
@@ -145,7 +145,7 @@
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('eventTriggers')"
|
||||
title="View documentation for notification event types">
|
||||
title="Click for documentation">
|
||||
</i>
|
||||
Event Triggers
|
||||
</label>
|
||||
|
||||
@@ -26,9 +26,8 @@
|
||||
<div class="field-row">
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('enabled')"
|
||||
title="View documentation for this setting">
|
||||
</i>
|
||||
(click)="openFieldDocs('enabled')"
|
||||
title="Click for documentation"></i>
|
||||
Enable Queue Cleaner
|
||||
</label>
|
||||
<div class="field-input">
|
||||
@@ -41,9 +40,8 @@
|
||||
<div class="field-row">
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('useAdvancedScheduling')"
|
||||
title="View documentation for scheduling modes">
|
||||
</i>
|
||||
(click)="openFieldDocs('useAdvancedScheduling')"
|
||||
title="Click for documentation"></i>
|
||||
Scheduling Mode
|
||||
</label>
|
||||
<div class="field-input">
|
||||
@@ -95,9 +93,8 @@
|
||||
<div class="field-row" *ngIf="queueCleanerForm.get('useAdvancedScheduling')?.value">
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('cronExpression')"
|
||||
title="View cron expression documentation and examples">
|
||||
</i>
|
||||
(click)="openFieldDocs('cronExpression')"
|
||||
title="Click for documentation"></i>
|
||||
Cron Expression
|
||||
</label>
|
||||
<div>
|
||||
@@ -127,9 +124,8 @@
|
||||
<div class="field-row" formGroupName="failedImport">
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('failedImport.maxStrikes')"
|
||||
title="View documentation for failed import strike system">
|
||||
</i>
|
||||
(click)="openFieldDocs('failedImport.maxStrikes')"
|
||||
title="Click for documentation"></i>
|
||||
Max Strikes
|
||||
</label>
|
||||
<div class="field-input">
|
||||
@@ -150,9 +146,8 @@
|
||||
<div class="field-row" formGroupName="failedImport">
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('failedImport.ignorePrivate')"
|
||||
title="View documentation for private torrent handling">
|
||||
</i>
|
||||
(click)="openFieldDocs('failedImport.ignorePrivate')"
|
||||
title="Click for documentation"></i>
|
||||
Ignore Private
|
||||
</label>
|
||||
<div class="field-input">
|
||||
@@ -164,9 +159,8 @@
|
||||
<div class="field-row" formGroupName="failedImport">
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('failedImport.deletePrivate')"
|
||||
title="View documentation for private torrent deletion">
|
||||
</i>
|
||||
(click)="openFieldDocs('failedImport.deletePrivate')"
|
||||
title="Click for documentation"></i>
|
||||
Delete Private
|
||||
</label>
|
||||
<div class="field-input">
|
||||
@@ -178,9 +172,8 @@
|
||||
<div class="field-row" formGroupName="failedImport">
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('failedImport.ignoredPatterns')"
|
||||
title="View documentation for pattern matching and examples">
|
||||
</i>
|
||||
(click)="openFieldDocs('failedImport.ignoredPatterns')"
|
||||
title="Click for documentation"></i>
|
||||
Ignored Patterns
|
||||
</label>
|
||||
<div class="field-input">
|
||||
@@ -224,9 +217,8 @@
|
||||
<div class="field-row" formGroupName="stalled">
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('stalled.maxStrikes')"
|
||||
title="View documentation for stalled download strike system">
|
||||
</i>
|
||||
(click)="openFieldDocs('stalled.maxStrikes')"
|
||||
title="Click for documentation"></i>
|
||||
Max Strikes
|
||||
</label>
|
||||
<div>
|
||||
@@ -250,9 +242,8 @@
|
||||
<div class="field-row" formGroupName="stalled">
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('stalled.resetStrikesOnProgress')"
|
||||
title="View documentation for strike reset behavior">
|
||||
</i>
|
||||
(click)="openFieldDocs('stalled.resetStrikesOnProgress')"
|
||||
title="Click for documentation"></i>
|
||||
Reset Strikes On Progress
|
||||
</label>
|
||||
<div class="field-input">
|
||||
@@ -264,9 +255,8 @@
|
||||
<div class="field-row" formGroupName="stalled">
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('stalled.ignorePrivate')"
|
||||
title="View documentation for private torrent handling">
|
||||
</i>
|
||||
(click)="openFieldDocs('stalled.ignorePrivate')"
|
||||
title="Click for documentation"></i>
|
||||
Ignore Private
|
||||
</label>
|
||||
<div class="field-input">
|
||||
@@ -278,9 +268,8 @@
|
||||
<div class="field-row" formGroupName="stalled">
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('stalled.deletePrivate')"
|
||||
title="View documentation for private torrent deletion">
|
||||
</i>
|
||||
(click)="openFieldDocs('stalled.deletePrivate')"
|
||||
title="Click for documentation"></i>
|
||||
Delete Private
|
||||
</label>
|
||||
<div class="field-input">
|
||||
@@ -307,9 +296,8 @@
|
||||
<div class="field-row" formGroupName="stalled">
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('stalled.downloadingMetadataMaxStrikes')"
|
||||
title="View documentation for metadata download handling">
|
||||
</i>
|
||||
(click)="openFieldDocs('stalled.downloadingMetadataMaxStrikes')"
|
||||
title="Click for documentation"></i>
|
||||
Max Strikes for Downloading Metadata
|
||||
</label>
|
||||
<div>
|
||||
@@ -348,9 +336,8 @@
|
||||
<div class="field-row" formGroupName="slow">
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('slow.maxStrikes')"
|
||||
title="View documentation for slow download strike system">
|
||||
</i>
|
||||
(click)="openFieldDocs('slow.maxStrikes')"
|
||||
title="Click for documentation"></i>
|
||||
Max Strikes
|
||||
</label>
|
||||
<div>
|
||||
@@ -374,9 +361,8 @@
|
||||
<div class="field-row" formGroupName="slow">
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('slow.resetStrikesOnProgress')"
|
||||
title="View documentation for strike reset behavior">
|
||||
</i>
|
||||
(click)="openFieldDocs('slow.resetStrikesOnProgress')"
|
||||
title="Click for documentation"></i>
|
||||
Reset Strikes On Progress
|
||||
</label>
|
||||
<div class="field-input">
|
||||
@@ -388,9 +374,8 @@
|
||||
<div class="field-row" formGroupName="slow">
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('slow.ignorePrivate')"
|
||||
title="View documentation for private torrent handling">
|
||||
</i>
|
||||
(click)="openFieldDocs('slow.ignorePrivate')"
|
||||
title="Click for documentation"></i>
|
||||
Ignore Private
|
||||
</label>
|
||||
<div class="field-input">
|
||||
@@ -402,9 +387,8 @@
|
||||
<div class="field-row" formGroupName="slow">
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('slow.deletePrivate')"
|
||||
title="View documentation for private torrent deletion">
|
||||
</i>
|
||||
(click)="openFieldDocs('slow.deletePrivate')"
|
||||
title="Click for documentation"></i>
|
||||
Delete Private
|
||||
</label>
|
||||
<div class="field-input">
|
||||
@@ -416,9 +400,8 @@
|
||||
<div class="field-row" formGroupName="slow">
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('slow.minSpeed')"
|
||||
title="View speed threshold guidelines and recommendations">
|
||||
</i>
|
||||
(click)="openFieldDocs('slow.minSpeed')"
|
||||
title="Click for documentation"></i>
|
||||
Minimum Speed
|
||||
</label>
|
||||
<div class="field-input">
|
||||
@@ -435,9 +418,8 @@
|
||||
<div class="field-row" formGroupName="slow">
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('slow.maxTime')"
|
||||
title="View documentation for maximum slow download time">
|
||||
</i>
|
||||
(click)="openFieldDocs('slow.maxTime')"
|
||||
title="Click for documentation"></i>
|
||||
Maximum Time (hours)
|
||||
</label>
|
||||
<div class="field-input">
|
||||
@@ -457,9 +439,8 @@
|
||||
<div class="field-row" formGroupName="slow">
|
||||
<label class="field-label">
|
||||
<i class="pi pi-info-circle field-info-icon"
|
||||
(click)="openFieldDocs('slow.ignoreAboveSize')"
|
||||
title="View size exemption strategy and recommended thresholds">
|
||||
</i>
|
||||
(click)="openFieldDocs('slow.ignoreAboveSize')"
|
||||
title="Click for documentation"></i>
|
||||
Ignore Above Size
|
||||
</label>
|
||||
<div class="field-input">
|
||||
|
||||
@@ -262,21 +262,27 @@ export class QueueCleanerSettingsComponent implements OnDestroy, CanComponentDea
|
||||
advancedControl.valueChanges.pipe(takeUntil(this.destroy$))
|
||||
.subscribe((useAdvanced: boolean) => {
|
||||
const enabled = this.queueCleanerForm.get('enabled')?.value || false;
|
||||
if (enabled) {
|
||||
const cronExpressionControl = this.queueCleanerForm.get('cronExpression');
|
||||
const jobScheduleGroup = this.queueCleanerForm.get('jobSchedule') as FormGroup;
|
||||
const everyControl = jobScheduleGroup?.get('every');
|
||||
const typeControl = jobScheduleGroup?.get('type');
|
||||
|
||||
if (useAdvanced) {
|
||||
if (cronExpressionControl) cronExpressionControl.enable();
|
||||
if (everyControl) everyControl.disable();
|
||||
if (typeControl) typeControl.disable();
|
||||
} else {
|
||||
if (cronExpressionControl) cronExpressionControl.disable();
|
||||
if (everyControl) everyControl.enable();
|
||||
if (typeControl) typeControl.enable();
|
||||
}
|
||||
const cronExpressionControl = this.queueCleanerForm.get('cronExpression');
|
||||
const jobScheduleGroup = this.queueCleanerForm.get('jobSchedule') as FormGroup;
|
||||
const everyControl = jobScheduleGroup?.get('every');
|
||||
const typeControl = jobScheduleGroup?.get('type');
|
||||
|
||||
// Update scheduling controls based on mode, regardless of enabled state
|
||||
if (useAdvanced) {
|
||||
if (cronExpressionControl) cronExpressionControl.enable();
|
||||
if (everyControl) everyControl.disable();
|
||||
if (typeControl) typeControl.disable();
|
||||
} else {
|
||||
if (cronExpressionControl) cronExpressionControl.disable();
|
||||
if (everyControl) everyControl.enable();
|
||||
if (typeControl) typeControl.enable();
|
||||
}
|
||||
|
||||
// Then respect the main enabled state - if disabled, disable all scheduling controls
|
||||
if (!enabled) {
|
||||
cronExpressionControl?.disable();
|
||||
everyControl?.disable();
|
||||
typeControl?.disable();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -521,14 +527,17 @@ export class QueueCleanerSettingsComponent implements OnDestroy, CanComponentDea
|
||||
// Make a copy of the form values
|
||||
const formValue = this.queueCleanerForm.getRawValue();
|
||||
|
||||
// Determine the correct cron expression to use
|
||||
const cronExpression: string = formValue.useAdvancedScheduling ?
|
||||
formValue.cronExpression :
|
||||
// If in basic mode, generate cron expression from the schedule
|
||||
this.queueCleanerStore.generateCronExpression(formValue.jobSchedule);
|
||||
|
||||
// Create the config object to be saved
|
||||
const queueCleanerConfig: QueueCleanerConfig = {
|
||||
enabled: formValue.enabled,
|
||||
useAdvancedScheduling: formValue.useAdvancedScheduling,
|
||||
cronExpression: formValue.useAdvancedScheduling ?
|
||||
formValue.cronExpression :
|
||||
// If in basic mode, generate cron expression from the schedule
|
||||
this.queueCleanerStore.generateCronExpression(formValue.jobSchedule),
|
||||
cronExpression: cronExpression,
|
||||
jobSchedule: formValue.jobSchedule,
|
||||
failedImport: {
|
||||
maxStrikes: formValue.failedImport?.maxStrikes || 0,
|
||||
|
||||
Reference in New Issue
Block a user