using CommunityToolkit.Mvvm.ComponentModel; using XFEExtension.NetCore.XFEConsole; using XFEWorkflow.Infrastructure.Storage; using XFEWorkflow.Services; namespace XFEWorkflow.ViewModels; public sealed partial class LogViewPageViewModel : ObservableObject { public List Entries { get; private set; } = []; public async Task RefreshAsync() => Entries = await Task.Run(() => AppServices.Current.Logs.HistoryAsync()); public WorkflowLogEntry[] Filter(string search, string category, LogLevel? level, string? workflowId, string? runId, DateTime since) => Entries.Where(x => x.Time >= since && (category.Length == 0 || x.Category == category) && (level is null || x.Level == level) && (workflowId is null || x.WorkflowId == workflowId) && (runId is null || x.RunId == runId) && x.SearchText.Contains(search.Trim(), StringComparison.OrdinalIgnoreCase)).ToArray(); }