feat: owner review 2 phase 4a: Reorganize sequences after import (#12)
CI / Build and test (push) Successful in 9m15s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 6s
Release / Build, test and publish (push) Successful in 15m35s
CI / PostgreSQL 16 integration (push) Successful in 7m26s
CI / PostgreSQL 17 integration (push) Successful in 6m47s
CI / Docker image (push) Successful in 59s
Release / Server image (push) Successful in 1m24s

- Reorganize… on the web panel and the desktop: folder, file and title templates applied to existing sequences, with a dry run and an explicit Apply that runs as a job.
- One naming rule (FrameNaming) for import, upload and Reorganize.
- Crash-safe plan and file journals, held plans, stale-plan refusal; exports move with their folder.
- Writers refuse a folder another program moved or gave to another sequence.
- Server: POST /api/v1/archive/reorganize with a bounded plan cache; template rules.
- Phase 3 docs and translations merged; strings in all 38 languages.

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 #12.
This commit is contained in:
Alby96andClaude Opus 5.5 authored and Alby96 committed 2026-10-27 21:58:39 +01:00
1 parent 9aa818ed47
commit 7e4a3b481d
416 files changed
+15304 -1572

No files matched your search

+24 -11
View File
@@ -6,6 +6,7 @@ using System.Windows.Input;
using System.Windows.Threading;
using Chronos.App.Archiving;
using Chronos.App.Infrastructure;
using Chronos.App.Jobs;
using Chronos.App.Library;
using Chronos.App.Server;
using Chronos.App.Shell;
@@ -14,6 +15,7 @@ using Chronos.Core.IO;
using Chronos.Core.Localization;
using Chronos.Core.Model;
using Chronos.Data;
using Chronos.Data.Archiving;
using Chronos.Data.Repositories;
using Chronos.Data.Sync;
using Chronos.Protocol;
@@ -28,8 +30,9 @@ namespace Chronos.App.Sections;
/// have no copy here (remote cards) — in a virtualised card grid, a table, or a timeline of year bands over the grid;
/// filtered by search, year, camera, status, tag and origin, sorted, loaded page by page (keyset paging) as the view
/// scrolls. Filters and sort can be saved as named views. Cards and rows reveal quick actions (open, analyse, render
/// the sequence's preset, sync); a selection gets the mass actions bar (analyse, proxies, verify, tag, rate, move,
/// upload, download, delete into the trash, CSV), each disabled with its reason when it cannot run on the selection.
/// the sequence's preset, sync); a selection gets the mass actions bar (analyse, proxies, verify, tag, rate,
/// reorganize, upload, download, delete into the trash, CSV), each disabled with its reason when it cannot run on the
/// selection.
/// </summary>
public sealed class LibraryViewModel : SectionViewModel
{
@@ -126,7 +129,7 @@ public sealed class LibraryViewModel : SectionViewModel
VerifyCommand = Mass(MassAction.Verify, t => _actions.VerifyAsync(t));
TagCommand = Mass(MassAction.Tag, OpenRetag);
RateCommand = new AsyncRelayCommand((p, _) => p is int rating ? RateAsync(rating) : Task.CompletedTask, _ => CanRun(MassAction.Rate));
MoveCommand = Mass(MassAction.Move, OpenMoveAsync);
ReorganizeCommand = Mass(MassAction.Reorganize, OpenReorganizeAsync);
UploadCommand = Mass(MassAction.Upload, _ => TransferAsync(MassAction.Upload));
DownloadCommand = Mass(MassAction.Download, _ => TransferAsync(MassAction.Download));
DeleteCommand = Mass(MassAction.Delete, t => DeleteAsync([.. t.Select(s => s.Id)]));
@@ -176,7 +179,9 @@ public sealed class LibraryViewModel : SectionViewModel
/// <summary>Parameter: the rating, 0 (none) to 5.</summary>
public ICommand RateCommand { get; }
public ICommand MoveCommand { get; }
/// <summary>Reorganize…: the selection's folders, file names and titles from templates, a dry run first, then a job.</summary>
public ICommand ReorganizeCommand { get; }
public ICommand UploadCommand { get; }
public ICommand DownloadCommand { get; }
public ICommand DeleteCommand { get; }
@@ -486,7 +491,7 @@ public sealed class LibraryViewModel : SectionViewModel
public string VerifyToolTip => MassToolTip(MassAction.Verify);
public string TagToolTip => MassToolTip(MassAction.Tag);
public string RateToolTip => MassToolTip(MassAction.Rate);
public string MoveToolTip => MassToolTip(MassAction.Move);
public string ReorganizeToolTip => MassToolTip(MassAction.Reorganize);
public string UploadToolTip => MassToolTip(MassAction.Upload);
public string DownloadToolTip => MassToolTip(MassAction.Download);
public string DeleteToolTip => MassToolTip(MassAction.Delete);
@@ -504,7 +509,7 @@ public sealed class LibraryViewModel : SectionViewModel
// ---------------- Dialogs ----------------
/// <summary>The open in-window dialog (tags, move, view name, delete); null when none.</summary>
/// <summary>The open in-window dialog (tags, reorganize, view name, delete); null when none.</summary>
public ArchiveDialogViewModel? Dialog
{
get => _dialog;
@@ -1029,7 +1034,7 @@ public sealed class LibraryViewModel : SectionViewModel
OnPropertyChanged(nameof(VerifyToolTip));
OnPropertyChanged(nameof(TagToolTip));
OnPropertyChanged(nameof(RateToolTip));
OnPropertyChanged(nameof(MoveToolTip));
OnPropertyChanged(nameof(ReorganizeToolTip));
OnPropertyChanged(nameof(UploadToolTip));
OnPropertyChanged(nameof(DownloadToolTip));
OnPropertyChanged(nameof(DeleteToolTip));
@@ -1165,12 +1170,20 @@ public sealed class LibraryViewModel : SectionViewModel
OpenDialog(new RetagDialogViewModel(archives, targets, AppliedAsync, CloseDialog));
}
/// <summary>Move: the archive engine's folder rename with its dry run, for sequences of one archive.</summary>
private async Task OpenMoveAsync(IReadOnlyList<Sequence> targets)
/// <summary>
/// Reorganize…: the archive's folder and file templates (titles on request) applied to the selection of one archive,
/// a dry run first, then the engine's job, which the Library follows to read the sequences again.
/// </summary>
private async Task OpenReorganizeAsync(IReadOnlyList<Sequence> targets)
{
if (Shell.Services.Archives is not { } archives || _db is null || targets.Count == 0) return;
if (Shell.Services.Archives is not { } archives || Shell.Services.Engine is not { } engine || _db is null || targets.Count == 0) return;
if (await _db.Archives.GetAsync(targets[0].ArchiveId) is not { } archive) return;
var dialog = new RenameDialogViewModel(RenameMode.Folders, archives, archive, targets, AppliedAsync, CloseDialog);
var dialog = new ReorganizeDialogViewModel(archives, archive, [.. targets.Select(t => t.Id)], ReorganizePlans.Layout, async request =>
{
await engine.EnqueueAsync(request);
Shell.Notify(Loc.L("Library.Queued", JobText.Kind(request.Kind), request.Label ?? archive.Name), actionText: Loc.L("Shell.Nav.Jobs"),
actionToolTip: Loc.L("Tooltips.Nav.Jobs"), action: () => Shell.Navigate(SectionKey.Jobs));
}, CloseDialog);
OpenDialog(dialog);
await dialog.PlanAsync();
}