add new scanner process (#1080)
* start moving local scans to separate process * send progress updates to main process * move scanners and tests * simplify dependencies; sync search index * commit search index more often when scanning * support forced scan and cancellation * use scanner process for plex libraries * update changelog * update dockerfiles * fix search index for local folder scanning * rework plex scanners * rework scanner handlers * emby works again * sync jellyfin * cleanup * update build * update changelog * remove scanner dependency in pr and artifacts workflows * fix mac sed syntax * fix pr build
This commit is contained in:
@@ -1,90 +0,0 @@
|
||||
@page "/system/logs"
|
||||
@using ErsatzTV.Application.Logs
|
||||
@using ErsatzTV.Application.Configuration
|
||||
@implements IDisposable
|
||||
@inject IMediator _mediator
|
||||
|
||||
<MudContainer MaxWidth="MaxWidth.ExtraLarge" Class="pt-8">
|
||||
<MudTable FixedHeader="true"
|
||||
@bind-RowsPerPage="@_rowsPerPage"
|
||||
ServerData="@(new Func<TableState, Task<TableData<LogEntryViewModel>>>(ServerReload))"
|
||||
Dense="true"
|
||||
@ref="_table">
|
||||
<HeaderContent>
|
||||
<MudTh>
|
||||
<MudTableSortLabel T="LogEntryViewModel" SortLabel="Timestamp">
|
||||
Timestamp
|
||||
</MudTableSortLabel>
|
||||
</MudTh>
|
||||
<MudTh>
|
||||
<MudTableSortLabel T="LogEntryViewModel" SortLabel="Level">
|
||||
Level
|
||||
</MudTableSortLabel>
|
||||
</MudTh>
|
||||
<MudTh>Message</MudTh>
|
||||
</HeaderContent>
|
||||
<RowTemplate>
|
||||
<MudTd DataLabel="Timestamp">@context.Timestamp</MudTd>
|
||||
<MudTd DataLabel="Level">@context.Level</MudTd>
|
||||
<MudTd DataLabel="Message">@context.Message</MudTd>
|
||||
</RowTemplate>
|
||||
<PagerContent>
|
||||
<MudTablePager/>
|
||||
</PagerContent>
|
||||
</MudTable>
|
||||
</MudContainer>
|
||||
|
||||
@code {
|
||||
private readonly CancellationTokenSource _cts = new();
|
||||
|
||||
private MudTable<LogEntryViewModel> _table;
|
||||
private int _rowsPerPage;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_cts.Cancel();
|
||||
_cts.Dispose();
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync() => _rowsPerPage =
|
||||
await _mediator.Send(new GetConfigElementByKey(ConfigElementKey.LogsPageSize), _cts.Token)
|
||||
.Map(maybeRows => maybeRows.Match(ce => int.TryParse(ce.Value, out int rows) ? rows : 10, () => 10));
|
||||
|
||||
private async Task<TableData<LogEntryViewModel>> ServerReload(TableState state)
|
||||
{
|
||||
await _mediator.Send(new SaveConfigElementByKey(ConfigElementKey.LogsPageSize, state.PageSize.ToString()), _cts.Token);
|
||||
|
||||
PagedLogEntriesViewModel data;
|
||||
|
||||
switch (state.SortLabel?.ToLowerInvariant())
|
||||
{
|
||||
case "timestamp":
|
||||
data = await _mediator.Send(new GetRecentLogEntries(state.Page, state.PageSize)
|
||||
{
|
||||
SortExpression = le => le.Timestamp,
|
||||
SortDescending = state.SortDirection == SortDirection.None
|
||||
? Option<bool>.None
|
||||
: state.SortDirection == SortDirection.Descending
|
||||
}, _cts.Token);
|
||||
break;
|
||||
case "level":
|
||||
data = await _mediator.Send(new GetRecentLogEntries(state.Page, state.PageSize)
|
||||
{
|
||||
SortExpression = le => le.Level,
|
||||
SortDescending = state.SortDirection == SortDirection.None
|
||||
? Option<bool>.None
|
||||
: state.SortDirection == SortDirection.Descending
|
||||
}, _cts.Token);
|
||||
break;
|
||||
default:
|
||||
data = await _mediator.Send(new GetRecentLogEntries(state.Page, state.PageSize)
|
||||
{
|
||||
SortDescending = Option<bool>.None
|
||||
}, _cts.Token);
|
||||
break;
|
||||
}
|
||||
|
||||
return new TableData<LogEntryViewModel> { TotalItems = data.TotalCount, Items = data.Page };
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user