@using TIAM.Entities.Products @using TIAM.Entities.Transfers @using TIAM.Entities.Drivers @using TIAM.Entities.Users @using TIAM.Models.Dtos.Users @using TIAM.Services @using TIAMSharedUI.Shared.Components.Grids @using TIAMWebApp.Shared.Application.Interfaces @using TIAMWebApp.Shared.Application.Models.ClientSide.UI @using TIAMWebApp.Shared.Application.Services @using TIAMWebApp.Shared.Application.Utility @using TIAM.Core.Loggers @using AyCode.Core.Loggers @using AyCode.Services.Loggers @using AyCode.Core @using AyCode.Core.Extensions @using AyCode.Core.Helpers @using Castle.Components.DictionaryAdapter @using DevExpress.Data.Filtering @using DevExpress.DirectX.Common.Direct2D @using TIAM.Core.Enums @inject IServiceProviderDataService ServiceProviderDataService @inject IEnumerable LogWriters @inject AdminSignalRClient AdminSignalRClient @inject IWizardProcessor WizardProcessor @inject IUserDataService UserDataService @* VirtualScrollingEnabled="true" *@ @{ var a = ((LogItemViewerModel)context.DataItem); }
@($"{a.CategoryName}->{a.CallerName}")

@($"{a.Text}")

Exception:

@a.Exception

@code { [Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never; private LogViewerGrid _logViewerGrid; private static DateTime _fromDate = DateTime.Today.AddDays(-2); private static DateTime _toDate = DateTime.Today; private static int _takeCount = 250; private object[] _contextParams = [_takeCount, _fromDate, _toDate]; private LoggerClient _logger; private static List _selectedLogLevels = [LogLevel.Error, LogLevel.Warning, LogLevel.Suggest]; private static string _filterText = GetFilterText(_selectedLogLevels); protected override void OnInitialized() { _logger = new LoggerClient(LogWriters.ToArray()); base.OnInitialized(); } private static string GetFilterText(ICollection selectedLogLevels) => selectedLogLevels.Count == 0 ? string.Empty : CriteriaOperator.FromLambda(t => selectedLogLevels.Contains(t.LogLevel)).ToString(); void TagBox_ValuesChanged(IEnumerable newSelectedLogLevels) { var filterText = string.Empty; InOperator? filterCriteria = null; _selectedLogLevels = newSelectedLogLevels.ToList(); if (_selectedLogLevels.Count > 0) { filterCriteria = new InOperator(nameof(LogItemViewerModel.LogLevel), _selectedLogLevels); filterText = GetFilterText(_selectedLogLevels); } _filterText = filterText; _logViewerGrid.SetFieldFilterCriteria(nameof(LogItemViewerModel.LogLevel), filterCriteria); } private async Task OnValueChangedTakeCount(int value) { if (_takeCount == value) return; _takeCount = value; _contextParams[0] = _takeCount; await _logViewerGrid.ReloadDataSourceAsync(); } private async Task OnValueChangedStartDate(DateTime value) { if (_fromDate == value) return; _fromDate = value; if (_fromDate.Date > DateTime.Today.Date) _fromDate = DateTime.Today; _contextParams[1] = _fromDate; if (_fromDate.Date > _toDate.Date) return; await _logViewerGrid.ReloadDataSourceAsync(); } private async Task OnValueChangedEndDate(DateTime value) { if (_toDate == value) return; _toDate = value; _contextParams[2] = _toDate; if (_fromDate.Date > _toDate.Date) return; await _logViewerGrid.ReloadDataSourceAsync(); } void Grid_CustomizeElement(GridCustomizeElementEventArgs e) { if (e.ElementType != GridElementType.DataRow) return; var logLevelObject = e.Grid?.GetRowValue(e.VisibleIndex, nameof(LogItemViewerModel.LogLevel)); if (logLevelObject == null) return; var levelObject = (LogLevel)logLevelObject; switch (levelObject) { case LogLevel.Detail: break; case LogLevel.Trace: break; case LogLevel.Debug: break; case LogLevel.Info: break; case LogLevel.Suggest: break; case LogLevel.Warning: e.CssClass = "bg-attention"; break; case LogLevel.Error: e.CssClass = "bg-important"; break; case LogLevel.Disabled: break; } } }