-
Changes to any of the below requires you to restart Ombi.
+
Changes to any of the below requires you to restart Ombi.
+
You can generate valid CRON Expressions here: http://www.cronmaker.com/
@@ -121,9 +122,3 @@
-
-
-
- - {{item | date:'short'}}
-
-
diff --git a/src/Ombi/ClientApp/app/settings/jobs/jobs.component.ts b/src/Ombi/ClientApp/app/settings/jobs/jobs.component.ts
index 747a4bfde..1a543f885 100644
--- a/src/Ombi/ClientApp/app/settings/jobs/jobs.component.ts
+++ b/src/Ombi/ClientApp/app/settings/jobs/jobs.component.ts
@@ -3,8 +3,6 @@
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { NotificationService, SettingsService } from "../../services";
-import { ICronTestModel } from "../../interfaces";
-
@Component({
templateUrl: "./jobs.component.html",
})
@@ -13,8 +11,6 @@ export class JobsComponent implements OnInit {
public form: FormGroup;
public profilesRunning: boolean;
- public testModel: ICronTestModel;
- public displayTest: boolean;
constructor(private readonly settingsService: SettingsService,
private readonly fb: FormBuilder,
@@ -44,9 +40,8 @@ export class JobsComponent implements OnInit {
public testCron(expression: string) {
this.settingsService.testCron({ expression }).subscribe(x => {
- if(x.success) {
- this.testModel = x;
- this.displayTest = true;
+ if(x.success) {
+ this.notificationService.success("Cron is Valid");
} else {
this.notificationService.error(x.message);
}
diff --git a/src/Ombi/Controllers/SettingsController.cs b/src/Ombi/Controllers/SettingsController.cs
index e8f4154b8..ebc2fbe66 100644
--- a/src/Ombi/Controllers/SettingsController.cs
+++ b/src/Ombi/Controllers/SettingsController.cs
@@ -28,6 +28,7 @@ using Ombi.Store.Repository;
using Ombi.Api.Github;
using Ombi.Core.Engine;
using Ombi.Schedule;
+using Quartz;
namespace Ombi.Controllers
{
@@ -546,8 +547,8 @@ namespace Ombi.Controllers
try
{
- var r = CrontabSchedule.TryParse(expression);
- if (r == null)
+ var isValid = CronExpression.IsValidExpression(expression);
+ if (!isValid)
{
return new JobSettingsViewModel
{
@@ -577,14 +578,15 @@ namespace Ombi.Controllers
var model = new CronTestModel();
try
{
- var time = DateTime.UtcNow;
- var result = CrontabSchedule.TryParse(body.Expression);
- for (int i = 0; i < 10; i++)
+ var isValid = CronExpression.IsValidExpression(body.Expression);
+ if (!isValid)
{
- var next = result.GetNextOccurrence(time);
- model.Schedule.Add(next);
- time = next;
+ return new CronTestModel
+ {
+ Message = $"CRON Expression {body.Expression} is not valid"
+ };
}
+
model.Success = true;
return model;
}
@@ -595,8 +597,6 @@ namespace Ombi.Controllers
Message = $"CRON Expression {body.Expression} is not valid"
};
}
-
-
}
diff --git a/src/Ombi/Models/CronTestModel.cs b/src/Ombi/Models/CronTestModel.cs
index 9698afbff..d8193aef5 100644
--- a/src/Ombi/Models/CronTestModel.cs
+++ b/src/Ombi/Models/CronTestModel.cs
@@ -7,6 +7,5 @@ namespace Ombi.Models
{
public bool Success { get; set; }
public string Message { get; set; }
- public List
Schedule { get; set; } = new List();
}
}
\ No newline at end of file