Owner review 2, R8, phase 5b (client part), ported onto the final phase 5a.
A Chronos Server with the "projects" capability is now the home of
workspace projects. A server sequence is edited in the workspace like a
local one, not inside the library, and its versions sync with the server
"like git".
- Data: ServerProjectHome is an IProjectHome over ChronosClient.
- These are HomeUnavailableException, so the workspace shows Offline: a
server out of reach, an expired sign-in, a 503 (lease, offline archive,
projects_unreadable), a 409 folder_in_use, and a server without projects.
- 404 sequence/project/version and refused names are ProjectException;
other refusals keep their meaning.
- A deleted project's head is 404 project, so final 5a's HeadAsync NotFound
rule reads it as Gone. The original 5b's IsLiveAsync and
WorkspaceStatus.Gone are dropped. IProjectHome gains rename and delete.
- Data: WorkspaceJobs.CopyFromServer downloads into the workspace, through
the desktop's session, the proxies of one frames version (or the
thumbnails standing in for them), with the aliases of the server's
conversions. It is rebuilt on final 5a's copy handler:
- the copy:frame:fv:folder checkpoint, EnsureSpace (from the server's proxy
sizes), WritingMedia, and the cancelled-copy clean-up;
- the editor's current file is never overwritten;
- each file is hashed as it arrives and checked on disk, four at a time.
It never writes this PC's archive. Originals are still refused until 5c.
- Data: SyncAgent passes on the server's projectChanged events, and after a
lost event stream it reports that changes may have been missed.
- App: SyncHost gives the server home over one session client. The Server
screen offers Open in workspace, disabled with its reason on older
servers, whose sequences keep opening with proxies.
- App: Edit opens or checks out server projects with final 5a's refusals:
unreadable copies, a disabled damaged or newer Main, a refused folder. The
"sequence left the index" refusal now applies only to projects of this
PC's archive.
- App: the picker and the chip follow projectChanged (Server newer, Not on
server). Every state, conflict, delete, remove and failure text uses its
".Server" form when one exists (WorkspaceText.ForHome). That includes 5a's
newer-format conflict, the save conflict, the taken-values toast, Gone and
version-too-large.
- App: a render of a server project first offers to send what is not on the
server, then renders the version the server holds. Offline, Gone, Damaged
and missing media hold the render. Analyses and renders run as server jobs
(ServerJobs, shared with RemoteSequenceSource).
- Pruning keeps final 5a's rule: a version is pruned only after HoldsAsync
reads it back.
- Strings in en and it; ARCHITECTURE, DECISIONS and CHANGELOG.
Tests:
- ServerProjectHome error mapping, using a fake handler.
- Against the in-process server:
- two workspaces on one project: fast-forward, replay and merge, keep mine,
take server, save both, restore;
- the copy job verifying, resuming and following new frames;
- a project deleted on the server (Gone from its head; a push sends
nothing);
- an offline server.
- SyncAgent project events.
- App tests for the host, the project menu and renders of a server home.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
74 lines
3.3 KiB
C#
74 lines
3.3 KiB
C#
using Chronos.App.Library;
|
|
using Chronos.Core.Localization;
|
|
using Chronos.Data.Workspaces;
|
|
using Chronos.Ui.Controls;
|
|
using Chronos.Ui.Mvvm;
|
|
|
|
namespace Chronos.App.Workspace;
|
|
|
|
/// <summary>
|
|
/// A project of the workspace in Edit's picker (owner review 2, R8): its name, its sequence (title and thumbnail; a server's
|
|
/// as the Library lists it, phase 5b) and where it stands, a chip read from its home after the list shows and again when
|
|
/// the home tells it changed. A copy whose working state cannot be read is listed as damaged, one a newer Chronos wrote
|
|
/// as such, by the name each is still known by.
|
|
/// </summary>
|
|
public sealed class WorkspaceProjectItem(WorkspaceEntry entry, SequenceItem? sequence) : ObservableObject
|
|
{
|
|
private WorkspaceStatus? _status;
|
|
|
|
public WorkspaceEntry Entry { get; } = entry;
|
|
|
|
/// <summary>The sequence's row of the library, for its thumbnail; null when the index no longer has it.</summary>
|
|
public SequenceItem? Sequence { get; } = sequence;
|
|
|
|
public Guid ProjectId => Entry.ProjectId;
|
|
|
|
public Guid SequenceId => Entry.SequenceId;
|
|
|
|
/// <summary>The project's name (Main in the UI language).</summary>
|
|
public string Name => WorkspaceText.ProjectName(Entry.Name, Entry.IsMain);
|
|
|
|
public string SequenceTitle => Sequence?.Title ?? Entry.SequenceTitle;
|
|
|
|
public WorkspaceStatus? Status
|
|
{
|
|
get => _status;
|
|
set
|
|
{
|
|
if (!Set(ref _status, value)) return;
|
|
OnPropertyChanged(nameof(StateText));
|
|
OnPropertyChanged(nameof(StateKind));
|
|
OnPropertyChanged(nameof(StateToolTip));
|
|
OnPropertyChanged(nameof(Description));
|
|
}
|
|
}
|
|
|
|
/// <summary>Its working state cannot be read: it cannot open, and Remove local copy keeps its files aside.</summary>
|
|
public bool IsDamaged => Entry.Damaged;
|
|
|
|
/// <summary>A newer Chronos wrote its working state: it neither opens nor goes from here, and stays as it is.</summary>
|
|
public bool IsNewer => Entry.Newer;
|
|
|
|
/// <summary>This Chronos reads its working state: it opens, and its state is asked of its home.</summary>
|
|
public bool IsReadable => Entry.IsReadable;
|
|
|
|
public string StateText => Entry.Newer ? Loc.L("Editor.Workspace.State.NewerCopy")
|
|
: Entry.Damaged ? Loc.L("Editor.Workspace.State.Damaged")
|
|
: Entry.HasMedia || _status is not null ? WorkspaceText.State(_status, server: Entry.IsServerHome) : Loc.L("Editor.Workspace.State.MediaRemoved");
|
|
|
|
public StatusKind StateKind => Entry.Newer ? StatusKind.Warning
|
|
: Entry.Damaged ? StatusKind.Error
|
|
: Entry.HasMedia || _status is not null ? WorkspaceText.Kind(_status) : StatusKind.NoProxies;
|
|
|
|
public string StateToolTip => Entry.Newer ? Loc.L("Tooltips.Editor.Workspace.State.NewerCopy")
|
|
: Entry.Damaged ? Loc.L("Tooltips.Editor.Workspace.State.DamagedCopy")
|
|
: Entry.HasMedia || _status is not null ? WorkspaceText.StateToolTip(_status, server: Entry.IsServerHome) : Loc.L("Tooltips.Editor.Workspace.State.MediaRemoved");
|
|
|
|
/// <summary>"Vertical social · Harbour sunset · In sync": what screen readers hear for the row.</summary>
|
|
public string Description => string.Join(Loc.Separator, Name, SequenceTitle, StateText);
|
|
|
|
public override string ToString() => Name;
|
|
|
|
internal void Refresh() => OnAllPropertiesChanged();
|
|
}
|