diff --git a/Directory.Build.props b/Directory.Build.props index f866bc2b..c374ee6a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ $(MSBuildThisFileDirectory) - 1.1.0 + 1.1.1 $(ChronosVersion) $([System.Text.RegularExpressions.Regex]::Match($(ChronosVersion), '^\d+\.\d+\.\d+').Value).0 $(AssemblyVersion) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 3ce7461a..4487cbd0 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -5,12 +5,23 @@ commits follow Conventional Commits (release notes are generated from them by `C ## [Unreleased] +## [1.1.1] — 2026-11-16 + +The Windows hands-on test of 1.1.0 (#70): import, Reorganize, sharing the library, a client, the tray and Exit were +tried on the development PC with a portable copy. Two small fixes in Jobs; nothing changes in the archive, the database +or the server. + ### Fixed - Settings › Server › Certificates: Forget stays whole beside the 200 px rail at 1200 px in every language (it ran 5 px out of the page in Bulgarian); the server name gives way first (#70). - The Reorganize screen capture (`archive-reorganize-*.png`) showed every sample sequence as unreadable with Apply off: the sample archive had no sidecars. The capture now gives each sample sequence a sidecar and a stand-in photo for the dry run, and removes them after it (#70). +- Jobs: the log under a job showed its times in UTC (12:35) while the rows show local time (13:35); the log now shows + local time too. The stored log keeps UTC, so a server's jobs read right on every desktop (#70). +- Jobs and Server › Jobs: the Type column takes a larger share of the width (up to 170 px), so "Analisi approfondita" + is no longer cut in a 1440 px window; at the minimum width longer names still end in "…" with the whole name in the + tooltip (#70). ### Tests - The App suite ran whole on Windows for the first time since CI lost its Windows job: five screen smoke tests had gone diff --git a/docs/DECISIONS.md b/docs/DECISIONS.md index 8edf7c12..3829d3bf 100644 --- a/docs/DECISIONS.md +++ b/docs/DECISIONS.md @@ -899,3 +899,5 @@ One line per decision: date · decision · alternative · reason. | 2026-11-15 | The 1.0 service probe (`ServiceProbe`: `OpenSCManager` connect + `OpenService` query-status P/Invoke) runs when Server › This library opens and at each change of sharing state, shows a warning row whatever the state, and reads access denied as installed | `System.ServiceProcess` (not in the shared framework, a package); probe only after a port failure | Read-only and unelevated; the row is advice before sharing is turned on as much as after a failure | | 2026-11-16 | Until a Windows runner is registered, the App and Core.Windows suites and the screenshot diff run on the development PC before every release, and a release waits for them (#70) | Trust the Linux CI alone | The screen smoke tests had gone stale for weeks unnoticed: CI never runs them | | 2026-11-16 | `installer-test.ps1` is not run on a PC that has Chronos installed for all users: the setup finds the all-users install when no per-user one exists and asks for elevation to upgrade or remove it. It runs on a clean Windows (the CI windows job, a VM) | Point the script at another product name | The upgrade and legacy paths it checks only exist for the product `Chronos` | +| 2026-11-16 | The job log keeps storing each line's time in UTC (`HH:mm:ss`); the desktop shows it in local time, dating the lines backwards from the job's end (or now): each line is the latest instant at or before the next one. A pause of a day or more between two lines cannot be seen and those lines take the later day, so across a clock change they may be an hour off (#70) | Write local time into the log; store full UTC timestamps | A server's jobs are read from desktops in any time zone, logs already stored stay readable, and the stored format (shown as is by the admin panel) does not change | +| 2026-11-16 | The Type column of Jobs and Server › Jobs is a 1* share (was 0.7*), 90–170 px, so the Italian "Analisi approfondita" fits in a 1440 px window (#70) | `Auto` shared across the rows | `Auto` keeps its width at the minimum window, where the star columns are already at their minimums, and pushed the row actions out (Dutch, 12 px) | diff --git a/docs/STATUS.md b/docs/STATUS.md index 896229b6..7d527765 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -19,6 +19,7 @@ by its `windows` job once a Windows runner is registered (`WINDOWS_RUNNER`), and | 8.3 Owner review 2 | Done (request, answers and plan: `docs/requests/2026-10-26-owner-review-2.md`). Phase 1 done and released as `v0.1.0-rc.3` (one adversarial review round, 19 findings fixed; strings in all 38 languages): `:latest` follows the highest stable release, or the highest pre-release while none is stable (`Chronos.Tools release-channels`), `:nightly` stays the nightly build of `main` (R1); `CHRONOS_SPACE_PATH` and the Unraid template's *Array view* (`/mnt/user0/` read-only at `/space`) make the admin panel show the array's free space, the cache apart as *Write volume*, the file system in the tooltip, and completing an upload checks the archive volume first (507, resumable) (R2); the Settings icon is a toothed gear and the admin panel docks Settings at the foot of its sidebar (R4); About is the last page of Settings on the desktop and the last group of Settings on the admin panel (R5); Import › Folder… › *Whole folder* imports a folder as one sequence per format, titled after the folder (R9). Phase 2 done and released as `v0.1.0-rc.4` (one adversarial review round, 35 findings fixed; strings in all 38 languages): scheduled jobs (R10) — schedules (migration 0007) with an in-house recurrence form, one scheduler per host claiming runs by compare-and-set with catch-up, and Jobs › Scheduled on the desktop and the admin panel (`/api/v1/schedules`, `scheduleChanged`); every timer that queued work is a visible system schedule (server: archive scan, upload clean-up every 6 h, index backup at 03:00, job history and audit log clean-ups; desktop: archive scan, daily index backup, housekeeping with cache trim), the archive still scanned at start; new Backup and Clean-up jobs, duplicates and orphans reports as jobs, one backup retention, the trash only reported; log settings (R11) — file and console levels, retention, file and total size limits, daily or hourly rotation, audit retention (the audit clean-up schedule's) and the diagnostics share in the admin panel's Settings › Logs (`CHRONOS_LOG_*`, `lockedBy`) and the desktop's Settings › Advanced; the server's files take Debug and Trace again, and logging never fails a job. Phase 3 done and released as `v0.1.0-rc.5` (one adversarial review round and two fix rounds, 40 findings fixed; strings in all 38 languages; Library, photo delete and restore and the web upload tried by hand): the admin panel manages and never edits (R6) — a Library page (facets filters, cards or list, keyboard selection, mass Analyse, Proxies, Thumbnails, Verify, Tags, Export CSV and Delete, 1,000 sequences a request), a sequence's page (inline title, tags, rating, notes, photo viewer, cover, downloads, photo delete) and the trash view (Restore, Empty… behind a dry run, the typed word and a fingerprint); photos deleted into `trash/photos` under crash-safe journals with tombstones in the sidecar and `frame_removals` (migration 0008), so sync and uploads never bring them back unless restored or uploaded again on purpose; trash kinds, restore reasons and the `EmptyTrash` job on the desktop's Trash… too (typed entry count); the panel's files revalidated (`no-cache`, ETag); upload from the panel (R3) — file picker or drop, no folders, a self-tested in-house SHA-256 in a module worker, Exif capture time, resumable chunks. Known limitations: a never-hashed photo whose file was already missing is deleted without a tombstone; an unhashed server frame of a photo deleted on a PC stays *missing here* until the server verifies it; `jobState` carries no kind, so panel pages refresh after any job. Phase 4a done and released as `v0.1.0-rc.6` (one adversarial review round and six fix rounds; strings in all 38 languages): Reorganize after import (R7) on the desktop (Archive manager, Library, the toast after Settings › Archive templates change; it replaces Rename… and Move…) and the admin panel (Library, the *Saved* toast of Archive) — folder, file and title templates applied to filed sequences behind a dry run that lists every change, the photos that keep their names and why (in place, never verified, missing) and the sequences that stay whole (unreadable sidecar), applied by the `move` job of exactly the confirmed plan (fingerprint, `POST /api/v1/archive/reorganize`, plans kept a few minutes on the server), which holds the rest when paused, cancelled or failed (also while the archive is offline), lets a sequence still receiving photos keep its file names and takes along a sequence left as it was inside a folder that moves; files renamed in two phases under `.chronos/rename-files.json`, completed after a crash by the next writer; the index, frames and exports follow a moved folder in one transaction, here and at another index's next scan, and writers never create a folder a Reorganize left nor write into one another sequence took; import, upload and Reorganize name photos by one rule (the sequence's camera and lens), and templates follow one set of rules everywhere (no folder scans skip, the extension kept, names that tell photos apart), held only to templates given anew. Known limitations: a reader without the sequence's lease can miss a file while its files are renamed; a change made on disk alone after a server dry run is found by the job, which fails changing nothing; a photo restored from the trash after a Reorganize keeps its old name; a render of another program whose folder moves while it runs is not stopped. Phase 4b done and released as `v0.1.0-rc.7` (one adversarial review round, 42 findings, and three fix rounds; strings in all 38 languages): mass conversion after import (R7) on the desktop (the Archive manager's set, the Library's selection) and the admin panel (the Library's selection) — JPEG with a quality, TIFF-16 or linear DNG (the archival choice, scene-referred so a RAW's highlights above white and colours outside sRGB survive), Replace or New sequence chosen at every run and never remembered, behind a dry run that lists each sequence's photos and sizes, the photos that stay as they are and why (on the server, what it cannot read at full resolution: convert on a PC) and the free space where the conversion writes; Replace confirmed by typing; the `convert` job (stored as 19) converts exactly the photos confirmed (their digest in its parameters, their ids in `journal/convert-.photos`, pinned when it first comes to a sequence; a retried New sequence never makes a second copy), one sequence at a time and all or nothing, resumable through `journal/convert-.*` and `staging/convert-/`, never twice at once; full-resolution decodes with the managed decoders first (never a 16-bit file from an 8-bit RAW development, never a TIFF WIC would read as black or noise), what Chronos reads from a photo never changed (a JPEG or TIFF-16 carries the profile; a linear DNG takes sRGB values only, so Adobe RGB, Display P3, ProPhoto and gamma-1.0 photos go to TIFF-16 or JPEG), Exif carried, every file verified by the server's decoders; Replace swaps the files of the frames in place under `replace.pending.json`, the originals going into a replaced trash entry that the toast's Undo or Restore swaps back and that Empty erases only while the archive on disk shows each conversion intact, or deleted on its own word (a tombstone, the trash, or `trash/.erased/.json`; named first in its confirmation); import still copies byte for byte and the card keeps a converted photo's copy; sync and the ingest count every encoding of a photo as one; `POST /api/v1/archive/convert` in the plan cache Reorganize uses. Known limitations: a photo that fails although its headers read well leaves its sequence as it was; a decode larger than the memory stops the job; a damaged file that still decodes converts as decoded; a read error while a dry run reads a TIFF, DNG or TIFF-based RAW header lists the photo as needing a PC, preview-only or unreadable rather than held (the reader swallows it; nothing beyond the plan converts); JPEG and TIFF-16 clip float values beyond 0..1; not verified: a TIFF whose first image is a thumbnail and whose main image only WIC reads would convert at the thumbnail's size; a PNG's gamma and primaries without a profile count as sRGB; a linear DNG bakes the white balance in and clips below black; the desktop's Undo lives in the job's end toast only (later: Restore). Phase 5a done and released as `v0.1.0-rc.8` (one adversarial review round, 55 findings, and five fix rounds; strings in en and it): the desktop's workspace and projects with this PC's archive as the home (R8) — a sequence's projects (Main, mirrored both ways with the sequence's settings so older clients, analyses and sync keep working, and other named projects), each a linear history of immutable versions in the portable form (positions parked by photo, SHA-256 of canonical text), kept as sidecars in `.chronos/projects/` and indexed by migration 0009 (`projects`, `project_versions`, `renders.project_id`/`project_version_id`), deleted only on the archive's word (the projects' trash read first), healed from the index when a record is lost or behind, one Main decided from the records; Edit opens only workspace projects: *Open in workspace* (project, proxies, copy size and free space), the `workspace-copy` job (stored as 20, desktop only, hash-verified, resumable, space checked, its cancel clean-up under the project's lease), the working state in a folder outside the library, the title's project button (state chip; Save version with Ctrl+S, Sync, History with Compare and Restore, Open, New, Rename, Delete, Remove local copy after a plan), push and pull with replay and field-level merge under crash-safe journals, conflicts only where both sides changed a setting (Keep mine, Take library's, Save both, Later), Update media, newer and damaged copies named and left untouched, renders at the home with the settings embedded, `.chronos` format 2; Settings › Workspace (Folder with Change…, Sync, Kept versions). Known limitations: a server sequence still opens with proxies (the server home is 5b); originals, local render, moving the folder with its projects, emptying `/.trash`, clean-up and the size limit are 5c; a capture still edits the library; nothing restores from the projects' trash yet; a lost record waits 2 minutes of one running Chronos before it is written again. Phase 5b done and released as `v0.1.0-rc.10` on 2026-11-04 (`81c303f4`; one adversarial review round, 21 findings, 19 fixed; strings in all 38 languages): a Chronos Server as the home of its sequences' projects (R8) — `/api/v1/sequences/{sid}/projects` on the archive's `ProjectService` (list with Main made at the first read, create, rename, delete by the owner, the maker or an admin, head, versions in size-capped pages, the stored check, push with its outcome, the frames and their stamp), the `projects` capability and `projectChanged`, Main taking settings written outside the projects soon after (`ProjectCatchUp`), a settings `PATCH` writing `project.json` under the lease, no projects for a sequence without photos, renders and render nodes of a project version, and the admin panel's Projects section (versions, Rename, Delete); on the desktop `ServerProjectHome` through the signed-in session: *Open in workspace* in Edit and on the Server screen, the proxies downloaded into the workspace (hash-checked, resumable, thumbnails standing in while the server has no proxy), push, pull, conflicts, history and the chip against the server (*Server newer*, *Not on server*), renames followed, renders and analyses on the server of the version it holds after *Send and render*; an account without Edit and an older server keep *Open with proxies*. Known limitations: a copy reads the server's frames in one answer; *History* downloads every version's settings. A final check (2026-11-04) fixed what it left: Main's birth on an upgraded server keeps the settings an earlier release's `PATCH` wrote into the index alone (`IndexSettingsMayLead`), a pull never fails on the name it follows, the Server screen's row actions stay on one line and the capture shows sample paths (16 baselines recaptured: `server-*`, `settings-storage`, `settings-workspace`, `settings-advanced`, `archive-rebuild`). Phase 5c done and released as `v0.1.0-rc.11` on 2026-11-04 (`db389a54`; one adversarial review round, 35 findings, 32 confirmed and fixed, compat-2 in part; a final check fixed one more; strings in all 38 languages): originals in the workspace (R8) — *Open in workspace* › *Originals* (Default media first; sizes also for a server's sequence), *Copy originals…* and *Proxies only…* behind a plan, the copy from either home streamed, hash-checked against the home and resumable, a frame without a usable original keeping its proxy, media index format 2 and project file format 3 while originals are held (older Chronos refuses them); local render (`workspace-render`, stored as 21) from the workspace's originals into `exports/` with the ledger `renders.json`, *Version on render* saving a version first, and *Send render* (`workspace-send`, 22) to this PC's archive (staged, read back, filed under the lease) or to the server (`RenderUploadRequest` with `projectId`/`projectVersionId`, checked against the sequence, 422 `project_mismatch`), idempotent by render id, refusals per render, a version a replay renamed found by its content hash, the Export step's *Not sent* and *Send again*; *Pause metered transfers* holding uploads, the sync's downloads and the workspace's server copies and sends; originals judged by their bytes against the home's frames on removal, clean-up and Proxies only, the rest kept in the workspace's trash (entries filled under `.incoming-` names, emptied only by *Empty…* with the entry count typed and a fingerprint); the clean-up (`WorkspaceCleaner`: projects in step with their home, not open, without jobs or unsent renders; *Clean after* 30 days and *Size limit* 100 GB, the `workspace-cleanup` schedule daily at 04:30 and the limit after each copy); Remove local copy weighing unsent renders and originals; moving the workspace folder (`workspace-move`, 23; `WorkspaceMover`): a plan, renamed on one volume or copied and hash-verified across volumes, the journal `.move.json`, the source kept until the switch, resume and undo, jobs finding their project where the workspace is now (`WorkspaceJobRoots`), *Resume* in Settings; Settings › Workspace complete (Folder with Move…, Size limit, Default media, Sync, Version on render, Kept versions, Clean after, Open project, Trash). Known limitations: an older server drops a render's provenance and the render is still marked sent (logged); an original held open after Proxies only leaves the media index at format 1, so a downgraded 0.1.0-rc.10 could delete it; the removal plan's original count is an estimate and can fail when `media/originals` cannot be read; the Export tab's *Send again* view model has no unit test. | | 8.4 Owner review 4 | Done (request and plan: `docs/requests/2026-11-06-owner-review-4.md`): released as `v0.1.0-rc.14` with owner review 1 phase 6 (the deploy guide `docs/deploy/`), then as `v1.0.0` (#23), the first stable release: R1 work board of every video made or published, the published apart from workspace work (#29); R2 the anonymous usage counts removed, nothing sent by itself (#30); R3 the archive's whole folder structure created inside the chosen archive path, desktop and server (#31); R4 the repository on Gitea in order (earlier work as closed issues #32–#54 in their milestones, the original documentation in `docs/reference/original`, `fe50b877`); R5 licensing set aside and recorded in #24. | | 8.5 Owner review 5 | Done (request, answers and plan: `docs/requests/2026-11-15-owner-review-5.md`; issues #64–#67, milestone v1.1.0), released as `v1.1.0`: one setup for Chronos Desktop and Chronos Uploader with the Uploader's update check (#64); the detail of mass passes (step, photo x of y, sequence n of m, rate, time left) on the desktop, the admin panel and, for the connected server's jobs, the desktop's Server section (#65); separate homes per server keyed by a stable server id, with the 1.0 workspace and cache sorted at the first start and a separate originals archive per server (#66); Chronos Desktop sharing its library on the LAN in place of Chronos Server for Windows, running on in the tray while it shares (#67). One review round, 15 findings fixed; strings in all 38 languages. Not run on the PC: the Windows-only smoke tests, `installer-test.ps1` and the release dry run (CI runs them). Follow-ups: a firewall status row, Change…/Forget on known servers, the LAN beacon announcing the server id, docs/ui DESIGN and mockups for the new screens. | +| 8.6 Windows test of 1.1.0 | Done (#70, milestone v1.1.1), released as `v1.1.1`: the App and Core.Windows suites run whole on the development PC (5 stale screen tests brought up to date); a hands-on test of a portable 1.1.0 (import, Reorganize, sharing, a client, tray, Exit with clients); fixes: job log times in local time, the Jobs Type column, Forget in Bulgarian, the Reorganize capture. Still to do by the owner: the real 1.0 → 1.1 upgrade on this PC (UAC). | | 9 Monetization | Not started: requires explicit approval (§22); the proposal is recorded in issue #24 (owner review 4, R5). | ## Verification (2026-10-12) @@ -64,6 +65,7 @@ src/Chronos.App/bin/Release/net10.0-windows/Chronos.exe --capture out/screenshot - Homes: start 1.1 on a 1.0 data folder (portable copy): the toast says *Folders sorted*; Settings › Workspace › Home folders and Settings › Server › Known servers list the folders. Sign in to the same server by another address: its projects stay Online. *Download originals* goes to ` - `. + - Job log time (1.1.1): Jobs › expand a job: the log times match the row times (local). - Share this library: Settings › Server › *Share this library*, then Server › This library; connect the Uploader or another PC to the address shown. - Import: Import › *Folder…* (any folder of photos stands in for a card) › *Import*; the sequence opens from the diff --git a/src/Chronos.App/DesignTime/SampleData.cs b/src/Chronos.App/DesignTime/SampleData.cs index 4f4075af..4d2945fd 100644 --- a/src/Chronos.App/DesignTime/SampleData.cs +++ b/src/Chronos.App/DesignTime/SampleData.cs @@ -46,7 +46,7 @@ public sealed class SampleData /// /// The sample's "now": every time it stores (jobs, transfers, renders, cards, the trash) is set from it, never from /// the computer's clock, and --capture freezes at it, so the screenshots are the same - /// on any day (the running render's log reads 10:14 to 10:15). + /// on any day (the running render's log stores 10:14 to 10:15 UTC and shows them in local time, as the rows). /// public static readonly DateTimeOffset Now = new(2026, 10, 2, 10, 18, 0, TimeSpan.Zero); diff --git a/src/Chronos.App/Jobs/JobLogTimes.cs b/src/Chronos.App/Jobs/JobLogTimes.cs new file mode 100644 index 00000000..3e85354b --- /dev/null +++ b/src/Chronos.App/Jobs/JobLogTimes.cs @@ -0,0 +1,40 @@ +using System.Globalization; + +namespace Chronos.App.Jobs; + +/// +/// The job log stores each line's time of day in UTC ("12:35:04 Copying…"), the same on the server and the desktop. +/// The Jobs table shows its times in local time, so the log's are shown in local time too (#70). +/// +public static class JobLogTimes +{ + /// + /// with each leading HH:mm:ss turned from UTC into 's time. + /// The log keeps no dates, so they are worked out backwards from (when the job finished, or + /// now): each line is the latest instant at or before the line after it, so a run that goes past midnight UTC, or lasts + /// days, dates its lines right and a daylight-saving change in between converts each side with its own offset. A pause + /// of a day or more between two lines cannot be seen, and those lines keep the later day's date. Lines without a time + /// stay as they are. + /// + public static string ToLocal(string tail, DateTimeOffset reference, TimeZoneInfo zone) + { + ArgumentNullException.ThrowIfNull(tail); + ArgumentNullException.ThrowIfNull(zone); + if (tail.Length == 0) return tail; + // A minute of slack: the reference may be read a little before the last line's clock (another machine's). + var next = reference.UtcDateTime.AddMinutes(1); + var lines = tail.Split('\n'); + for (var i = lines.Length - 1; i >= 0; i--) + { + var line = lines[i]; + if (line.Length < 9 || line[8] != ' ' || + !TimeSpan.TryParseExact(line.AsSpan(0, 8), @"hh\:mm\:ss", CultureInfo.InvariantCulture, out var time)) continue; + var utc = DateTime.SpecifyKind(next.Date + time, DateTimeKind.Utc); + if (utc > next) utc = utc.AddDays(-1); + next = utc; + var local = TimeZoneInfo.ConvertTimeFromUtc(utc, zone); + lines[i] = local.ToString("HH:mm:ss", CultureInfo.InvariantCulture) + line[8..]; + } + return string.Join('\n', lines); + } +} diff --git a/src/Chronos.App/Jobs/JobRowViewModel.cs b/src/Chronos.App/Jobs/JobRowViewModel.cs index 459522cf..e4be39ec 100644 --- a/src/Chronos.App/Jobs/JobRowViewModel.cs +++ b/src/Chronos.App/Jobs/JobRowViewModel.cs @@ -115,12 +115,12 @@ public sealed class JobRowViewModel : ObservableObject /// "Show log: Render · Harbour sunset": the expander names its row. public string ToggleName => Loc.L("Jobs.ActionFor", Loc.L(_isExpanded ? "Jobs.Log.Hide" : "Jobs.Log.Show"), AccessibleName); - /// The last lines of the job log, plus the live message while it runs. + /// The last lines of the job log in local time, plus the live message while it runs. public string LogText { get { - var tail = _logTail ?? _entry.Job.LogTail ?? string.Empty; + var tail = JobLogTimes.ToLocal(_logTail ?? _entry.Job.LogTail ?? string.Empty, _entry.Job.Finished ?? AppClock.Shown(DateTimeOffset.UtcNow), TimeZoneInfo.Local); if (_entry.State == JobState.Running && _entry.Message is { Length: > 0 } message && !tail.EndsWith(message, StringComparison.Ordinal)) tail = tail.Length == 0 ? message : tail + "\n" + message; return tail.Length == 0 ? Loc.L("Jobs.Log.Empty") : tail; diff --git a/src/Chronos.App/Sections/JobsView.xaml b/src/Chronos.App/Sections/JobsView.xaml index 35b2a686..bb67562c 100644 --- a/src/Chronos.App/Sections/JobsView.xaml +++ b/src/Chronos.App/Sections/JobsView.xaml @@ -143,7 +143,7 @@ windows Kind, Where and State stop growing and Target takes the rest (Jobs.html). --> - + @@ -174,7 +174,7 @@ - + diff --git a/src/Chronos.App/Server/ServerJobsView.xaml b/src/Chronos.App/Server/ServerJobsView.xaml index 6f9245a2..0536e9f2 100644 --- a/src/Chronos.App/Server/ServerJobsView.xaml +++ b/src/Chronos.App/Server/ServerJobsView.xaml @@ -46,7 +46,7 @@ - + @@ -72,7 +72,7 @@ - + diff --git a/tests/Chronos.App.Tests/Jobs/JobLogTimesTests.cs b/tests/Chronos.App.Tests/Jobs/JobLogTimesTests.cs new file mode 100644 index 00000000..9e37278e --- /dev/null +++ b/tests/Chronos.App.Tests/Jobs/JobLogTimesTests.cs @@ -0,0 +1,48 @@ +using Chronos.App.Jobs; +using Chronos.Testing; + +namespace Chronos.App.Tests.Jobs; + +/// The job log stores UTC times; the Jobs table shows them in local time like the rows (#70). +public sealed class JobLogTimesTests +{ + private static readonly TimeZoneInfo Rome = TimeZoneInfo.CreateCustomTimeZone("Test+1", TimeSpan.FromHours(1), "Test+1", "Test+1"); + + [Test] + public void LeadingTimesTurnLocal() + { + var finished = new DateTimeOffset(2026, 11, 16, 12, 40, 0, TimeSpan.Zero); + var tail = "12:35:04 Copying photos\n12:36:10 Done\nno time here"; + Assert.Equal("13:35:04 Copying photos\n13:36:10 Done\nno time here", JobLogTimes.ToLocal(tail, finished, Rome)); + } + + [Test] + public void ALineBeforeMidnightBelongsToTheDayBefore() + { + // Finished at 00:10 UTC on the 17th: 23:58 is the 16th's, and both days convert with their own offset. + var finished = new DateTimeOffset(2026, 11, 17, 0, 10, 0, TimeSpan.Zero); + var zone = TimeZoneInfo.CreateCustomTimeZone("Test-5", TimeSpan.FromHours(-5), "Test-5", "Test-5"); + Assert.Equal("18:58:00 Start\n19:05:00 End", JobLogTimes.ToLocal("23:58:00 Start\n00:05:00 End", finished, zone)); + } + + [Test] + public void ARunLongerThanADayDatesEachLineAcrossTheClockChange() + { + // Rome leaves summer time on 2026-10-25 at 01:00 UTC. A run from the 24th 10:00 UTC to the 25th 11:00 UTC: its + // first line is a day and more before the end, still in summer time (12:00), its last after the change (12:00). + var rome = TimeZoneInfo.FindSystemTimeZoneById("Europe/Rome"); + var finished = new DateTimeOffset(2026, 10, 25, 12, 0, 0, TimeSpan.Zero); + var tail = "10:00:00 Start\n23:00:00 Midway\n11:00:00 End"; + Assert.Equal("12:00:00 Start\n01:00:00 Midway\n12:00:00 End", JobLogTimes.ToLocal(tail, finished, rome)); + } + + [Test] + public void TextWithoutTimesStaysAsItIs() + { + var now = DateTimeOffset.UtcNow; + Assert.Equal(string.Empty, JobLogTimes.ToLocal(string.Empty, now, Rome)); + Assert.Equal("1:2:3 short", JobLogTimes.ToLocal("1:2:3 short", now, Rome)); + Assert.Equal("12:35:04", JobLogTimes.ToLocal("12:35:04", now, Rome)); + Assert.Equal("ab:cd:ef text", JobLogTimes.ToLocal("ab:cd:ef text", now, Rome)); + } +} diff --git a/tests/Chronos.App.Tests/Jobs/JobsScreenSmokeTests.cs b/tests/Chronos.App.Tests/Jobs/JobsScreenSmokeTests.cs index 96271f2d..0d22f45c 100644 --- a/tests/Chronos.App.Tests/Jobs/JobsScreenSmokeTests.cs +++ b/tests/Chronos.App.Tests/Jobs/JobsScreenSmokeTests.cs @@ -129,6 +129,47 @@ public sealed class JobsScreenSmokeTests } }); + /// + /// In a 1440 px window (a 1920 px screen at 100 %), the Type column shows the Italian kinds whole, the longest + /// "Analisi approfondita" included: it was cut at a 0.7* share (#70). + /// + [Test] + public Task KindsFitTheTypeColumnInItalianAt1440() => ScreenHost.RunAsync(async () => + { + await using var app = await ScreenSmokeTests.SampleApp.StartAsync(); + var shell = app.Shell; + await app.Sample.FillAsync(); + await shell.Jobs.ReloadAsync(); + shell.Navigate(SectionKey.Jobs); + await app.ExpectAsync("jobs"); + app.Window.Width = 1440; + UiLanguage.Apply("it"); + try + { + app.Window.UpdateLayout(); + await app.Window.Dispatcher.InvokeAsync(() => { }, System.Windows.Threading.DispatcherPriority.ApplicationIdle); + var items = app.FindAll().Where(i => i.DataContext is JobRowViewModel && i.IsVisible).ToList(); + Assert.True(items.Count > 3, "several rows are on screen"); + foreach (var item in items) + { + var row = (JobRowViewModel)item.DataContext; + var kind = Descendants(item).First(t => t.Text == row.Kind); + Assert.True(Needed(kind, kind.Text) <= kind.ActualWidth + 0.5, $"'{row.Kind}' needs {Needed(kind, kind.Text):0.0} px, has {kind.ActualWidth:0.0}"); + var deep = JobText.Kind(Core.Model.JobKind.DeepAnalyse); + Assert.True(Needed(kind, deep) <= kind.ActualWidth + 0.5, $"'{deep}' needs {Needed(kind, deep):0.0} px, has {kind.ActualWidth:0.0}"); + } + } + finally + { + UiLanguage.Apply("en"); + } + }); + + /// The width takes in 's font. + private static double Needed(TextBlock cell, string text) => new FormattedText(text, System.Globalization.CultureInfo.CurrentUICulture, cell.FlowDirection, + new Typeface(cell.FontFamily, cell.FontStyle, cell.FontWeight, cell.FontStretch), cell.FontSize, Brushes.Black, + VisualTreeHelper.GetDpi(cell).PixelsPerDip).WidthIncludingTrailingWhitespace; + /// The left and right edges of an element in window coordinates, whichever way the window reads. private static (double Left, double Right) Span(FrameworkElement element, Window window) { diff --git a/tests/visual/baselines/jobs-dark.png b/tests/visual/baselines/jobs-dark.png index 1cedf3aa..ed427b50 100644 Binary files a/tests/visual/baselines/jobs-dark.png and b/tests/visual/baselines/jobs-dark.png differ diff --git a/tests/visual/baselines/jobs-light.png b/tests/visual/baselines/jobs-light.png index 549a3daa..18310bf7 100644 Binary files a/tests/visual/baselines/jobs-light.png and b/tests/visual/baselines/jobs-light.png differ diff --git a/tests/visual/baselines/server-jobs-dark.png b/tests/visual/baselines/server-jobs-dark.png index e65ab564..0ad010b0 100644 Binary files a/tests/visual/baselines/server-jobs-dark.png and b/tests/visual/baselines/server-jobs-dark.png differ diff --git a/tests/visual/baselines/server-jobs-light.png b/tests/visual/baselines/server-jobs-light.png index d0858c90..5a05864a 100644 Binary files a/tests/visual/baselines/server-jobs-light.png and b/tests/visual/baselines/server-jobs-light.png differ diff --git a/tests/visual/baselines/settings-about-dark.png b/tests/visual/baselines/settings-about-dark.png index 8cdea5b8..1fe6af60 100644 Binary files a/tests/visual/baselines/settings-about-dark.png and b/tests/visual/baselines/settings-about-dark.png differ diff --git a/tests/visual/baselines/settings-about-light.png b/tests/visual/baselines/settings-about-light.png index 0f99d103..3ac4beb9 100644 Binary files a/tests/visual/baselines/settings-about-light.png and b/tests/visual/baselines/settings-about-light.png differ