fix recent regression to health check links (#2147)

This commit is contained in:
Jason Dove
2025-07-13 13:15:16 +00:00
committed by GitHub
parent 833bf3506a
commit 0ee62dbc7d
6 changed files with 27 additions and 10 deletions
+3
View File
@@ -0,0 +1,3 @@
namespace ErsatzTV.Core.Health;
public record HealthCheckLink(string Link);
+1 -1
View File
@@ -1,3 +1,3 @@
namespace ErsatzTV.Core.Health;
public record HealthCheckResult(string Title, HealthCheckStatus Status, string Message, string BriefMessage, Option<string> Link);
public record HealthCheckResult(string Title, HealthCheckStatus Status, string Message, string BriefMessage, Option<HealthCheckLink> Link);
@@ -24,7 +24,7 @@ public abstract class BaseHealthCheck
protected HealthCheckResult WarningResult(string message, string briefMessage) =>
new(Title, HealthCheckStatus.Warning, message, briefMessage, None);
protected HealthCheckResult WarningResult(string message, string briefMessage, string link) =>
protected HealthCheckResult WarningResult(string message, string briefMessage, HealthCheckLink link) =>
new(Title, HealthCheckStatus.Warning, message, briefMessage, link);
protected HealthCheckResult InfoResult(string message, string briefMessage) =>
@@ -57,7 +57,8 @@ public class FileNotFoundHealthCheck : BaseHealthCheck, IFileNotFoundHealthCheck
return WarningResult(
$"There are {count} items that do not exist on disk, including the following: {files}",
"media/trash");
$"There are {count} items that do not exist on disk",
new HealthCheckLink("media/trash"));
}
return OkResult();
@@ -85,7 +85,8 @@ public class UnavailableHealthCheck : BaseHealthCheck, IUnavailableHealthCheck
return WarningResult(
$"There are {count} items that are unavailable because ErsatzTV cannot find them on disk, including the following: {files}",
"search?query=state%3aUnavailable");
$"There are {count} items that are unavailable",
new HealthCheckLink("search?query=state%3aUnavailable"));
}
return OkResult();
+18 -6
View File
@@ -55,8 +55,7 @@
<MudTable Hover="true"
Dense="true"
Breakpoint="Breakpoint.None"
ServerData="@(new Func<TableState, CancellationToken, Task<TableData<HealthCheckResult>>>(ServerReload))"
@ref="_table">
ServerData="@(new Func<TableState, CancellationToken, Task<TableData<HealthCheckResult>>>(ServerReload))">
<HeaderContent>
<MudTh>Check</MudTh>
<MudTh>Message</MudTh>
@@ -87,9 +86,9 @@
<MudHidden Breakpoint="Breakpoint.Xs">
@if (context.Link.IsSome)
{
foreach (string link in context.Link)
foreach (HealthCheckLink link in context.Link)
{
<MudLink Href="@link">
<MudLink Href="@link.Link">
@context.Message
</MudLink>
}
@@ -102,7 +101,21 @@
}
</MudHidden>
<MudHidden Breakpoint="Breakpoint.Xs" Invert="true">
@context.BriefMessage
@if (context.Link.IsSome)
{
foreach (HealthCheckLink link in context.Link)
{
<MudLink Href="@link.Link">
@context.BriefMessage
</MudLink>
}
}
else
{
<MudText>
@context.BriefMessage
</MudText>
}
</MudHidden>
</MudTd>
</RowTemplate>
@@ -124,7 +137,6 @@
private readonly CancellationTokenSource _cts = new();
private string _releaseNotes;
private MudTable<HealthCheckResult> _table;
protected override void OnInitialized()
{