ContextIds set to object[] ; improvements, fixes, etc..
This commit is contained in:
parent
38bf25f42d
commit
efb1d18ad1
|
|
@ -663,8 +663,8 @@ namespace TIAM.Database.DataLayers.Admins
|
|||
|
||||
#region Logs
|
||||
|
||||
public Task<List<AcLogItem>> GetLogItemsAsync(int takeCount = 500) => SessionAsync(ctx => ctx.LogItems.Take(takeCount).ToList());
|
||||
public Task<List<AcLogItem>> GetLogItemsByFilterAsync(CriteriaOperator criteriaOperator, int takeCount = 500) => SessionAsync(ctx => (ctx.LogItems.AppendWhere(new CriteriaToExpressionConverter(), criteriaOperator).Take(takeCount) as IQueryable<AcLogItem>)!.ToList());
|
||||
public Task<List<AcLogItem>> GetLogItemsAsync(int takeCount, DateTime utcFromDate, DateTime utcToDate) => SessionAsync(ctx => ctx.LogItems.Where(x => x.TimeStampUtc.Date >= utcFromDate.Date && x.TimeStampUtc.Date <= utcToDate.Date).Take(takeCount).ToList());
|
||||
public Task<List<AcLogItem>> GetLogItemsByFilterAsync(CriteriaOperator criteriaOperator, int takeCount, DateTime utcFromDate, DateTime utcToDate) => SessionAsync(ctx => (ctx.LogItems.Where(x => x.TimeStampUtc.Date >= utcFromDate.Date && x.TimeStampUtc.Date <= utcToDate.Date).AppendWhere(new CriteriaToExpressionConverter(), criteriaOperator).Take(takeCount) as IQueryable<AcLogItem>)!.ToList());
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
<div class="w-100 ch-220">
|
||||
<CompanyByIdDetailGrid @ref="_gridCompany"
|
||||
Context="myContext"
|
||||
ContextIds="@CompanyId"
|
||||
ContextIds="@(CompanyId?.Cast<object>().ToArray())"
|
||||
Logger="_logger"
|
||||
SignalRClient="AdminSignalRClient"
|
||||
CustomizeElement="Grid_CustomizeElement"
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
<AddressDetailGrid @ref="_addressGrid"
|
||||
ContextIds="new[] {ParentData.AddressId}"
|
||||
ContextIds="new object[] {ParentData.AddressId}"
|
||||
DataSource="DataSource"
|
||||
Logger="_logger"
|
||||
SignalRClient="AdminSignalRClient"
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
|
||||
<UserProductMappingDriverGrid Logger="_logger"
|
||||
@ref="_driverGrid"
|
||||
ContextIds="new [] {ContextId}"
|
||||
ContextIds="new object[] {ContextId}"
|
||||
GetAllMessageTag="GetAllTag"
|
||||
SignalRClient="AdminSignalRClient"
|
||||
PageSize="10"
|
||||
|
|
|
|||
|
|
@ -14,8 +14,10 @@
|
|||
@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<IAcLogWriterClientBase> LogWriters
|
||||
|
|
@ -27,6 +29,7 @@
|
|||
@* VirtualScrollingEnabled="true" *@
|
||||
<LogViewerGrid Logger="_logger"
|
||||
@ref="_logViewerGrid"
|
||||
ContextIds="_contextParams"
|
||||
SignalRClient="AdminSignalRClient"
|
||||
FilterText="@_filterText"
|
||||
ShowGroupPanel="true"
|
||||
|
|
@ -56,16 +59,60 @@
|
|||
var a = ((LogItemViewerModel)context.DataItem);
|
||||
}
|
||||
<div>@($"{a.CategoryName}->{a.CallerName}")</div>
|
||||
<div>@($"{a.Text}")</div><br />
|
||||
<p>@($"{a.Text}")</p>
|
||||
<div style="font-weight: bold;">Exception:</div>
|
||||
<div style="word-wrap: break-word;">@a.Exception</div>
|
||||
<p style="word-wrap: break-word;">@a.Exception</p>
|
||||
</DetailRowTemplate>
|
||||
<ToolbarTemplate>
|
||||
<div>
|
||||
<DxTagBox Data="@(Enum.GetValues<LogLevel>().ToList())" Values="@_selectedLogLevels"
|
||||
NullText="Select status type..." ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto" aria-label="Select status type"
|
||||
ValuesChanged="(IEnumerable<LogLevel> values) => TagBox_ValuesChanged(values)" />
|
||||
</div>
|
||||
<DxGridLayout>
|
||||
<Rows>
|
||||
<DxGridLayoutRow />
|
||||
</Rows>
|
||||
<Columns>
|
||||
<DxGridLayoutColumn />
|
||||
<DxGridLayoutColumn Width="130" />
|
||||
<DxGridLayoutColumn Width="130" />
|
||||
<DxGridLayoutColumn Width="100" />
|
||||
<DxGridLayoutColumn Width="auto" />
|
||||
</Columns>
|
||||
<Items>
|
||||
<DxGridLayoutItem Row="0" Column="0">
|
||||
<Template>
|
||||
<DxTagBox Data="@(Enum.GetValues<LogLevel>().ToList())" Values="@_selectedLogLevels"
|
||||
NullText="Select status type..." ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto" aria-label="Select status type"
|
||||
ValuesChanged="(IEnumerable<LogLevel> values) => TagBox_ValuesChanged(values)" />
|
||||
</Template>
|
||||
</DxGridLayoutItem>
|
||||
<DxGridLayoutItem Row="0" Column="1">
|
||||
<Template>
|
||||
<DxDateEdit Date="@_fromDate"
|
||||
NullText="Select fromDate..."
|
||||
DisplayFormat="d"
|
||||
DateChanged="@((DateTime fromDate) => OnValueChangedStartDate(fromDate))"
|
||||
ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Never">
|
||||
</DxDateEdit>
|
||||
</Template>
|
||||
</DxGridLayoutItem>
|
||||
<DxGridLayoutItem Row="0" Column="2">
|
||||
<Template>
|
||||
<DxDateEdit Date="@_toDate"
|
||||
NullText="select toDate..."
|
||||
DisplayFormat="d"
|
||||
DateChanged="@((DateTime toDate) => OnValueChangedEndDate(toDate))"
|
||||
ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Never">
|
||||
</DxDateEdit>
|
||||
</Template>
|
||||
</DxGridLayoutItem>
|
||||
<DxGridLayoutItem Row="0" Column="3">
|
||||
<Template>
|
||||
<DxSpinEdit Value="@_takeCount" CssClass="dx-demo-editor-width" MinValue="0" Increment="500" BindValueMode="BindValueMode.OnDelayedInput" InputDelay="1500"
|
||||
ValueChanged="@((int newValue) => OnValueChangedTakeCount(newValue))">
|
||||
</DxSpinEdit>
|
||||
</Template>
|
||||
</DxGridLayoutItem>
|
||||
|
||||
</Items>
|
||||
</DxGridLayout>
|
||||
</ToolbarTemplate>
|
||||
</LogViewerGrid>
|
||||
|
||||
|
|
@ -73,6 +120,13 @@
|
|||
[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 = new object[3] { _takeCount, _fromDate, _toDate };
|
||||
|
||||
private LoggerClient<LogViewerGridComponent> _logger;
|
||||
private static List<LogLevel> _selectedLogLevels = [LogLevel.Error, LogLevel.Warning, LogLevel.Suggest];
|
||||
private static string _filterText = GetFilterText(_selectedLogLevels);
|
||||
|
|
@ -104,6 +158,39 @@
|
|||
_logViewerGrid.SetFieldFilterCriteria(nameof(LogLevel), filterCriteria);
|
||||
}
|
||||
|
||||
private async Task OnValueChangedTakeCount(int value)
|
||||
{
|
||||
if (_takeCount == value) return;
|
||||
|
||||
_takeCount = value;
|
||||
_contextParams[0] = _takeCount;
|
||||
await _logViewerGrid.LoadDataSourceAsync();
|
||||
}
|
||||
|
||||
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.LoadDataSourceAsync();
|
||||
}
|
||||
|
||||
private async Task OnValueChangedEndDate(DateTime value)
|
||||
{
|
||||
if (_toDate == value) return;
|
||||
|
||||
_toDate = value;
|
||||
_contextParams[2] = _toDate;
|
||||
|
||||
if (_fromDate.Date > _toDate.Date) return;
|
||||
await _logViewerGrid.LoadDataSourceAsync();
|
||||
}
|
||||
|
||||
void Grid_CustomizeElement(GridCustomizeElementEventArgs e)
|
||||
{
|
||||
if (e.ElementType != GridElementType.DataRow) return;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
<CompanyDetailGrid Data="_detailGridData"
|
||||
Logger="_logger"
|
||||
SignalRClient="AdminSignalRClient"
|
||||
ContextIds="ContextIds"
|
||||
ContextIds="ContextIds?.Cast<object>().ToArray()"
|
||||
PageSize="5"
|
||||
ValidationEnabled="false"
|
||||
EditMode="GridEditMode.EditForm"
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
<TransferDestinationToProductDetailGrid
|
||||
Logger="_logger"
|
||||
SignalRClient="AdminSignalRClient"
|
||||
ContextIds="ContextIds"
|
||||
ContextIds="ContextIds?.Cast<object>().ToArray()"
|
||||
GetAllMessageTag="GetAllTag"
|
||||
PageSize="10"
|
||||
ValidationEnabled="false"
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
|
||||
<UserProductMappingGrid Logger="_logger"
|
||||
ContextIds="ContextIds"
|
||||
ContextIds="ContextIds?.Cast<object>().ToArray()"
|
||||
GetAllMessageTag="GetAllTag"
|
||||
SignalRClient="AdminSignalRClient"
|
||||
PageSize="10"
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ namespace TIAMSharedUI.Shared.Components.Grids
|
|||
|
||||
[Parameter] public LoggerClient Logger { get; set; }
|
||||
[Parameter] public string GridName { get; set; }
|
||||
[Parameter] public Guid[]? ContextIds { get; set; }
|
||||
[Parameter] public object[]? ContextIds { get; set; }
|
||||
|
||||
private string? _filterText = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -57,13 +57,13 @@ namespace TIAMWebApp.Server.Controllers
|
|||
[HttpGet]
|
||||
[Route(APIUrls.GetAllLogItemsRouteName)]
|
||||
[SignalR(SignalRTags.GetAllLogItemsByFilterText)]
|
||||
public async Task<List<LogItemViewerModel>> GetAllLogItems(string? criteriaOperatorText) //(int takeCount, string filterText)
|
||||
public async Task<List<LogItemViewerModel>> GetAllLogItems(int takeCount, DateTime fromDate, DateTime toDate, string? criteriaOperatorText) //(int takeCount, string filterText)
|
||||
{
|
||||
//public Task<List<Transfer>> GetTransfersByFilterAsync(CriteriaOperator criteriaOperator) => SessionAsync(ctx => (ctx.GetTransfers().AppendWhere(new CriteriaToExpressionConverter(), criteriaOperator) as IQueryable<Transfer>)!.ToList());
|
||||
logger.Debug($"GetAllLogItems; takeCount: {takeCount}; fromDate: {fromDate}; toDate: {toDate}; criteriaOperatorText: {criteriaOperatorText}");
|
||||
List<AcLogItem> logItemList;
|
||||
|
||||
if (criteriaOperatorText.IsNullOrWhiteSpace()) logItemList = await adminDal.GetLogItemsAsync(1000);
|
||||
else logItemList = await adminDal.GetLogItemsByFilterAsync(CriteriaOperator.Parse(criteriaOperatorText),1000);
|
||||
if (criteriaOperatorText.IsNullOrWhiteSpace()) logItemList = await adminDal.GetLogItemsAsync(takeCount, fromDate, toDate);
|
||||
else logItemList = await adminDal.GetLogItemsByFilterAsync(CriteriaOperator.Parse(criteriaOperatorText), takeCount, fromDate, toDate);
|
||||
|
||||
var resultList = new List<LogItemViewerModel>(logItemList.Count);
|
||||
//logItemList[0].ToModelDto<LogItemViewerModel, AcLogItem>();
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ public class DevAdminSignalRHub : Hub<ISignalRHubItemServer>, IAcSignalRHubServe
|
|||
paramValues = new object[methodInfoModel.ParamInfos.Length];
|
||||
|
||||
var firstParamType = methodInfoModel.ParamInfos[0].ParameterType;
|
||||
if (methodInfoModel.ParamInfos.Length > 1 || firstParamType == typeof(string) || firstParamType.IsEnum || firstParamType.IsValueType)
|
||||
if (methodInfoModel.ParamInfos.Length > 1 || firstParamType == typeof(string) || firstParamType.IsEnum || firstParamType.IsValueType || firstParamType == typeof(DateTime))
|
||||
{
|
||||
var msg = message!.MessagePackTo<SignalPostJsonDataMessage<IdMessage>>();
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,6 @@ namespace TIAMWebApp.Shared.Application.Utility
|
|||
{
|
||||
[Serializable]
|
||||
[DebuggerDisplay("Count = {Count}")]
|
||||
public class SignalRDataSource<T>(AcSignalRClientBase signalRClient, SignalRCrudTags signalRCrudTags, params Guid[]? contextIds)
|
||||
public class SignalRDataSource<T>(AcSignalRClientBase signalRClient, SignalRCrudTags signalRCrudTags, params object[]? contextIds)
|
||||
: AcSignalRDataSource<T>(signalRClient, signalRCrudTags, contextIds) where T : class, IId<Guid>;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue