Interfaccia, parte 2: Attività, Impostazioni, collegamento, Importa, doppioni, primo avvio ed errori di configurazione

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01Mzbb6zeFTjT6Rp8b92AVkA
This commit is contained in:
Claude committed 2026-10-13 20:27:34 +00:00
1 parent 0515776b04
commit d614050ee5
90 files changed
+7825 -49

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
namespace Febe.Web.Engine;
/// <summary>A still frame of Febe's browser for the Attività page (mockup 06: one frame every few seconds, not a video).</summary>
/// <param name="Jpeg">The frame, JPEG encoded.</param>
/// <param name="Url">Address of the page, without query string.</param>
/// <param name="At">When the frame was taken.</param>
public sealed record BrowserFrame(byte[] Jpeg, string? Url, DateTimeOffset At);
/// <summary>
/// The latest frame of Febe's browser, for the preview of the Attività page. Implemented by the composition over the
/// browser host (Docker: the screencast of the remote view; Windows: the WebView2). Taking frames is never an action
/// toward the site: it reads what the browser already shows.
/// </summary>
public interface IBrowserPreview
{
/// <summary>The latest frame, or null when there is none (no browser, blank rest page, no frame yet).</summary>
Task<BrowserFrame?> GetLatestAsync(CancellationToken ct);
}
/// <summary>No preview (default): the page shows a neutral box with the state of the browser.</summary>
public sealed class NoBrowserPreview : IBrowserPreview
{
public Task<BrowserFrame?> GetLatestAsync(CancellationToken ct) => Task.FromResult<BrowserFrame?>(null);
}
@@ -0,0 +1,29 @@
using Febe.Core.Engine;
using Febe.Core.Storage;
namespace Febe.Web.Engine;
/// <summary>
/// «Limiti e comportamento» (mockup 07, spec §7.5): stores new engine settings and applies them. A separate interface
/// from <see cref="IEngineControl"/> so that existing implementations stay as they are.
/// </summary>
public interface IEngineSettingsControl
{
/// <summary>
/// Validates, stores and applies the settings. Throws <see cref="ArgumentException"/> with Italian messages when a
/// value is outside the limits of spec §7.5 (the API answers 400 with that message).
/// </summary>
Task ApplyAsync(EngineSettings settings, CancellationToken ct);
}
/// <summary>The real engine: stores the settings and replans at once (<see cref="EngineHost.ApplySettingsAsync"/>).</summary>
public sealed class EngineHostSettingsControl(EngineHost host) : IEngineSettingsControl
{
public Task ApplyAsync(EngineSettings settings, CancellationToken ct) => host.ApplySettingsAsync(settings, ct);
}
/// <summary>No engine in this process: the settings are stored and the engine reads them when it starts.</summary>
public sealed class StoredEngineSettingsControl(IFebeStorage storage) : IEngineSettingsControl
{
public Task ApplyAsync(EngineSettings settings, CancellationToken ct) => EngineSettingsStore.SaveAsync(storage.Settings, settings, ct);
}
+21
View File
@@ -0,0 +1,21 @@
using Febe.Core.Domain;
using Febe.Core.Storage;
namespace Febe.Web.Engine;
/// <summary>The stops of the last days for the Attività page (spec §7.6: «nella cronologia della pagina Attività»).</summary>
public interface IIncidentHistory
{
/// <summary>Incidents that started in [from, to), newest first.</summary>
Task<IReadOnlyList<Incident>> ListAsync(DateTimeOffset from, DateTimeOffset to, CancellationToken ct);
}
/// <summary>The incidents of the database (table <c>incident</c>).</summary>
public sealed class StoredIncidentHistory(IFebeStorage storage) : IIncidentHistory
{
public async Task<IReadOnlyList<Incident>> ListAsync(DateTimeOffset from, DateTimeOffset to, CancellationToken ct)
{
var list = await storage.Incidents.ListAsync(from, to, ct).ConfigureAwait(false);
return [.. list.OrderByDescending(i => i.At)];
}
}