Add debug export functionality for channel analysis
ci / build-backend (push) Successful in 1m16s
ci / build-frontend (push) Successful in 42s
ci / tests (push) Successful in 1m24s
ci / sonar (push) Successful in 5m9s

Implemented a new endpoint for exporting debug data related to channel scheduling, allowing users to download an archive containing channel settings, slot states, and trace information. Updated the frontend to include a button for triggering the export, along with necessary API adjustments for handling the download. Enhanced localization strings to support the new debug export feature in both English and Russian. Updated .gitignore to include debug export files while ensuring the directory structure is maintained for development.
This commit is contained in:
Leonid Pershin
2026-07-31 02:58:17 +03:00
parent 01ba48e163
commit 9cd364b174
21 changed files with 1055 additions and 7 deletions
@@ -8,6 +8,7 @@ using TeleWave.Application.Broadcast.ListChannels;
using TeleWave.Application.Broadcast.UpdateChannelSettings;
using TeleWave.Application.Broadcast.UpdateChannelTime;
using TeleWave.Application.Broadcast.UpdateViewerSettings;
using TeleWave.Application.Programming.Planning.DebugExport;
using TeleWave.Application.Programming.Planning.Trace;
using TeleWave.Domain.Broadcast;
using TeleWave.Infrastructure.Identity;
@@ -45,9 +46,29 @@ public static class ChannelEndpoints
// «Почему это здесь»: цепочка происхождения записи, записанная в момент генерации.
admin.MapGet("/entries/{entryId:guid}/trace", GetEntryTrace).Produces<EntryTraceDto>();
// Отладочный дамп: вход планировщика и результат одним архивом.
admin.MapPost("/{id:guid}/debug-export", ExportDebug).Produces(StatusCodes.Status200OK);
return app;
}
/// <summary>
/// Отдаёт архив со снимком канала. POST, а не GET: команда оставляет копию дампа на сервере,
/// и кэшировать такой ответ никому не следует.
/// </summary>
private static async Task<IResult> ExportDebug(
Guid id,
ISender sender,
CancellationToken cancellationToken
)
{
var result = await sender.Send(new ExportChannelDebugCommand(id), cancellationToken);
if (!result.IsSuccess)
return result.ToHttpResult();
return Results.File(result.Value.Content, "application/zip", result.Value.FileName);
}
private static async Task<IResult> UpdateViewerSettings(
Guid id,
UpdateViewerSettingsBody body,
@@ -20,5 +20,10 @@
},
"Storage": {
"RootPath": ".dev-media"
},
// Отладочные дампы каналов ложатся в папку репозитория: разбирать «почему сетка построилась
// так» приходится рядом с кодом. Путь относительный — от рабочего каталога Api (backend/src/TeleWave.Api).
"Debug": {
"ExportDirectory": "../../../debug-exports"
}
}