mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 12:59:39 -07:00
Reset all of the schedules due to Quartz using a different CRON system. Updated the UI code to reflect this
This commit is contained in:
parent
8f50213867
commit
59e26aaa2d
8 changed files with 85 additions and 27 deletions
50
src/Ombi.Store/Migrations/Settings/20190416204533_ResetSchedules.Designer.cs
generated
Normal file
50
src/Ombi.Store/Migrations/Settings/20190416204533_ResetSchedules.Designer.cs
generated
Normal file
|
@ -0,0 +1,50 @@
|
|||
// <auto-generated />
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Ombi.Store.Context;
|
||||
|
||||
namespace Ombi.Store.Migrations.Settings
|
||||
{
|
||||
[DbContext(typeof(SettingsContext))]
|
||||
[Migration("20190416204533_ResetSchedules")]
|
||||
partial class ResetSchedules
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "2.2.2-servicing-10034");
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.ApplicationConfiguration", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("Type");
|
||||
|
||||
b.Property<string>("Value");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ApplicationConfiguration");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.GlobalSettings", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("Content");
|
||||
|
||||
b.Property<string>("SettingsName");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("GlobalSettings");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Ombi.Store.Migrations.Settings
|
||||
{
|
||||
public partial class ResetSchedules : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.Sql(@"
|
||||
DELETE FROM GlobalSettings
|
||||
WHERE SettingsName = 'JobSettings'
|
||||
");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,7 +13,7 @@ namespace Ombi.Store.Migrations.Settings
|
|||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "2.2.0-rtm-35687");
|
||||
.HasAnnotation("ProductVersion", "2.2.2-servicing-10034");
|
||||
|
||||
modelBuilder.Entity("Ombi.Store.Entities.ApplicationConfiguration", b =>
|
||||
{
|
||||
|
|
|
@ -222,7 +222,6 @@ export interface IIssueCategory extends ISettings {
|
|||
export interface ICronTestModel {
|
||||
success: boolean;
|
||||
message: string;
|
||||
schedule: Date[];
|
||||
}
|
||||
|
||||
export interface ICronViewModelBody {
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
<legend>Job Settings</legend>
|
||||
<form novalidate [formGroup]="form" (ngSubmit)="onSubmit(form)" style="padding-top:5%;">
|
||||
<div class="col-md-6">
|
||||
<small>Changes to any of the below requires you to restart Ombi.</small>
|
||||
<small>Changes to any of the below requires you to restart Ombi. </small>
|
||||
<small>You can generate valid CRON Expressions here: <a href="http://www.cronmaker.com/" target="_blank">http://www.cronmaker.com/</a></small>
|
||||
<div class="form-group">
|
||||
<label for="sonarrSync" class="control-label">Sonarr Sync</label>
|
||||
<input type="text" class="form-control form-control-custom" [ngClass]="{'form-error': form.get('sonarrSync').hasError('required')}" id="sonarrSync" name="sonarrSync" formControlName="sonarrSync">
|
||||
|
@ -121,9 +122,3 @@
|
|||
</form>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<p-dialog header="CRON Schedule" [(visible)]="displayTest">
|
||||
<ul *ngIf="testModel">
|
||||
<li *ngFor="let item of testModel.schedule">{{item | date:'short'}}</li>
|
||||
</ul>
|
||||
</p-dialog>
|
||||
|
|
|
@ -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,
|
||||
|
@ -45,8 +41,7 @@ export class JobsComponent implements OnInit {
|
|||
public testCron(expression: string) {
|
||||
this.settingsService.testCron({ expression }).subscribe(x => {
|
||||
if(x.success) {
|
||||
this.testModel = x;
|
||||
this.displayTest = true;
|
||||
this.notificationService.success("Cron is Valid");
|
||||
} else {
|
||||
this.notificationService.error(x.message);
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,6 +7,5 @@ namespace Ombi.Models
|
|||
{
|
||||
public bool Success { get; set; }
|
||||
public string Message { get; set; }
|
||||
public List<DateTime> Schedule { get; set; } = new List<DateTime>();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue