feat(jobs): show what mass passes do now on the desktop, the server section and the admin panel

A running job now says what it does now: "Verifying photo 812 of 2,400 · Harbour sunset · sequence 3 of 41". A paused or
failed job says where it stopped. The line appears in the Jobs table under the target, in the job bar (at most 60
characters, the item dropped first, the bar text also its tooltip), in the Archive's recent maintenance (refreshed at
most twice a second), in the editor's server-job line and in the sync tooltip. Byte jobs now count sizes in the bar.

While connected, the Server section lists the server's running and paused jobs, live through the jobs API and the
jobProgress events. Pause, Resume and Cancel are offered only to an account that manages the archive, which is what
the server requires to act on someone else's job; for any other account the list is read-only. The list hides while
nothing runs, and the capture gains a server-jobs scene.

The admin panel's Jobs page and dashboard show the same line under the target and update it with every progress event.
The steps, parts and sub-steps are in English and Italian, and an unknown step shows its counts only.

Refs #65

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-15 13:42:47 +01:00
1 parent ee9505df22
commit b95bc997d5
36 files changed
+1895 -28

No files matched your search

@@ -386,6 +386,35 @@ public sealed class RemoteSequenceSourceTests(TestContext context)
Assert.True(api.Disposed, "closing the editor closes its connection");
}
[Test]
public async Task TheServersJobSaysWhatItDoesNow()
{
Loc.SetCulture(System.Globalization.CultureInfo.GetCultureInfo("en"));
var (source, api, _) = Open();
await using (source)
{
await source.LoadAsync(context.Cancellation);
var seen = new List<Job>();
source.JobChanged += job =>
{
lock (seen) seen.Add(job);
};
var id = Guid.CreateVersion7();
api.Jobs[id] = api.Job(id, "render", "running");
api.Publish(new JobStateEvent(id, "running", null));
await WaitAsync(() => Last(seen).Id == id);
// Owner review 5, #65: the progress event carries the step, and an older server's event without one keeps it.
api.Publish(new JobProgressEvent(id, 40, 300, 11.3, 20, new JobDetailDto("encode", null, 40, 300)));
await WaitAsync(() => Last(seen).ProgressDone == 40);
Assert.Equal(new JobDetail(JobStep.Encode, null, 40, 300), Last(seen).Detail);
Assert.Contains("Encoding frame 40 of 300", EditorText.ServerJobDetail(Last(seen), "Studio NAS"));
api.Publish(new JobProgressEvent(id, 41, 300, 11.3, 19));
await WaitAsync(() => Last(seen).ProgressDone == 41);
Assert.Equal(JobStep.Encode, Last(seen).Detail?.Step);
}
}
[Test]
public async Task ASequenceGoneFromTheServerReadsAsMissing()
{
@@ -0,0 +1,171 @@
using System.Globalization;
using Chronos.App.Infrastructure;
using Chronos.App.Jobs;
using Chronos.Core.Localization;
using Chronos.Core.Model;
using Chronos.Data.Jobs;
using Chronos.Testing;
namespace Chronos.App.Tests.Jobs;
/// <summary>The status line of a running job (owner review 5, #65): what it does now, in the job bar, the Jobs table and the tooltips.</summary>
public sealed class JobTextTests
{
private static readonly DateTimeOffset T0 = new(2026, 9, 28, 10, 0, 0, TimeSpan.Zero);
[Test]
public void TheStatusLineSaysStepItemAndPart()
{
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
var verify = new JobDetail(JobStep.Verify, "Harbour sunset", 812, 2_400, 3, 41, JobPartUnit.Sequence);
Assert.Equal("Verifying photo 812 of 2,400 · Harbour sunset · sequence 3 of 41", JobText.Status(verify));
// Not counted: the step word alone; a single part is not said.
Assert.Equal("Listing folders", JobText.Status(new JobDetail(JobStep.List)));
Assert.Equal("Encoding frame 10 of 300", JobText.Status(new JobDetail(JobStep.Encode, null, 10, 300, 1, 1, JobPartUnit.Render)));
// A part without a unit is counted plainly.
Assert.Equal("Analysing · Lake · 120 of 4,812", JobText.Status(new JobDetail(JobStep.Analyse, "Lake", Part: 120, Parts: 4_812)));
Assert.Equal(string.Empty, JobText.Status(null));
}
[Test]
public void EveryStepAndPartHasItsWordsInEnglishAndItalian()
{
foreach (var culture in new[] { "en", "it" })
{
var c = CultureInfo.GetCultureInfo(culture);
foreach (var step in Enum.GetValues<JobStep>().Where(s => s != JobStep.None))
Assert.True(Loc.Get("Jobs.Step." + step, c) is not null, $"{culture} {step}");
foreach (var unit in Enum.GetValues<JobPartUnit>().Where(u => u != JobPartUnit.None))
Assert.True(Loc.Get("Jobs.Part." + unit, c) is not null, $"{culture} {unit}");
foreach (var sub in new[] { "Leases", "Temp", "Packs", "Duplicates", "Vacuum" })
Assert.True(Loc.Get("Jobs.Maintenance.Step." + sub, c) is not null, $"{culture} {sub}");
}
}
[Test]
public void SubStepsNameThemselvesAndUnknownOnesShowCountsOnly()
{
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
Assert.Equal("Compacting thumbnails · step 3 of 5", JobText.Status(new JobDetail(JobStep.Maintenance, "packs", Part: 3, Parts: 5, PartUnit: JobPartUnit.Step)));
Assert.Equal("Job history", JobText.Status(new JobDetail(JobStep.Cleanup, "job-history")));
// A sub-step key of a newer server is never shown as text.
Assert.Equal("Maintenance · step 6 of 6", JobText.Status(new JobDetail(JobStep.Maintenance, "re-index", Part: 6, Parts: 6, PartUnit: JobPartUnit.Step)));
// A step this build does not know (JobStep.None from the wire) shows its counts and item only.
Assert.Equal("4 of 10 · Lake", JobText.Status(new JobDetail(JobStep.None, "Lake", 4, 10)));
Assert.Equal(JobStep.None, JobWire.FromDto(new Chronos.Protocol.JobDetailDto("teleport", "Lake", 4, 10))!.Step);
}
[Test]
public void FoldersStayLeftToRight()
{
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
var status = JobText.Status(new JobDetail(JobStep.Index, "2024/2024-09-27 Harbour", 1, 2));
Assert.Contains(Formatting.LeftToRight("2024/2024-09-27 Harbour"), status);
}
[Test]
public void ALongLineDropsTheItemFirstThenIsCut()
{
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
var detail = new JobDetail(JobStep.Verify, new string('x', 120), 812, 2_400, 3, 41, JobPartUnit.Sequence);
Assert.Equal("Verifying photo 812 of 2,400 · sequence 3 of 41", JobText.Status(detail, JobText.BarStatusLength));
var cut = JobText.Status(detail, 20);
Assert.Equal(20, cut.Length);
Assert.True(cut.EndsWith('…'));
// A cut folder island is closed again.
var folder = JobText.Status(new JobDetail(JobStep.Index, "2024/" + new string('y', 80)), 30);
Assert.Equal(folder.Count(c => c == '‪'), folder.Count(c => c == '‬'));
}
[Test]
public void TheBarSaysWhatTheJobDoesNow()
{
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
var job = Job(JobKind.Verify, JobState.Running, "Harbour sunset") with
{
Detail = new JobDetail(JobStep.Verify, "Harbour sunset", 812, 2_400, 3, 41, JobPartUnit.Sequence),
};
// The bar keeps 60 characters of the line: the item (already the target here) goes first.
var entry = new JobEntry(job);
Assert.Equal("Verify · Harbour sunset · Verifying photo 812 of 2,400 · sequence 3 of 41", JobText.Bar(entry));
// Without a detail the counter stays, in bytes for a byte job.
var bytes = new JobEntry(Job(JobKind.Import, JobState.Running, "Card") with { ProgressDone = 2_000_000, ProgressTotal = 8_000_000 });
Assert.Equal($"Import · Card · {Formatting.Bytes(2_000_000)} / {Formatting.Bytes(8_000_000)}", JobText.Bar(bytes));
Assert.Equal("3 / 9", JobText.Counter(JobKind.Scan, 3, 9));
}
[Test]
public void LiveDetailWinsAndStoppedJobsSayWhere()
{
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
var job = Job(JobKind.Thumbs, JobState.Running, "Lake") with { Detail = new JobDetail(JobStep.Thumbs, "Lake", 1, 10) };
var entry = new JobEntry(job)
{
Live = new JobProgressInfo(job.Id, job.Kind, "Lake", 5, 10, 2.5, TimeSpan.FromMinutes(2), null, new JobDetail(JobStep.Thumbs, "Lake", 5, 10)),
};
Assert.Equal("Thumbnail 5 of 10 · Lake", JobText.RowStatus(entry));
Assert.Equal("Thumbnail 5 of 10 · Lake · 2.5 fps · 2 min left", JobText.RowStatusToolTip(entry));
var paused = new JobEntry(job with { State = JobState.Paused });
Assert.Equal("Stopped at Thumbnail 1 of 10 · Lake", JobText.RowStatus(paused));
Assert.Equal(string.Empty, JobText.RowStatus(new JobEntry(job with { State = JobState.Queued })));
Assert.Equal(string.Empty, JobText.RowStatus(new JobEntry(job with { State = JobState.Done })));
}
[Test]
public void RecentMaintenanceFollowsLiveProgress()
{
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
var verify = Job(JobKind.Verify, JobState.Running, "ChronosArchive") with { ProgressDone = 10, ProgressTotal = 100 };
var scan = Job(JobKind.Scan, JobState.Paused, "Archive") with { Detail = new JobDetail(JobStep.Index, null, 4, 9) };
var live = new Dictionary<Guid, JobProgressInfo>
{
[verify.Id] = new(verify.Id, verify.Kind, null, 71, 100, null, null, null, new JobDetail(JobStep.Verify, "Harbour sunset", 3, 9)),
// Progress of a job that is not running is not shown.
[scan.Id] = new(scan.Id, scan.Kind, null, 99, 100, null, null, null, new JobDetail(JobStep.Index, null, 8, 9)),
};
var recent = Chronos.App.Archiving.MaintenanceReports.Recent([verify, scan], 5, live);
var running = recent.Single(r => r.JobId == verify.Id);
Assert.Equal("71 %", running.StateText);
Assert.Equal("Verifying photo 3 of 9 · Harbour sunset", running.Detail);
Assert.True(running.HasDetail);
var paused = recent.Single(r => r.JobId == scan.Id);
Assert.Equal("Stopped at Indexing photo 4 of 9", paused.Detail);
// Without live progress the stored snapshot speaks.
Assert.Equal("10 %", Chronos.App.Archiving.MaintenanceReports.Recent([verify], 5).Single().StateText);
}
private static Job Job(JobKind kind, JobState state, string label) => new()
{
Id = Guid.CreateVersion7(),
Kind = kind,
State = state,
TargetLabel = label,
Created = T0,
Started = state == JobState.Queued ? null : T0,
};
}
/// <summary>The status line in Italian. It switches the process-wide UI language, so the class is serial.</summary>
[Serial]
public sealed class JobTextLanguageTests
{
[Test]
public void ItalianWordsTheSameLine()
{
Loc.SetCulture(CultureInfo.GetCultureInfo("it"));
try
{
var verify = new JobDetail(JobStep.Verify, "Tramonto", 812, 2_400, 3, 41, JobPartUnit.Sequence);
Assert.Equal($"Verifica foto 812 di {Formatting.Count(2_400)} · Tramonto · sequenza 3 di 41", JobText.Status(verify));
Assert.Equal("Elaborazione foto 5 di 9", JobText.Status(new JobDetail(JobStep.Process, null, 5, 9)));
Assert.Equal("Fermo a Miniatura 1 di 10", Loc.L("Jobs.Detail.StoppedAt", JobText.Status(new JobDetail(JobStep.Thumbs, null, 1, 10))));
}
finally
{
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
}
}
}
@@ -0,0 +1,221 @@
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Threading.Channels;
using Chronos.App.Server;
using Chronos.Core.Localization;
using Chronos.Core.Model;
using Chronos.Data.Jobs;
using Chronos.Protocol;
using Chronos.Testing;
namespace Chronos.App.Tests.Jobs;
/// <summary>The Server section's list of the server's jobs (owner review 5, #65, the owner's answer to Q2).</summary>
public sealed class ServerJobsListTests
{
private static readonly DateTimeOffset T0 = new(2026, 9, 28, 10, 0, 0, TimeSpan.Zero);
[Test]
public async Task AReadOnlyAccountSeesRunningAndPausedJobsWithoutActions()
{
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
var api = new FakeJobsApi();
var verify = api.Add("verify", "Harbour sunset", "running", new JobDetailDto("verify", "Harbour sunset", 812, 2_400, 3, 41, "sequence"));
api.Add("proxies", "Lake", "paused", new JobDetailDto("proxies", "Lake", 300, 1_800));
api.Add("thumbs", "Queued one", "queued");
using var vm = new ServerJobsViewModel(() => new ServerJobsAccount("a", CanControl: false), () => api, new IdleContext());
await UpdatedAsync(vm, vm.Refresh);
Assert.True(vm.IsWatching);
Assert.False(vm.CanControl);
Assert.Equal(Loc.L("Tooltips.Server.Jobs.ReadOnly"), vm.TitleToolTip);
Assert.Equal(2, vm.Rows.Count);
Assert.True(vm.HasRows);
var running = vm.Rows[0];
Assert.Equal(verify, running.Id);
Assert.Equal("Verifying photo 812 of 2,400 · Harbour sunset · sequence 3 of 41", running.StatusText);
Assert.Equal(StatusKindOf(JobState.Running), running.StateKind);
Assert.Empty(running.Actions);
Assert.Equal("Stopped at Proxy 300 of 1,800 · Lake", vm.Rows[1].StatusText);
Assert.Empty(vm.Rows[1].Actions);
// Without the right, nothing reaches the server.
await vm.ActAsync(verify, (a, id, ct) => a.PauseJobAsync(id, ct));
Assert.Equal(0, api.Actions);
}
[Test]
public async Task ProgressEventsMoveTheLineAndAFinishedJobLeaves()
{
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
var api = new FakeJobsApi();
var id = api.Add("verify", "Harbour sunset", "running", new JobDetailDto("verify", "Harbour sunset", 1, 2_400, 3, 41, "sequence"));
using var vm = new ServerJobsViewModel(() => new ServerJobsAccount("a", false), () => api, new IdleContext());
await UpdatedAsync(vm, vm.Refresh);
await UpdatedAsync(vm, () => api.Events.Writer.TryWrite(new JobProgressEvent(id, 900, 2_400, 52, 60,
new JobDetailDto("verify", "Alpine lake", 20, 100, 4, 41, "sequence"))));
var row = vm.Rows.Single();
Assert.Equal("Verifying photo 20 of 100 · Alpine lake · sequence 4 of 41", row.StatusText);
Assert.Equal(900d / 2_400, row.Progress);
Assert.Equal("1 min", row.LeftText);
await UpdatedAsync(vm, () => api.Events.Writer.TryWrite(new JobStateEvent(id, "done", null)));
Assert.Empty(vm.Rows);
Assert.False(vm.HasRows);
}
[Test]
public async Task AManagingAccountPausesResumesAndCancels()
{
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
var api = new FakeJobsApi();
var id = api.Add("thumbs", "Lake", "running");
using var vm = new ServerJobsViewModel(() => new ServerJobsAccount("a", CanControl: true), () => api, new IdleContext());
await UpdatedAsync(vm, vm.Refresh);
Assert.True(vm.CanControl);
Assert.Equal(Loc.L("Tooltips.Server.Jobs"), vm.TitleToolTip);
Assert.SequenceEqual(new[] { Loc.L("Jobs.Action.Pause"), Loc.L("Jobs.Action.Cancel") }, vm.Rows.Single().Actions.Select(a => a.Text));
await vm.ActAsync(id, (a, job, ct) => a.PauseJobAsync(job, ct));
Assert.Equal(StatusKindOf(JobState.Paused), vm.Rows.Single().StateKind);
Assert.SequenceEqual(new[] { Loc.L("Jobs.Action.Resume"), Loc.L("Jobs.Action.Cancel") }, vm.Rows.Single().Actions.Select(a => a.Text));
await vm.ActAsync(id, (a, job, ct) => a.CancelJobAsync(job, ct));
Assert.Empty(vm.Rows);
Assert.Equal(2, api.Actions);
}
[Test]
public async Task ARefusedActionIsSaidAndTheListStays()
{
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
var api = new FakeJobsApi { Refuse = true };
var id = api.Add("thumbs", "Lake", "running");
string? said = null;
using var vm = new ServerJobsViewModel(() => new ServerJobsAccount("a", true), () => api, new IdleContext(), (title, reason) => said = $"{title}: {reason}");
await UpdatedAsync(vm, vm.Refresh);
await vm.ActAsync(id, (a, job, ct) => a.PauseJobAsync(job, ct));
Assert.Equal($"{Loc.L("Server.Jobs.NotChanged")}: The job cannot do that in its current state.", said);
Assert.Equal(StatusKindOf(JobState.Running), vm.Rows.Single().StateKind);
}
[Test]
public async Task SigningOutEmptiesTheListAndClosesTheConnection()
{
var api = new FakeJobsApi();
api.Add("verify", "Harbour sunset", "running");
ServerJobsAccount? account = new("a", false);
using var vm = new ServerJobsViewModel(() => account, () => api, new IdleContext());
await UpdatedAsync(vm, vm.Refresh);
Assert.Equal(1, vm.Rows.Count);
account = null;
vm.Refresh();
Assert.False(vm.IsWatching);
Assert.Empty(vm.Rows);
await api.Disposed.Task.WaitAsync(TimeSpan.FromSeconds(10));
// Without an account nothing is opened.
var opened = 0;
using var signedOut = new ServerJobsViewModel(() => null, () => { opened++; return api; }, new IdleContext());
signedOut.Refresh();
Assert.Equal(0, opened);
Assert.False(signedOut.HasRows);
}
private static Chronos.Ui.Controls.StatusKind StatusKindOf(JobState state) =>
state == JobState.Paused ? Chronos.Ui.Controls.StatusKind.Paused : Chronos.Ui.Controls.StatusKind.Running;
/// <summary>Runs <paramref name="act"/>, waits for the listener to post what follows, then applies it as the UI would.</summary>
private static async Task UpdatedAsync(ServerJobsViewModel vm, Action act)
{
var posted = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
void OnPosted() => posted.TrySetResult();
vm.Posted += OnPosted;
try
{
act();
await posted.Task.WaitAsync(TimeSpan.FromSeconds(10));
}
finally
{
vm.Posted -= OnPosted;
}
vm.Flush();
}
/// <summary>A UI context that never runs what is posted to it: the test applies the updates itself.</summary>
private sealed class IdleContext : SynchronizationContext
{
public override void Post(SendOrPostCallback d, object? state)
{
}
}
private sealed class FakeJobsApi : IServerJobsApi
{
private readonly List<JobDto> _jobs = [];
public Channel<ServerEvent> Events { get; } = Channel.CreateUnbounded<ServerEvent>();
public TaskCompletionSource Disposed { get; } = new(TaskCreationOptions.RunContinuationsAsynchronously);
public bool Refuse { get; init; }
public int Actions { get; private set; }
public Guid Add(string kind, string target, string state, JobDetailDto? detail = null)
{
var id = Guid.CreateVersion7();
lock (_jobs)
{
_jobs.Add(new JobDto(id, kind, [], target, state, "background", 10, 100, null, null, null, null, 1, null, T0, T0.AddMinutes(_jobs.Count), null, null,
detail));
}
return id;
}
public Task<Page<JobDto>> ListJobsAsync(string state, string? cursor, CancellationToken cancellationToken)
{
lock (_jobs)
{
var items = _jobs.Where(j => j.State == state).ToList();
return Task.FromResult(new Page<JobDto>(items, null, items.Count));
}
}
public Task<JobDto> GetJobAsync(Guid id, CancellationToken cancellationToken)
{
lock (_jobs) return Task.FromResult(_jobs.Single(j => j.Id == id));
}
public Task<JobDto> PauseJobAsync(Guid id, CancellationToken cancellationToken) => Set(id, "paused");
public Task<JobDto> ResumeJobAsync(Guid id, CancellationToken cancellationToken) => Set(id, "running");
public Task<JobDto> CancelJobAsync(Guid id, CancellationToken cancellationToken) => Set(id, "cancelled");
public async IAsyncEnumerable<ServerEvent> EventsAsync([EnumeratorCancellation] CancellationToken cancellationToken)
{
await foreach (var e in Events.Reader.ReadAllAsync(cancellationToken)) yield return e;
}
public void Dispose() => Disposed.TrySetResult();
private Task<JobDto> Set(Guid id, string state)
{
if (Refuse)
throw new Chronos.Protocol.Client.ChronosApiException(System.Net.HttpStatusCode.Conflict,
new ApiError("invalid_state", "The job cannot do that in its current state.", null));
Actions++;
lock (_jobs)
{
var index = _jobs.FindIndex(j => j.Id == id);
var job = _jobs[index] with { State = state };
_jobs[index] = job;
return Task.FromResult(job);
}
}
}
}
@@ -0,0 +1,60 @@
using System.Net.Http.Json;
using System.Text.RegularExpressions;
using Chronos.Core.Model;
using Chronos.Data.Jobs;
using Chronos.Protocol;
using Chronos.Testing;
namespace Chronos.Server.Tests.Hosting;
/// <summary>
/// What a job does now in the admin panel (owner review 5, #65; <c>Admin/web/jobs.js</c>): the Jobs page and the dashboard
/// draw the status line under the target and move it with every progress event, and every step, part and sub-step the
/// server can send is worded in English and Italian.
/// </summary>
[Category("server")]
public sealed class AdminJobDetailTests(TestContext context)
{
private static readonly string[] MaintenanceSteps = ["Leases", "Temp", "Packs", "Duplicates", "Vacuum"];
[Test]
public async Task TheJobsPageAndTheDashboardShowTheStatusLine()
{
await using var server = await TestServer.StartAsync(context);
var jobs = await server.Client.GetStringAsync("/admin/jobs.js");
foreach (var helper in new[] { "statusText(detail)", "rowStatus(job)", "speedText(kind, rate)", "leftText(seconds)", "targetCell(job)", "statusLine(job)", "updateStatus(row, job)" })
Assert.Contains($"export function {helper}", jobs);
// Items are data: they read in their own direction, and the whole line is the tooltip.
Assert.Contains(@"<span class=""progress-detail"" dir=""auto"" title=""${attr(tip)}"">", jobs);
foreach (var page in new[] { "/admin/pages/jobs.js", "/admin/pages/dashboard.js" })
{
var text = await server.Client.GetStringAsync(page);
Assert.Contains(@"<span class=""target-cell"" role=""cell"">${targetCell(j)}</span>", text);
Assert.Contains("if (e.detail) job.detail = e.detail;", text);
Assert.Contains("updateStatus(row, job);", text);
Assert.True(!text.Contains(" style=", StringComparison.Ordinal), "inline style");
}
Assert.Contains(".progress-detail {", await server.Client.GetStringAsync("/admin/admin.css"));
}
[Test]
public async Task EveryStepAndPartIsInEnglishAndItalian()
{
await using var server = await TestServer.StartAsync(context);
var jobs = await server.Client.GetStringAsync("/admin/jobs.js");
var en = Assert.NotNull(await server.Client.GetFromJsonAsync("/api/v1/i18n/en", ProtocolJson.Default.DictionaryStringString));
var it = Assert.NotNull(await server.Client.GetFromJsonAsync("/api/v1/i18n/it", ProtocolJson.Default.DictionaryStringString));
var keys = Regex.Matches(jobs, @"""(Admin\.[A-Za-z]+(?:\.[A-Za-z]+)*)""").Select(m => m.Groups[1].Value).ToList();
Assert.Contains("Admin.Job.Detail.StoppedAt", keys);
// The keys built from what the server sends.
keys.AddRange(Enum.GetValues<JobStep>().Where(s => s != JobStep.None).Select(s => $"Admin.Job.Step.{s}"));
keys.AddRange(Enum.GetValues<JobPartUnit>().Where(u => u != JobPartUnit.None).Select(u => $"Admin.Job.Part.{u}"));
keys.AddRange(MaintenanceSteps.Select(s => $"Admin.Job.Maintenance.Step.{s}"));
foreach (var key in keys.Distinct())
Assert.True(en.ContainsKey(key) && it.ContainsKey(key), key);
// The step and the unit keys are the wire names in PascalCase, as the panel builds them.
Assert.Equal("copy-photo", JobWire.Step(JobStep.CopyPhoto));
Assert.Equal("Copia foto {0} di {1}", it["Admin.Job.Step.CopyPhoto.Count"]);
Assert.Equal("Verifying photo {0} of {1}", en["Admin.Job.Step.Verify.Count"]);
}
}