diff --git a/Source/Examples/AspNetCoreHost/Startup.cs b/Source/Examples/AspNetCoreHost/Startup.cs index 5426768..912338b 100644 --- a/Source/Examples/AspNetCoreHost/Startup.cs +++ b/Source/Examples/AspNetCoreHost/Startup.cs @@ -14,6 +14,7 @@ public void Configure(IApplicationBuilder app) { app.UseQuartzmin(new QuartzminOptions() { + UseLocalTime = true, Scheduler = DemoScheduler.Create().Result, }); } diff --git a/Source/Examples/NetCoreSelfHost/app.config b/Source/Examples/NetCoreSelfHost/app.config index 1a13585..0894cc7 100644 --- a/Source/Examples/NetCoreSelfHost/app.config +++ b/Source/Examples/NetCoreSelfHost/app.config @@ -10,5 +10,7 @@ + + diff --git a/Source/Examples/WinFormSelfHost/App.config b/Source/Examples/WinFormSelfHost/App.config index b1bef7f..3dad863 100644 --- a/Source/Examples/WinFormSelfHost/App.config +++ b/Source/Examples/WinFormSelfHost/App.config @@ -14,6 +14,8 @@ + + diff --git a/Source/Quartz.Plugins.RecentHistory/ExecutionHistoryPlugin.cs b/Source/Quartz.Plugins.RecentHistory/ExecutionHistoryPlugin.cs index 6729b29..0eaed33 100644 --- a/Source/Quartz.Plugins.RecentHistory/ExecutionHistoryPlugin.cs +++ b/Source/Quartz.Plugins.RecentHistory/ExecutionHistoryPlugin.cs @@ -23,7 +23,7 @@ public class ExecutionHistoryPlugin : ISchedulerPlugin, IJobListener return Task.FromResult(0); } - public async Task Start(CancellationToken cancellationToken = default(CancellationToken)) + public Task Start(CancellationToken cancellationToken = default(CancellationToken)) { _store = _scheduler.Context.GetExecutionHistoryStore(); @@ -40,7 +40,7 @@ public class ExecutionHistoryPlugin : ISchedulerPlugin, IJobListener _store.SchedulerName = _scheduler.SchedulerName; - await _store.Purge(); + return _store.Purge(); } public Task Shutdown(CancellationToken cancellationToken = default(CancellationToken)) @@ -48,7 +48,7 @@ public class ExecutionHistoryPlugin : ISchedulerPlugin, IJobListener return Task.FromResult(0); } - public async Task JobToBeExecuted(IJobExecutionContext context, CancellationToken cancellationToken = default(CancellationToken)) + public Task JobToBeExecuted(IJobExecutionContext context, CancellationToken cancellationToken = default(CancellationToken)) { var entry = new ExecutionHistoryEntry() { @@ -61,7 +61,7 @@ public class ExecutionHistoryPlugin : ISchedulerPlugin, IJobListener Job = context.JobDetail.Key.ToString(), Trigger = context.Trigger.Key.ToString(), }; - await _store.Save(entry); + return _store.Save(entry); } public async Task JobWasExecuted(IJobExecutionContext context, JobExecutionException jobException, CancellationToken cancellationToken = default(CancellationToken)) diff --git a/Source/Quartz.Plugins.RecentHistory/Impl/InProcExecutionHistoryStore.cs b/Source/Quartz.Plugins.RecentHistory/Impl/InProcExecutionHistoryStore.cs index f1d6621..745565a 100644 --- a/Source/Quartz.Plugins.RecentHistory/Impl/InProcExecutionHistoryStore.cs +++ b/Source/Quartz.Plugins.RecentHistory/Impl/InProcExecutionHistoryStore.cs @@ -23,8 +23,8 @@ public Task Get(string fireInstanceId) { if (_data.TryGetValue(fireInstanceId, out var entry)) return Task.FromResult(entry); - else - return Task.FromResult(null); ; + return Task.FromResult(null); + } } diff --git a/Source/Quartzmin.SelfHost/QuartzminPlugin.cs b/Source/Quartzmin.SelfHost/QuartzminPlugin.cs index 949feaa..35f3acc 100644 --- a/Source/Quartzmin.SelfHost/QuartzminPlugin.cs +++ b/Source/Quartzmin.SelfHost/QuartzminPlugin.cs @@ -18,6 +18,8 @@ public class QuartzminPlugin : ISchedulerPlugin public string DefaultDateFormat { get; set; } public string DefaultTimeFormat { get; set; } + public bool UseLocalTime { get; set; } + public string Logo { get; set; } public string ProductName { get; set; } @@ -31,7 +33,7 @@ public class QuartzminPlugin : ISchedulerPlugin } #if NETSTANDARD - public async Task Start(CancellationToken cancellationToken = default(CancellationToken)) + public Task Start(CancellationToken cancellationToken = default(CancellationToken)) { var host = Microsoft.AspNetCore.WebHost.CreateDefaultBuilder().Configure(app => { app.UseQuartzmin(CreateQuartzminOptions()); @@ -46,7 +48,7 @@ public class QuartzminPlugin : ISchedulerPlugin _webApp = host; - await host.StartAsync(); + return host.StartAsync(); } #endif @@ -81,6 +83,9 @@ private QuartzminOptions CreateQuartzminOptions() if (!string.IsNullOrEmpty(ProductName)) options.ProductName = ProductName; + if (UseLocalTime) + options.UseLocalTime = UseLocalTime; + return options; } diff --git a/Source/Quartzmin/Controllers/SchedulerController.cs b/Source/Quartzmin/Controllers/SchedulerController.cs index 6ad4529..0f65c58 100644 --- a/Source/Quartzmin/Controllers/SchedulerController.cs +++ b/Source/Quartzmin/Controllers/SchedulerController.cs @@ -63,6 +63,7 @@ public async Task Index() History = histogram, MetaData = metadata, RunningSince = metadata.RunningSince?.UtcDateTime.ToDefaultFormat() ?? "N / A", + UtcLabel = DateTimeSettings.UseLocalTime ? string.Empty : "UTC", Environment.MachineName, Application = Environment.CommandLine, JobsCount = jobKeys.Count, diff --git a/Source/Quartzmin/DateTimeSettings.cs b/Source/Quartzmin/DateTimeSettings.cs index 19cf1d3..3faed13 100644 --- a/Source/Quartzmin/DateTimeSettings.cs +++ b/Source/Quartzmin/DateTimeSettings.cs @@ -4,5 +4,6 @@ internal static class DateTimeSettings { public static string DefaultDateFormat { get; set; } = "MM/dd/yyyy"; public static string DefaultTimeFormat { get; set; } = "HH:mm:ss"; + public static bool UseLocalTime { get; set; } = false; } } diff --git a/Source/Quartzmin/Extensions.cs b/Source/Quartzmin/Extensions.cs index 9fbe948..bd738aa 100644 --- a/Source/Quartzmin/Extensions.cs +++ b/Source/Quartzmin/Extensions.cs @@ -37,7 +37,12 @@ public static JobDataMapItemBase[] GetModel(this IEnumerable ToDictionary(this IEnumerable timeZoneInfos) diff --git a/Source/Quartzmin/QuartzminOptions.cs b/Source/Quartzmin/QuartzminOptions.cs index a3c8ef9..422c689 100644 --- a/Source/Quartzmin/QuartzminOptions.cs +++ b/Source/Quartzmin/QuartzminOptions.cs @@ -44,6 +44,12 @@ public string DefaultTimeFormat set => DateTimeSettings.DefaultTimeFormat = value; } + public bool UseLocalTime + { + get => DateTimeSettings.UseLocalTime; + set => DateTimeSettings.UseLocalTime = value; + } + public QuartzminOptions() { DefaultSelectedType = new StringHandler() { Name = "String" }; @@ -70,6 +76,7 @@ public QuartzminOptions() string.IsNullOrEmpty(SitePhysicalDirectory) ? null : Path.Combine(SitePhysicalDirectory, "Content"); internal string ViewsRootDirectory => string.IsNullOrEmpty(SitePhysicalDirectory) ? null : Path.Combine(SitePhysicalDirectory, "Views"); + #else internal string ContentRootDirectory => null; internal string ViewsRootDirectory => null; diff --git a/Source/Quartzmin/Views/Scheduler/Index.hbs b/Source/Quartzmin/Views/Scheduler/Index.hbs index f567058..2690850 100644 --- a/Source/Quartzmin/Views/Scheduler/Index.hbs +++ b/Source/Quartzmin/Views/Scheduler/Index.hbs @@ -52,7 +52,7 @@ Running Since - {{RunningSince}} UTC + {{RunningSince}} {{UtcLabel}} Shutdown