feat: work board, no usage data, archive folder tree, deploy guide (owner review 4 + owner review 1 phase 6) (#62)
CI / Build and test (push) Successful in 10m37s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 9s
Release / Build, test and publish (push) Successful in 16m19s
CI / PostgreSQL 16 integration (push) Successful in 10m19s
CI / PostgreSQL 17 integration (push) Successful in 11m27s
CI / Docker image (push) Successful in 57s
Release / Server image (push) Successful in 1m34s

Owner review 4 and owner review 1 phase 6.

- Work board in Videos (desktop and admin panel): Published and Workspace lanes (#29).
- Anonymous usage counts removed: Chronos sends nothing about its use (#30).
- The archive's whole folder tree is created inside any archive root, on the server and the desktop (#31).
- Video cards start with the preset; sizes keep number and unit together (#28).
- Deploy guide docs/deploy (Docker, Unraid, desktop), BRIEF §24, original documentation in docs/reference/original (#22).

Closes #22 #28 #29 #30 #31

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #62.
This commit is contained in:
Alby96andClaude Opus 5.5 authored and Alby96 committed 2026-11-06 18:46:22 +01:00
1 parent 728ffa35cb
commit 0075065884
304 files changed
+6892 -325

No files matched your search

@@ -8,11 +8,14 @@ using Chronos.App.Settings;
using Chronos.App.Shell;
using Chronos.App.Tests.Windows;
using Chronos.App.Videos;
using Chronos.App.Workspace;
using Chronos.Core.Localization;
using Chronos.Core.Model;
using Chronos.Core.Project;
using Chronos.Core.Windows.Shell;
using Chronos.Data.Archiving.Jobs;
using Chronos.Data.Videos;
using Chronos.Data.Workspaces;
using Chronos.Protocol;
using Chronos.Testing;
using Chronos.Ui.Controls;
@@ -24,7 +27,7 @@ namespace Chronos.App.Tests.Videos;
/// The Videos library's sources (owner review 1, R9; decision 20): this PC's, the server's and the workspace's renders
/// merged by render id, the filters and the orders, the videos folder's checks, the player's fallback, and the copy's toast.
/// </summary>
public sealed class VideoSourcesTests
public sealed class VideoSourcesTests(TestContext context)
{
private static readonly Guid Harbour = Guid.CreateVersion7();
private static readonly Guid Comet = Guid.CreateVersion7();
@@ -200,6 +203,112 @@ public sealed class VideoSourcesTests
}
}
[Test]
public void TheBoardPutsEachRenderInTheLaneOfWhereItIs()
{
var local = Local(Guid.CreateVersion7(), Harbour, "Harbour sunset", 100);
var remote = Server(Guid.CreateVersion7(), Comet, "Comet", 300);
var unsent = Unsent(Guid.CreateVersion7(), Comet);
// Sent from the workspace to this PC's archive: the archive's entry under Published, its file still in exports/ under Workspace.
var sent = Unsent(local.Id, Harbour) with { IsUnsent = false, IsWorkspaceSent = true, Created = local.Created, Title = "Harbour sunset" };
Assert.Equal(VideoLane.Published, VideoBoard.LaneOf(local));
Assert.Equal(VideoLane.Published, VideoBoard.LaneOf(remote));
Assert.Equal(VideoLane.Workspace, VideoBoard.LaneOf(unsent));
Assert.Equal(VideoLane.Workspace, VideoBoard.LaneOf(sent));
// The list has one row per render: the sent one is the archive's.
var merged = VideoSources.Merge([local], [remote], [unsent, sent]);
Assert.SequenceEqual([local.Id, remote.Id, unsent.Id], merged.Select(e => e.Id));
Assert.False(merged.Any(e => e.IsWorkspaceSent));
// Newest first in each lane whatever the list's order; the list's filters narrow both lanes.
var (published, workspace) = VideoBoard.Split(merged, [sent], new VideoFilter { Sort = VideoSorts.Title });
Assert.SequenceEqual([local.Id, remote.Id], published.Select(e => e.Id));
Assert.SequenceEqual([unsent.Id, sent.Id], workspace.Select(e => e.Id));
Assert.True(workspace[1].IsWorkspaceSent);
var harbour = VideoBoard.Split(merged, [sent], new VideoFilter { SequenceId = Harbour });
Assert.SequenceEqual([local.Id], harbour.Published.Select(e => e.Id));
Assert.SequenceEqual([sent.Id], harbour.Workspace.Select(e => e.Id));
Assert.Empty(VideoBoard.Split(merged, [sent], new VideoFilter { Text = "instagram" }).Published);
// This PC holds a sent render's file; it is not the server's, nor waiting to be sent.
Assert.True(new VideoFilter { Source = VideoSourceFilter.Local }.Matches(sent));
Assert.False(new VideoFilter { Source = VideoSourceFilter.NotSent }.Matches(sent));
Assert.False(new VideoFilter { Source = VideoSourceFilter.Server }.Matches(sent));
// Its chip says it was sent, worded for its project's home.
Assert.Contains(VideoText.States(sent), s => s.Text == Loc.L("Videos.State.Sent") && s.ToolTip == Loc.L("Tooltips.Videos.Sent"));
Assert.Contains(VideoText.States(sent with { WorkspaceServerHome = true }), s => s.ToolTip == Loc.L("Tooltips.Videos.Sent.Server"));
Assert.Equal(Loc.L("Tooltips.Videos.SentRow"), new VideoRowViewModel(sent).ToolTip);
Assert.False(new VideoRowViewModel(sent).CanSend);
Assert.True(new VideoRowViewModel(unsent).CanSend);
}
[Test]
public void AWorkspaceLedgerEntryReadsAsSentOrNot()
{
var home = new BundleHome(BundleHome.ArchiveKind, Harbour);
var project = new WorkspaceEntry(Guid.CreateVersion7(), Harbour, "Social cut", false, home, "Harbour sunset", true, DateTimeOffset.UtcNow);
var render = new WorkspaceRenderEntry(Guid.CreateVersion7(), Guid.CreateVersion7(), "harbour.mp4", new string('a', 64), 1_000, "Instagram", "h264", 1080, 1920, 30, 12,
project.ProjectId, null, null, DateTimeOffset.UtcNow);
var pending = VideoSources.FromWorkspace(render, project, @"C:\ws\exports\harbour.mp4", exists: true);
Assert.True(pending is { IsUnsent: true, IsWorkspaceSent: false, Missing: false, ProjectName: "Social cut" });
var sent = VideoSources.FromWorkspace(render.AsSent(DateTimeOffset.UtcNow), project, @"C:\ws\exports\harbour.mp4", exists: true);
Assert.True(sent is { IsUnsent: false, IsWorkspaceSent: true, HasLocalFile: true });
Assert.Equal(VideoLane.Workspace, VideoBoard.LaneOf(sent));
// A failed send waits to be sent again.
Assert.True(VideoSources.FromWorkspace(render.AsFailed("no"), project, @"C:\ws\exports\harbour.mp4", exists: false) is { IsUnsent: true, Missing: true });
}
[Test]
public void ASentRenderWhoseFileLeftTheWorkspaceIsNotListedAsMissing()
{
// Rc.14 review: its home holds it, and the home's entry stands for it; only a render not sent yet can be missing.
var store = new WorkspaceStore(context.CreateTempDirectory("ledger"));
var home = new BundleHome(BundleHome.ArchiveKind, Harbour);
var project = new WorkspaceEntry(Guid.CreateVersion7(), Harbour, "Social cut", false, home, "Harbour sunset", true, DateTimeOffset.UtcNow);
var folder = store.Project(project.ProjectId);
Directory.CreateDirectory(folder.ExportsDirectory);
WorkspaceRenderEntry Render(string file) => new(Guid.CreateVersion7(), Guid.CreateVersion7(), file, new string('a', 64), 8, "Instagram", "h264", 1080, 1920, 30, 12,
project.ProjectId, null, null, DateTimeOffset.UtcNow);
File.WriteAllText(folder.ExportFile("kept.mp4"), "rendered");
var kept = Render("kept.mp4").AsSent(DateTimeOffset.UtcNow);
var gone = Render("gone.mp4").AsSent(DateTimeOffset.UtcNow);
var lost = Render("lost.mp4");
folder.WriteRenders(WorkspaceRenders.Empty.With(kept).With(gone).With(lost));
var entries = VideoSources.ReadWorkspace(store, [project]);
Assert.Count(2, entries);
Assert.True(entries.Single(e => e.Id == kept.RenderId) is { IsWorkspaceSent: true, Missing: false });
Assert.True(entries.Single(e => e.Id == lost.RenderId) is { IsUnsent: true, Missing: true }, "a render not sent yet whose file is gone is missing");
Assert.False(entries.Any(e => e.Id == gone.RenderId));
}
[Test]
public void ACardStartsWithItsPresetAndKeepsSizesWhole()
{
var video = Local(Guid.CreateVersion7(), Harbour, "Harbour sunset", 100) with { PresetName = "4K archive", Codec = "hevc", DurationSeconds = 41, Bytes = 1_400_000_000 };
// Issue #28: "4K archive · HEVC · 0:41 · 1.4 GB", the number and its unit held together by a no-break space.
var size = Formatting.Bytes(video.Bytes);
Assert.True(size.Contains('\u00A0', StringComparison.Ordinal) && !size.Contains(' ', StringComparison.Ordinal), size);
Assert.Equal(string.Join(Loc.Separator, "4K archive", "HEVC", VideoText.Duration(video), size), VideoText.Card(video));
Assert.Equal(VideoText.Card(video), new VideoRowViewModel(video).CardText);
var still = video with { Kind = RenderKind.Still, PresetName = "Frame 512", Codec = null, DurationSeconds = 0, Bytes = 3_400_000 };
Assert.Equal(string.Join(Loc.Separator, "Frame 512", Formatting.Bytes(still.Bytes)), VideoText.Card(still), "no codec, no duration");
Assert.False(Formatting.Bytes(999).Contains(' ', StringComparison.Ordinal));
// A Board card names the project and its version when known.
Assert.Equal(string.Empty, VideoText.Project(video));
Assert.Equal("Social cut", VideoText.Project(video with { ProjectName = "Social cut" }));
Assert.Equal("Social cut" + Loc.Separator + Loc.L("Videos.Version", "3"), VideoText.Project(video with { ProjectName = "Social cut", ProjectVersionNumber = 3 }));
var row = new VideoRowViewModel(video with { ProjectName = "Social cut", ProjectVersionNumber = 3 });
Assert.True(row.HasProject);
Assert.Equal(Loc.L("Videos.Kind.One.Video") + Loc.Separator + row.DateText, row.BoardFactsText);
Assert.Equal(3, VideoSources.FromServer(new VideoDto(Guid.CreateVersion7(), Comet, "4K", "h264", 1, 1, 1, 1, 1, DateTimeOffset.UtcNow, "nas", null, null, null,
RenderKind.Video, "Comet", null, "Social cut", 3, VideoStates.Ok, [])).ProjectVersionNumber);
}
[Test]
public void ACopyToTheVideosFolderEndsWithAToast()
{
@@ -505,6 +614,105 @@ public sealed class VideosSectionTests(TestContext context)
Assert.True(shell.Settings.OpenVideosFolderCommand.CanExecute(null));
});
[Test]
public Task TheBoardShowsPublishedAndWorkspaceLanes() => WithSectionAsync(async (shell, section, library, _) =>
{
var folder = context.CreateTempDirectory("videos-board");
var unsentFile = Path.Combine(folder, "comet-instagram.mp4");
var sentFile = Path.Combine(folder, "harbour-4k.mp4");
File.WriteAllBytes(unsentFile, [1]);
File.WriteAllBytes(sentFile, [1]);
var project = Guid.CreateVersion7();
var unsent = new VideoEntry
{
Id = Guid.CreateVersion7(),
SequenceId = library.Items[1].Render.SequenceId,
Title = "Comet",
PresetName = "Instagram",
Codec = "h264",
Bytes = 10,
Created = DateTimeOffset.UtcNow,
Kind = RenderKind.Video,
FileName = "comet-instagram.mp4",
LocalPath = unsentFile,
IsUnsent = true,
WorkspaceProjectId = project,
ProjectName = "Social cut",
};
// The archive's first render, sent from the workspace, its file still in exports/.
var archived = library.Items[0].Render;
var sent = unsent with
{
Id = archived.Id,
SequenceId = archived.SequenceId,
Title = "Harbour sunset",
PresetName = archived.PresetName,
Created = archived.Created,
FileName = "harbour-4k.mp4",
LocalPath = sentFile,
IsUnsent = false,
IsWorkspaceSent = true,
};
section.WorkspaceRenders = _ => Task.FromResult<IReadOnlyList<VideoEntry>>([unsent, sent]);
await section.RefreshAsync();
// The list and the cards: one row per render, the sent one being the archive's.
Assert.Equal(library.Items.Count + 1, section.Rows.Count);
Assert.Equal(sent.Id, Assert.NotNull(section.SentEntries.SingleOrDefault()).Id);
Assert.False(section.IsBoard);
// The Board: kept for the next run, Published beside Workspace, newest first, a count per lane.
section.LayoutIndex = 2;
Assert.True(section.IsBoard);
Assert.Equal(LibraryLayout.Board, shell.Services.Settings.VideosLayout);
Assert.Equal(2, new VideosViewModel(shell).LayoutIndex, "a new section opens on the Board");
Assert.SequenceEqual(library.Items.OrderByDescending(i => i.Render.Created).Select(i => i.Render.Id), section.PublishedRows.Select(r => r.Entry.Id));
Assert.SequenceEqual([unsent.Id, sent.Id], section.WorkspaceRows.Select(r => r.Entry.Id));
Assert.Equal((Formatting.Count(3), Formatting.Count(2)), (section.PublishedCountText, section.WorkspaceCountText));
Assert.Same(section.Rows.Single(r => r.Entry.Id == unsent.Id), section.WorkspaceRows[0]);
var sentRow = section.WorkspaceRows[1];
Assert.True(sentRow.Entry.IsWorkspaceSent);
Assert.False(ReferenceEquals(section.Rows.Single(r => r.Entry.Id == sent.Id), sentRow), "a row of its own beside the archive's");
// The sent row's actions: Play, Show in folder and Open in Edit (its home is this PC's archive); no copy, delete or send.
Assert.True(section.PlayCommand.CanExecute(sentRow));
Assert.True(section.ShowInFolderCommand.CanExecute(sentRow));
Assert.True(section.OpenInEditCommand.CanExecute(sentRow));
Assert.False(section.SendCommand.CanExecute(sentRow));
Assert.Equal(Loc.L("Tooltips.Videos.SentRow"), section.CopyBlocker([sentRow]));
Assert.Equal(Loc.L("Tooltips.Videos.SentRow"), section.DeleteBlocker([sentRow]));
Assert.True(section.SendCommand.CanExecute(section.WorkspaceRows[0]), "the unsent one sends");
// Selected on the Board, it is part of the selection; off the Board, it is let go.
sentRow.IsSelected = true;
Assert.True(section.HasSelection);
Assert.Contains(sentRow, section.SelectedRows);
Assert.Equal(Loc.L("Videos.Selected", Formatting.Count(1)), section.SelectionText);
section.LayoutIndex = 0;
Assert.False(sentRow.IsSelected);
Assert.False(section.HasSelection);
section.LayoutIndex = 2;
// The list's filters narrow both lanes; none kept is the section's empty state.
section.SearchText = "instagram";
Assert.SequenceEqual([unsent.Id], section.WorkspaceRows.Select(r => r.Entry.Id));
Assert.Empty(section.PublishedRows);
Assert.True(section.IsPublishedEmpty, "the lane says it is empty");
section.SearchText = "no such video";
Assert.True(section.IsNoMatch);
Assert.False(section.IsPublishedEmpty || section.IsWorkspaceEmpty, "one empty state, not three");
section.SearchText = string.Empty;
// Laid out: both lanes' headings and cards, with the card's line starting with the preset (issue #28).
var view = new VideosView { DataContext = section };
Layout(view, 1400);
var texts = Descendants(view).OfType<System.Windows.Controls.TextBlock>().Where(t => t.ActualWidth > 0).Select(t => t.Text).ToList();
Assert.Contains(Loc.L("Videos.Lane.Published"), texts);
Assert.Contains(Loc.L("Videos.Lane.Workspace"), texts);
Assert.Contains(sentRow.CardText, texts);
Assert.True(sentRow.CardText.StartsWith(sent.PresetName + Loc.Separator, StringComparison.Ordinal), sentRow.CardText);
});
private static void Layout(System.Windows.FrameworkElement view, double width = 1200)
{
view.Measure(new System.Windows.Size(width, 800));