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>
45 lines
2.2 KiB
C#
45 lines
2.2 KiB
C#
using Chronos.Protocol;
|
|
using Chronos.Protocol.Client;
|
|
|
|
namespace Chronos.App.Server;
|
|
|
|
/// <summary>
|
|
/// What the Server section's job list needs from the signed-in server (owner review 5, #65): its jobs by state, one job,
|
|
/// pause, resume and cancel, and its events (<see cref="JobProgressEvent"/>, <see cref="JobStateEvent"/>). Owns its connection.
|
|
/// </summary>
|
|
public interface IServerJobsApi : IDisposable
|
|
{
|
|
/// <summary>A page of the server's jobs in <paramref name="state"/> (a wire name: running, paused…), newest first.</summary>
|
|
Task<Page<JobDto>> ListJobsAsync(string state, string? cursor, CancellationToken cancellationToken);
|
|
|
|
Task<JobDto> GetJobAsync(Guid id, CancellationToken cancellationToken);
|
|
|
|
Task<JobDto> PauseJobAsync(Guid id, CancellationToken cancellationToken);
|
|
|
|
Task<JobDto> ResumeJobAsync(Guid id, CancellationToken cancellationToken);
|
|
|
|
Task<JobDto> CancelJobAsync(Guid id, CancellationToken cancellationToken);
|
|
|
|
/// <summary>Server events until cancelled or the socket closes.</summary>
|
|
IAsyncEnumerable<ServerEvent> EventsAsync(CancellationToken cancellationToken);
|
|
}
|
|
|
|
/// <summary><see cref="IServerJobsApi"/> over a signed-in <see cref="ChronosClient"/>, which it owns.</summary>
|
|
public sealed class ChronosServerJobsApi(ChronosClient client) : IServerJobsApi
|
|
{
|
|
public Task<Page<JobDto>> ListJobsAsync(string state, string? cursor, CancellationToken cancellationToken) =>
|
|
client.ListJobsAsync(state, null, cursor, cancellationToken);
|
|
|
|
public Task<JobDto> GetJobAsync(Guid id, CancellationToken cancellationToken) => client.GetJobAsync(id, cancellationToken);
|
|
|
|
public Task<JobDto> PauseJobAsync(Guid id, CancellationToken cancellationToken) => client.PauseJobAsync(id, cancellationToken);
|
|
|
|
public Task<JobDto> ResumeJobAsync(Guid id, CancellationToken cancellationToken) => client.ResumeJobAsync(id, cancellationToken);
|
|
|
|
public Task<JobDto> CancelJobAsync(Guid id, CancellationToken cancellationToken) => client.CancelJobAsync(id, cancellationToken);
|
|
|
|
public IAsyncEnumerable<ServerEvent> EventsAsync(CancellationToken cancellationToken) => client.EventsAsync(cancellationToken);
|
|
|
|
public void Dispose() => client.Dispose();
|
|
}
|