feat: owner review 2 phase 1: :latest, Unraid array space, Settings with About, whole-folder import (#9)
CI / Build and test (push) Successful in 5m11s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 6s
Release / Build, test and publish (push) Successful in 8m57s
CI / PostgreSQL 16 integration (push) Successful in 3m10s
CI / PostgreSQL 17 integration (push) Successful in 3m30s
CI / Docker image (push) Successful in 49s
Release / Server image (push) Successful in 1m4s
CI / Build and test (push) Successful in 5m11s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 6s
Release / Build, test and publish (push) Successful in 8m57s
CI / PostgreSQL 16 integration (push) Successful in 3m10s
CI / PostgreSQL 17 integration (push) Successful in 3m30s
CI / Docker image (push) Successful in 49s
Release / Server image (push) Successful in 1m4s
- :latest follows the highest stable release, or the highest pre-release while none is stable (Chronos.Tools release-channels); bad tags are refused before anything is built. - Unraid: CHRONOS_SPACE_PATH and the template's Array view show the array's free space; the write volume (cache) is shown apart; completions check the archive volume (507). - Settings is a gear, docked at the foot of the admin sidebar; About is the last part of Settings on the desktop and the panel. - Import > Folder > Whole folder: one sequence per format (desktop only). 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 #9.
This commit is contained in:
1 parent
5acdf146c7
commit
1f089888e8
320 files changed
+3030
-927
No files matched your search
@@ -23,37 +23,31 @@ public static class ArchiveEndpoints
|
||||
archive.MapGet("/settings", async (HttpContext c, ServerArchive a, ChronosDatabase db, [FromServices] ArchiveService? archives) =>
|
||||
Results.Json(Settings(archives is null ? a.Current : await a.RefreshAsync(archives, db, c.RequestAborted)), ProtocolJson.Default.ArchiveSettingsDto));
|
||||
archive.MapPut("/settings", UpdateAsync);
|
||||
archive.MapGet("/stats", async (HttpContext c, ChronosDatabase db, ServerArchive a) =>
|
||||
Results.Json(await StatsAsync(db, a, c.RequestAborted), ProtocolJson.Default.ArchiveStatsDto));
|
||||
archive.MapGet("/stats", async (HttpContext c, ChronosDatabase db, ServerArchive a, VolumeSpace volumes) =>
|
||||
Results.Json(await StatsAsync(db, a, volumes, c.RequestAborted), ProtocolJson.Default.ArchiveStatsDto));
|
||||
foreach (var (path, kind) in new[] { ("scan", JobKind.Scan), ("rebuild", JobKind.Rebuild), ("verify", JobKind.Verify), ("maintenance", JobKind.Maintenance) })
|
||||
{
|
||||
archive.MapPost("/" + path, (HttpContext c, Caller caller, ServerArchive a, JobEngineHost host, AuditLog audit) => EnqueueAsync(c, caller, a, host, audit, kind));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Totals, distributions, free space and health of the archive (also shown on the dashboard).</summary>
|
||||
public static async Task<ArchiveStatsDto> StatsAsync(ChronosDatabase db, ServerArchive archive, CancellationToken cancellationToken)
|
||||
/// <summary>
|
||||
/// Totals, distributions, free space and health of the archive (also shown on the dashboard). The free space is the
|
||||
/// space volume's (<see cref="VolumeSpace.Report"/>), with the archive's own volume apart when they differ; an offline
|
||||
/// volume reports no figures (0).
|
||||
/// </summary>
|
||||
public static async Task<ArchiveStatsDto> StatsAsync(ChronosDatabase db, ServerArchive archive, VolumeSpace volumes, CancellationToken cancellationToken)
|
||||
{
|
||||
var stats = await db.Sequences.GetStatsAsync(archive.Id, cancellationToken);
|
||||
var withoutProxies = await db.Sequences.CountAsync(
|
||||
new SequenceQuery { ArchiveId = archive.Id, WithoutStatus = SequenceStatus.ProxiesBuilt }, cancellationToken);
|
||||
long free = 0, capacity = 0;
|
||||
try
|
||||
{
|
||||
var drive = new DriveInfo(archive.Root);
|
||||
free = drive.AvailableFreeSpace;
|
||||
capacity = drive.TotalSize;
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or ArgumentException or UnauthorizedAccessException)
|
||||
{
|
||||
// An offline archive volume reports no space figures.
|
||||
}
|
||||
var storage = volumes.Report(archive.Root);
|
||||
return new ArchiveStatsDto(
|
||||
stats.Sequences,
|
||||
stats.Photos,
|
||||
stats.Bytes,
|
||||
free,
|
||||
capacity,
|
||||
storage.Space?.FreeBytes ?? 0,
|
||||
storage.Space?.TotalBytes ?? 0,
|
||||
stats.ByCamera.Count(c => c.Model is not null),
|
||||
stats.ByYear.Count > 0 ? stats.ByYear[0].Year : null,
|
||||
stats.ByYear.Count > 0 ? stats.ByYear[^1].Year : null,
|
||||
@@ -62,7 +56,11 @@ public static class ArchiveEndpoints
|
||||
[.. stats.ByCamera.Select(c => new KeyValueCount(string.Join(' ', new[] { c.Make, c.Model }.Where(v => !string.IsNullOrEmpty(v))), c.Photos, c.Bytes))],
|
||||
[.. stats.ByFormat.Select(f => new KeyValueCount(f.Format.ToString().ToLowerInvariant(), f.Photos, f.Bytes))],
|
||||
withoutProxies,
|
||||
stats.Health.Unverified);
|
||||
stats.Health.Unverified,
|
||||
storage.Write?.FreeBytes,
|
||||
storage.Write?.TotalBytes,
|
||||
storage.FileSystem,
|
||||
storage.FromSpacePath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in new issue
Block a user