* flag local movies as file not found * show warning icon on cards * unflag movie that is found during scan * skip missing files when building playouts * add state to search index * add file not found health check * link to search from file not found health check * support flagging other media kinds as file not found * continue to schedule missing items * support episode files not found * wip trash page * fix trash url * trash page is functional * update changelog * fix changelog merge
138 lines
5.1 KiB
Plaintext
138 lines
5.1 KiB
Plaintext
@page "/"
|
|
@using Microsoft.Extensions.Caching.Memory
|
|
@using System.Reflection
|
|
@using ErsatzTV.Application.Health.Queries
|
|
@using ErsatzTV.Core.Health
|
|
@using ErsatzTV.Core.Interfaces.GitHub
|
|
@inject IGitHubApiClient _gitHubApiClient
|
|
@inject IMemoryCache _memoryCache
|
|
@inject IMediator _mediator
|
|
|
|
<MudContainer MaxWidth="MaxWidth.ExtraLarge" Class="pt-8">
|
|
<MudCard>
|
|
<MudCardContent Class="release-notes mud-typography mud-typography-body1">
|
|
<MarkdownView Content="@_releaseNotes"/>
|
|
</MudCardContent>
|
|
</MudCard>
|
|
<MudText Class="mt-6">Full changelog is available on <MudLink Href="https://github.com/jasongdove/ErsatzTV/blob/main/CHANGELOG.md">GitHub</MudLink></MudText>
|
|
<MudTable Class="mt-6"
|
|
Hover="true"
|
|
Dense="true"
|
|
ServerData="@(new Func<TableState, Task<TableData<HealthCheckResult>>>(ServerReload))"
|
|
@ref="_table">
|
|
<ToolBarContent>
|
|
<MudText Typo="Typo.h6">Health Checks</MudText>
|
|
</ToolBarContent>
|
|
<HeaderContent>
|
|
<MudTh>Check</MudTh>
|
|
<MudTh>Message</MudTh>
|
|
</HeaderContent>
|
|
<RowTemplate>
|
|
<MudTd DataLabel="Check">
|
|
<div style="display: flex; flex-direction: row; align-items: center">
|
|
@if (context.Status == HealthCheckStatus.Fail)
|
|
{
|
|
<MudIcon Color="@Color.Error" Icon="@Icons.Material.Filled.Error"/>
|
|
}
|
|
else if (context.Status == HealthCheckStatus.Warning)
|
|
{
|
|
<MudIcon Color="@Color.Warning" Icon="@Icons.Material.Filled.Warning"/>
|
|
}
|
|
else if (context.Status == HealthCheckStatus.Info)
|
|
{
|
|
<MudIcon Color="@Color.Info" Icon="@Icons.Material.Filled.Info"/>
|
|
}
|
|
else
|
|
{
|
|
<MudIcon Color="@Color.Success" Icon="@Icons.Material.Filled.Check"/>
|
|
}
|
|
<div class="ml-2">@context.Title</div>
|
|
</div>
|
|
</MudTd>
|
|
<MudTd DataLabel="Message">
|
|
@if (context.Link.IsSome)
|
|
{
|
|
foreach (string link in context.Link)
|
|
{
|
|
<MudLink Href="@link">
|
|
@context.Message
|
|
</MudLink>
|
|
}
|
|
}
|
|
else
|
|
{
|
|
<MudText>
|
|
@context.Message
|
|
</MudText>
|
|
}
|
|
</MudTd>
|
|
</RowTemplate>
|
|
</MudTable>
|
|
</MudContainer>
|
|
|
|
@code {
|
|
|
|
private string _releaseNotes;
|
|
private MudTable<HealthCheckResult> _table;
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
try
|
|
{
|
|
if (_memoryCache.TryGetValue("Index.ReleaseNotesHtml", out string releaseNotesHtml))
|
|
{
|
|
_releaseNotes = releaseNotesHtml;
|
|
}
|
|
else
|
|
{
|
|
var assembly = Assembly.GetEntryAssembly();
|
|
if (assembly != null)
|
|
{
|
|
string version = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
|
|
if (version != null)
|
|
{
|
|
Either<BaseError, string> maybeNotes;
|
|
|
|
if (version != "develop")
|
|
{
|
|
string gitHubVersion = version.Split("-").Head() + "-alpha";
|
|
if (!gitHubVersion.StartsWith("v"))
|
|
{
|
|
gitHubVersion = $"v{gitHubVersion}";
|
|
}
|
|
|
|
maybeNotes = await _gitHubApiClient.GetReleaseNotes(gitHubVersion);
|
|
maybeNotes.IfRight(notes => _releaseNotes = notes);
|
|
}
|
|
else
|
|
{
|
|
maybeNotes = await _gitHubApiClient.GetLatestReleaseNotes();
|
|
maybeNotes.IfRight(notes => _releaseNotes = notes);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (_releaseNotes != null)
|
|
{
|
|
_memoryCache.Set("Index.ReleaseNotesHtml", _releaseNotes);
|
|
}
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
// ignore
|
|
}
|
|
}
|
|
|
|
private async Task<TableData<HealthCheckResult>> ServerReload(TableState state)
|
|
{
|
|
List<HealthCheckResult> healthCheckResults = await _mediator.Send(new GetAllHealthCheckResults());
|
|
|
|
return new TableData<HealthCheckResult>
|
|
{
|
|
TotalItems = healthCheckResults.Count,
|
|
Items = healthCheckResults
|
|
};
|
|
}
|
|
|
|
} |