@page "/logs" @rendermode @(Microsoft.AspNetCore.Components.Web.RenderMode.InteractiveServer) @using TrafagSalesExporter.Services @inject ILogsPageService LogsPageActions @inject ISnackbar Snackbar @inject IDialogService DialogService @inject TrafagSalesExporter.Services.IUiTextService UiText @T("Logs", "Logs") @T("Export Logs", "Export Logs") @foreach (var land in _availableLands) { @land } OK Error @T("Filtern", "Filter") @T("Alte Logs loeschen", "Delete old logs") @T("Zeitpunkt", "Timestamp") @T("Land", "Country") TSC @T("Status", "Status") @T("Zeilen", "Rows") @T("Dauer", "Duration") @T("Dateiname", "File name") @T("Fehler", "Error") @context.Timestamp.ToString("dd.MM.yyyy HH:mm:ss") @context.Land @context.TSC @if (context.Status == "OK") { OK } else { Error } @context.RowCount.ToString("N0") @($"{context.DurationSeconds:F1}s") @context.FileName @if (!string.IsNullOrEmpty(context.ErrorMessage)) { @context.ErrorMessage } @T("Technische Logs", "Technical logs") @T("Zeitpunkt", "Timestamp") Level @T("Kategorie", "Category") @T("Land", "Country") @T("Meldung", "Message") Details @context.Timestamp.ToString("dd.MM.yyyy HH:mm:ss") @context.Level @context.Category @(string.IsNullOrWhiteSpace(context.Land) ? "-" : context.Land) @context.Message @if (!string.IsNullOrWhiteSpace(context.Details)) { @context.Details } @code { private List _logs = new(); private List _appLogs = new(); private List _availableLands = new(); private string? _filterLand; private string? _filterStatus; private DateTime? _filterDate; private bool _loading = true; protected override async Task OnInitializedAsync() { await LoadLogsAsync(); } private async Task LoadLogsAsync() { _loading = true; var state = await LogsPageActions.LoadAsync(_filterLand, _filterStatus, _filterDate); _availableLands = state.AvailableLands; _logs = state.Logs; _appLogs = state.AppLogs; _loading = false; } private async Task ApplyFilter() { await LoadLogsAsync(); } private async Task DeleteOldLogs() { var result = await DialogService.ShowMessageBox( T("Alte Logs loeschen", "Delete old logs"), T("Logs aelter als 90 Tage loeschen?", "Delete logs older than 90 days?"), yesText: T("Loeschen", "Delete"), cancelText: T("Abbrechen", "Cancel")); if (result != true) return; var deletedCount = await LogsPageActions.DeleteOldLogsAsync(90); await LoadLogsAsync(); Snackbar.Add(string.Format(T("{0} alte Logs geloescht", "{0} old logs deleted"), deletedCount), Severity.Info); } } @code { private string T(string german, string english) => UiText.Text(german, english); }