170 lines
7.5 KiB
Plaintext
170 lines
7.5 KiB
Plaintext
@page "/system/troubleshooting"
|
|
@using System.Runtime.InteropServices
|
|
@using System.Text.Json
|
|
@using System.Text.Json.Serialization
|
|
@using ErsatzTV.Application.Troubleshooting
|
|
@using ErsatzTV.Application.Troubleshooting.Queries
|
|
@implements IDisposable
|
|
@inject IMediator Mediator
|
|
@inject IJSRuntime JsRuntime
|
|
|
|
<MudForm Style="max-height: 100%">
|
|
<div class="d-flex flex-column" style="height: 100vh; overflow-x: auto">
|
|
<MudContainer MaxWidth="MaxWidth.ExtraLarge" Class="pt-8">
|
|
<MudText Typo="Typo.h5" Class="mb-2">Troubleshooting</MudText>
|
|
<MudDivider Class="mb-6"/>
|
|
<MudTabs Class="mb-6">
|
|
<MudTabPanel Text="Tools">
|
|
<MudPaper Class="pa-6" Style="max-height: 500px">
|
|
<MudStack>
|
|
<MudButton Variant="Variant.Filled"
|
|
Color="Color.Secondary"
|
|
StartIcon="@Icons.Material.Filled.Troubleshoot"
|
|
Href="system/troubleshooting/playback"
|
|
Style="margin-right: auto"
|
|
Class="mt-6">
|
|
Playback Troubleshooting
|
|
</MudButton>
|
|
<MudButton Variant="Variant.Filled"
|
|
Color="Color.Secondary"
|
|
StartIcon="@Icons.Material.Filled.Checklist"
|
|
Href="system/troubleshooting/yaml"
|
|
Class="mt-6"
|
|
Style="margin-right: auto">
|
|
YAML Validation
|
|
</MudButton>
|
|
</MudStack>
|
|
</MudPaper>
|
|
</MudTabPanel>
|
|
<MudTabPanel Text="General">
|
|
<MudPaper Class="pa-6">
|
|
<div class="overflow-y-scroll" style="max-height: 500px">
|
|
<pre class="wrap-pre">
|
|
<code @ref="_troubleshootingView">@_troubleshootingInfo</code>
|
|
</pre>
|
|
</div>
|
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Class="mt-4" OnClick="@(() => CopyToClipboard(_troubleshootingView))">
|
|
Copy
|
|
</MudButton>
|
|
</MudPaper>
|
|
</MudTabPanel>
|
|
@if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
|
{
|
|
<MudTabPanel Text="VideoToolbox">
|
|
<MudPaper Class="pa-6">
|
|
<div class="overflow-y-scroll" style="max-height: 500px">
|
|
<pre class="wrap-pre">
|
|
<code @ref="_videoToolboxView">@_videoToolboxCapabilities</code>
|
|
</pre>
|
|
</div>
|
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Class="mt-4" OnClick="@(() => CopyToClipboard(_videoToolboxView))">
|
|
Copy
|
|
</MudButton>
|
|
</MudPaper>
|
|
</MudTabPanel>
|
|
}
|
|
else
|
|
{
|
|
<MudTabPanel Text="NVIDIA">
|
|
<MudPaper Class="pa-6">
|
|
<div class="overflow-y-scroll" style="max-height: 500px">
|
|
<pre class="wrap-pre">
|
|
<code @ref="_nvidiaView">@_nvidiaCapabilities</code>
|
|
</pre>
|
|
</div>
|
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Class="mt-4" OnClick="@(() => CopyToClipboard(_nvidiaView))">
|
|
Copy
|
|
</MudButton>
|
|
</MudPaper>
|
|
</MudTabPanel>
|
|
<MudTabPanel Text="QSV">
|
|
<MudPaper Class="pa-6">
|
|
<div class="overflow-y-scroll" style="max-height: 500px">
|
|
<pre class="wrap-pre">
|
|
<code @ref="_qsvView">@_qsvCapabilities</code>
|
|
</pre>
|
|
</div>
|
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Class="mt-4" OnClick="@(() => CopyToClipboard(_qsvView))">
|
|
Copy
|
|
</MudButton>
|
|
</MudPaper>
|
|
</MudTabPanel>
|
|
}
|
|
@if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
|
{
|
|
<MudTabPanel Text="VAAPI">
|
|
<MudPaper Class="pa-6">
|
|
<div class="overflow-y-scroll" style="max-height: 500px">
|
|
<pre class="wrap-pre">
|
|
<code @ref="_vaapiView">@_vaapiCapabilities</code>
|
|
</pre>
|
|
</div>
|
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Class="mt-4" OnClick="@(() => CopyToClipboard(_vaapiView))">
|
|
Copy
|
|
</MudButton>
|
|
</MudPaper>
|
|
</MudTabPanel>
|
|
}
|
|
</MudTabs>
|
|
</MudContainer>
|
|
</div>
|
|
</MudForm>
|
|
|
|
@code {
|
|
private readonly CancellationTokenSource _cts = new();
|
|
private string _troubleshootingInfo;
|
|
private string _nvidiaCapabilities;
|
|
private string _qsvCapabilities;
|
|
private string _vaapiCapabilities;
|
|
private string _videoToolboxCapabilities;
|
|
private ElementReference _troubleshootingView;
|
|
private ElementReference _nvidiaView;
|
|
private ElementReference _qsvView;
|
|
private ElementReference _vaapiView;
|
|
private ElementReference _videoToolboxView;
|
|
|
|
public void Dispose()
|
|
{
|
|
_cts.Cancel();
|
|
_cts.Dispose();
|
|
}
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
try
|
|
{
|
|
TroubleshootingInfo info = await Mediator.Send(new GetTroubleshootingInfo(), _cts.Token);
|
|
|
|
_troubleshootingInfo = JsonSerializer.Serialize(
|
|
new
|
|
{
|
|
info.Version,
|
|
Environment = info.Environment.OrderBy(x => x.Key).ToDictionary(x => x.Key, x => x.Value),
|
|
info.Cpus,
|
|
info.VideoControllers,
|
|
info.Health,
|
|
info.FFmpegSettings,
|
|
info.Channels,
|
|
info.FFmpegProfiles
|
|
},
|
|
new JsonSerializerOptions
|
|
{
|
|
Converters = { new JsonStringEnumConverter() },
|
|
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
|
WriteIndented = true
|
|
});
|
|
|
|
_nvidiaCapabilities = info.NvidiaCapabilities;
|
|
_qsvCapabilities = info.QsvCapabilities;
|
|
_vaapiCapabilities = info.VaapiCapabilities;
|
|
_videoToolboxCapabilities = info.VideoToolboxCapabilities;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_troubleshootingInfo = ex.ToString();
|
|
}
|
|
}
|
|
|
|
private async Task CopyToClipboard(ElementReference view) => await JsRuntime.InvokeVoidAsync("clipboardCopy.copyText", view);
|
|
|
|
} |