feat(app): Jobs › Scheduled and the desktop scheduler

Owner review 2, R10 on the desktop: every timer that queued work out of
sight is now a visible, editable schedule of this PC.

- DesktopScheduleHost implements IScheduleHost: the PC's time zone, the
  archive at Settings › Archive's folder (refreshed from archive.json,
  none while it is offline), and three system schedules: archive-scan
  (every:<ScanIntervalMinutes>m, seeded once from the old setting, no
  catch-up), index-backup (every day with catch-up, replacing
  DatabaseBackups.RunDailyAsync) and housekeeping (daily 04:00 with
  catch-up: job history 90 days and the new cache-trim step).
- AppServices starts the Scheduler after the engine, once the archive was
  reopened; an unplugged archive is looked for every minute and the
  scheduler woken when it is back. The rescan loop and the daily backup
  loop are gone; ApplyJobSettings wakes the scheduler.
- CacheStore.Trim brings the cache to Settings › Storage › Cache limit,
  oldest files first, skipping files in use and the proxies, render-node
  and server-import folders; CacheTrimStep runs it as a clean-up step.
- Jobs gets a Queue | Scheduled segmented control. Scheduled lists the
  schedules (switch, name, action, when, next run, last result) with Run
  now, Edit, Reset (system) or Delete (user's, confirmed), the selected
  schedule's last runs with Show in queue, and an in-window editor that
  checks every field with the scheduler's limits. Jobs a schedule queued
  carry a "Scheduled" pill; the history line follows the housekeeping's
  job-history days.
- JobNotices: a scheduled background run raises a toast only when it
  fails (upkeep stays silent).
- Settings › Archive › Rescan every is removed; ScanIntervalMinutes stays
  only as the seed. Strings in en and it; the others are retranslated.
- The capture shows jobs-scheduled and jobs-schedule-editor on a stopped
  scheduler clock with sample schedules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit e25d812feb3f417cb9251c748c29e8035fd9b03c)
This commit is contained in:
Alby96 committed 2026-10-27 02:26:07 +01:00
1 parent 75daab7275
commit bc786c12c4
108 files changed
+3724 -490

No files matched your search

+27
View File
@@ -70,6 +70,9 @@ public static class ScreenCapture
await sample.FillAsync();
await shell.Library.RefreshAsync();
await shell.Jobs.ReloadAsync();
// The sample wrote its schedules into the index, past the scheduler's events.
await shell.Jobs.Schedules.Attached;
await shell.Jobs.Schedules.ReloadAsync();
await shell.Services.Server.RestoreAsync();
await shell.Services.Sync.RefreshAsync();
await shell.Server.Sync.ReloadAsync();
@@ -103,6 +106,7 @@ public static class ScreenCapture
shell.Navigate(SectionKey.Jobs);
if (shell.Jobs.Rows.Count > 0) shell.Jobs.Rows[0].IsExpanded = true;
written += await SaveAsync(window, directory, "jobs", theme);
written += await CaptureSchedulesAsync(window, shell, directory, theme);
shell.Navigate(SectionKey.Server);
written += await SaveAsync(window, directory, "server", theme);
@@ -195,6 +199,29 @@ public static class ScreenCapture
return written;
}
/// <summary>
/// <c>jobs-scheduled</c> (owner review 2, R10: the Scheduled tab with the weekly integrity check selected and its last
/// run) and <c>jobs-schedule-editor</c> (that schedule in the editor), then the Queue tab again.
/// </summary>
private static async Task<int> CaptureSchedulesAsync(MainWindow window, ShellViewModel shell, string directory, AppTheme theme)
{
var schedules = shell.Jobs.Schedules;
shell.Jobs.TabIndex = 1;
var written = 0;
if ((schedules.Rows.FirstOrDefault(r => !r.IsSystem && r.IsEnabled) ?? schedules.Rows.FirstOrDefault()) is { } row)
{
schedules.Selected = row;
await schedules.RunsLoading;
written += await SaveAsync(window, directory, "jobs-scheduled", theme);
row.EditCommand.Execute(null);
written += await SaveAsync(window, directory, "jobs-schedule-editor", theme);
schedules.Editor?.CloseCommand.Execute(null);
schedules.Selected = null;
}
shell.Jobs.TabIndex = 0;
return written;
}
private static void SelectSyncFilter(ShellViewModel shell, SyncFilter filter) =>
shell.Server.Sync.Chips.First(c => c.Filter == filter).SelectCommand.Execute(null);
+4 -1
View File
@@ -1,12 +1,15 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:Chronos.App.Sections">
xmlns:s="clr-namespace:Chronos.App.Sections"
xmlns:j="clr-namespace:Chronos.App.Jobs">
<!-- Section view model → view. -->
<DataTemplate DataType="{x:Type s:LibraryViewModel}"><s:LibraryView /></DataTemplate>
<DataTemplate DataType="{x:Type s:ImportViewModel}"><s:ImportView /></DataTemplate>
<DataTemplate DataType="{x:Type s:SequenceViewModel}"><s:SequenceView /></DataTemplate>
<DataTemplate DataType="{x:Type s:ArchiveViewModel}"><s:ArchiveView /></DataTemplate>
<DataTemplate DataType="{x:Type s:JobsViewModel}"><s:JobsView /></DataTemplate>
<!-- Jobs › Scheduled, the second tab of Jobs (owner review 2, R10). -->
<DataTemplate DataType="{x:Type j:SchedulesViewModel}"><s:SchedulesView /></DataTemplate>
<DataTemplate DataType="{x:Type s:ServerViewModel}"><s:ServerView /></DataTemplate>
<DataTemplate DataType="{x:Type s:SettingsViewModel}"><s:SettingsView /></DataTemplate>
</ResourceDictionary>