Files
Moonlight/Moonlight.Client/UI/Views/Admin/Sys/Diagnose.razor

77 lines
2.7 KiB
Plaintext

@page "/admin/system/diagnose"
@using MoonCore.Attributes
@using MoonCore.Helpers
@using Moonlight.Shared.Http.Responses.Admin.Sys
@using Moonlight.Shared.Misc
@attribute [RequirePermission("admin.system.diagnose")]
@inject HttpApiClient ApiClient
@inject DownloadService DownloadService
<div class="mb-5">
<NavTabs Index="5" Names="UiConstants.AdminNavNames" Links="UiConstants.AdminNavLinks" />
</div>
<div class="grid grid-cols-2">
<div class="col-span-2 md:col-span-1 card">
<div class="card-header">
<span class="card-title">Diagnose</span>
</div>
<div class="card-body">
<p>
If you're experiencing issues or need help via our Discord, you're in the right place here!
By pressing the button below, Moonlight will run all available diagnostic checks and package the results into a
downloadable zip file.
The report includes useful information about your system, plugins, and environment, making it easier to identify problems or share with support.
</p>
<WButton OnClick="GenerateDiagnose" CssClasses="btn btn-primary my-5">Generate diagnose</WButton>
@* <div> *@
@* <a class="text-primary cursor-pointer" @onclick:preventDefault @onclick="ToggleDropDown">Advanced <i class="icon-chevron-@(DropdownOpen ? "up" : "down")"></i></a> *@
@* *@
@* <div class="@(DropdownOpen ? "" : "hidden")"> *@
@* *@
@* *@
@* <LazyLoader Load="Load"> *@
@* *@
@* @for (int i = 0; i < AvailableProviders.Length; i++) *@
@* { *@
@* <div> *@
@* <input type="checkbox" @bind="@CheckedProviders[i]"/> @Formatter.ConvertCamelCaseToSpaces(AvailableProviders[i].Name) *@
@* </div> *@
@* } *@
@* *@
@* </LazyLoader> *@
@* *@
@* *@
@* </div> *@
@* *@
@* </div> *@
</div>
</div>
</div>
@code
{
private async Task GenerateDiagnose(WButton _)
{
var stream = await ApiClient.PostStream("api/admin/system/diagnose");
await DownloadService.DownloadStream("diagnose.zip", stream);
}
private async Task Load(LazyLoader arg)
{
// AvailableProviders = (await ApiClient.GetJson<SystemAvailableDiagnoseProviderResponse>("api/admin/system/diagnose/available")).AvailableProviders;
}
}