Tau.Acuvim/portal/src/Tau.Acuvim.Portal/DTOs/ConfigOverviewDtos.cs
Diseri Pearson aaa522058e Settings → App config: surface RunMode + FleetIngest push state
ConfigOverviewService now reports the runtime mode and (on Client only)
the fleet-push configuration + live push-state per resource. The token
is reduced to a boolean (TokenConfigured) in the DTO — never a string —
so it cannot be accidentally serialised.

Backend
- FleetIngestInfoDto: { enabled, url, intervalSeconds, batchSize,
  batchMaxBytes, tokenConfigured }. No Token property at all.
- FleetPushStateRowDto: { resourceType, lastCursor, lastSyncedAt,
  consecutiveFailures, lastError }.
- ConfigOverviewDto gains RunMode (string), nullable FleetIngest +
  FleetPushState (null in Admin mode).
- ConfigOverviewService becomes async + injects IServiceProvider so it
  can read AppDbContext in Client mode without that DbContext being
  required (GetService returns null in Admin mode, where it's not
  registered).
- AdminConfigEndpoints awaits the async call.

Tests (+3, 56/56 passing)
- FleetIngestInfoDto has no Token property (reflection check).
- Serialised DTO never contains the literal token value (string scan).
- ConfigOverviewDto's FleetIngest + FleetPushState are nullable so
  Admin-mode payloads serialise them as absent rather than empty.

Frontend
- ConfigOverviewCard adds a Run mode row to the Application section
  (gold tag for Admin, blue for Client).
- New "Fleet push (Client → Admin)" descriptions card (enabled, token
  configured, url, interval, batch sizes) — hidden in Admin mode.
- "Push state per resource" table — resource, last cursor, last sync,
  consecutive failures (color-coded), last error.

Verified end-to-end on the dev host
- /api/admin/config-overview on the Client returns runMode=Client +
  fleetIngest={enabled,url,interval,batchSize,batchMaxBytes,tokenConfigured}
  + fleetPushState[3] rows (sites/devices/measurements, failures=0).
- The 64-char dev token (from the running Client's .env) is verified
  absent from the response body via direct string search.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 10:33:52 +02:00

54 lines
1.5 KiB
C#

namespace Tau.Acuvim.Portal.DTOs;
public sealed record AppInfoDto(string Name, string Environment, string PublicUrl);
public sealed record DatabaseInfoDto(
string Provider,
string Host,
int Port,
string Database,
bool MigrateOnStartup,
bool AutoProvisionLocalTimescaleDb,
string ResolvedVia);
public sealed record GrafanaInfoDto(
string BaseUrl,
string InternalUrl,
string EmbedPathPrefix,
string EmbedMode,
string DefaultDashboardUid,
string AuthMode,
int DashboardCount);
public sealed record MonitoringInfoDto(string ChunkTimeInterval, bool EnableHourlyAggregates);
public sealed record AuthInfoDto(string CookieName, bool RequireConfirmedEmail, string DefaultAdminEmail);
public sealed record BuildInfoDto(string AssemblyVersion, string Framework, DateTime StartedAtUtc);
public sealed record FleetIngestInfoDto(
bool Enabled,
string Url,
int IntervalSeconds,
int BatchSize,
int BatchMaxBytes,
bool TokenConfigured);
public sealed record FleetPushStateRowDto(
string ResourceType,
DateTime? LastCursor,
DateTime? LastSyncedAt,
int ConsecutiveFailures,
string? LastError);
public sealed record ConfigOverviewDto(
string RunMode,
AppInfoDto Application,
DatabaseInfoDto Database,
GrafanaInfoDto Grafana,
MonitoringInfoDto Monitoring,
AuthInfoDto Authentication,
BuildInfoDto Build,
FleetIngestInfoDto? FleetIngest,
IReadOnlyList<FleetPushStateRowDto>? FleetPushState);