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
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "2.2.0-rtm-35687");
|
.HasAnnotation("ProductVersion", "2.2.2-servicing-10034");
|
||||||
|
|
||||||
modelBuilder.Entity("Ombi.Store.Entities.ApplicationConfiguration", b =>
|
modelBuilder.Entity("Ombi.Store.Entities.ApplicationConfiguration", b =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -222,7 +222,6 @@ export interface IIssueCategory extends ISettings {
|
||||||
export interface ICronTestModel {
|
export interface ICronTestModel {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
message: string;
|
message: string;
|
||||||
schedule: Date[];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ICronViewModelBody {
|
export interface ICronViewModelBody {
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
<legend>Job Settings</legend>
|
<legend>Job Settings</legend>
|
||||||
<form novalidate [formGroup]="form" (ngSubmit)="onSubmit(form)" style="padding-top:5%;">
|
<form novalidate [formGroup]="form" (ngSubmit)="onSubmit(form)" style="padding-top:5%;">
|
||||||
<div class="col-md-6">
|
<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">
|
<div class="form-group">
|
||||||
<label for="sonarrSync" class="control-label">Sonarr Sync</label>
|
<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">
|
<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>
|
</form>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</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 { FormBuilder, FormGroup, Validators } from "@angular/forms";
|
||||||
import { NotificationService, SettingsService } from "../../services";
|
import { NotificationService, SettingsService } from "../../services";
|
||||||
|
|
||||||
import { ICronTestModel } from "../../interfaces";
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: "./jobs.component.html",
|
templateUrl: "./jobs.component.html",
|
||||||
})
|
})
|
||||||
|
@ -13,8 +11,6 @@ export class JobsComponent implements OnInit {
|
||||||
public form: FormGroup;
|
public form: FormGroup;
|
||||||
|
|
||||||
public profilesRunning: boolean;
|
public profilesRunning: boolean;
|
||||||
public testModel: ICronTestModel;
|
|
||||||
public displayTest: boolean;
|
|
||||||
|
|
||||||
constructor(private readonly settingsService: SettingsService,
|
constructor(private readonly settingsService: SettingsService,
|
||||||
private readonly fb: FormBuilder,
|
private readonly fb: FormBuilder,
|
||||||
|
@ -44,9 +40,8 @@ export class JobsComponent implements OnInit {
|
||||||
|
|
||||||
public testCron(expression: string) {
|
public testCron(expression: string) {
|
||||||
this.settingsService.testCron({ expression }).subscribe(x => {
|
this.settingsService.testCron({ expression }).subscribe(x => {
|
||||||
if(x.success) {
|
if(x.success) {
|
||||||
this.testModel = x;
|
this.notificationService.success("Cron is Valid");
|
||||||
this.displayTest = true;
|
|
||||||
} else {
|
} else {
|
||||||
this.notificationService.error(x.message);
|
this.notificationService.error(x.message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ using Ombi.Store.Repository;
|
||||||
using Ombi.Api.Github;
|
using Ombi.Api.Github;
|
||||||
using Ombi.Core.Engine;
|
using Ombi.Core.Engine;
|
||||||
using Ombi.Schedule;
|
using Ombi.Schedule;
|
||||||
|
using Quartz;
|
||||||
|
|
||||||
namespace Ombi.Controllers
|
namespace Ombi.Controllers
|
||||||
{
|
{
|
||||||
|
@ -546,8 +547,8 @@ namespace Ombi.Controllers
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var r = CrontabSchedule.TryParse(expression);
|
var isValid = CronExpression.IsValidExpression(expression);
|
||||||
if (r == null)
|
if (!isValid)
|
||||||
{
|
{
|
||||||
return new JobSettingsViewModel
|
return new JobSettingsViewModel
|
||||||
{
|
{
|
||||||
|
@ -577,14 +578,15 @@ namespace Ombi.Controllers
|
||||||
var model = new CronTestModel();
|
var model = new CronTestModel();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var time = DateTime.UtcNow;
|
var isValid = CronExpression.IsValidExpression(body.Expression);
|
||||||
var result = CrontabSchedule.TryParse(body.Expression);
|
if (!isValid)
|
||||||
for (int i = 0; i < 10; i++)
|
|
||||||
{
|
{
|
||||||
var next = result.GetNextOccurrence(time);
|
return new CronTestModel
|
||||||
model.Schedule.Add(next);
|
{
|
||||||
time = next;
|
Message = $"CRON Expression {body.Expression} is not valid"
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
model.Success = true;
|
model.Success = true;
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
@ -595,8 +597,6 @@ namespace Ombi.Controllers
|
||||||
Message = $"CRON Expression {body.Expression} is not valid"
|
Message = $"CRON Expression {body.Expression} is not valid"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,5 @@ namespace Ombi.Models
|
||||||
{
|
{
|
||||||
public bool Success { get; set; }
|
public bool Success { get; set; }
|
||||||
public string Message { 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