@using LucideBlazor @using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Components.Authorization @using Moonlight.Shared @using Moonlight.Shared.Http.Responses.Admin @using ShadcnBlazor.Accordions @using ShadcnBlazor.Alerts @using ShadcnBlazor.Buttons @using ShadcnBlazor.Cards @using ShadcnBlazor.Emptys @using ShadcnBlazor.Extras.Common @using ShadcnBlazor.Spinners @inject HttpClient HttpClient @inject IAuthorizationService AuthorizationService
Automatic diagnosis Use a diagnostic report to share configuration details and errors with Moonlight developers, with sensitive data automatically censored.
Notice Only share these reports with the moonlight developers or the corresponding plugin developers. Even though we do our best to censor sensitive data it may still contain information you dont want a random person on the internet to know
Start diagnostics
@if (IsLoading) { } else { if (HasDiagnosed) { if (Entries.Length == 0) { No results available Diagnosis didnt return any results } else { @for (var i = 0; i < Entries.Length; i++) { var entry = Entries[i]; var textColor = entry.Level switch { DiagnoseLevel.Error => "text-destructive", DiagnoseLevel.Warning => "text-yellow-400", DiagnoseLevel.Healthy => "text-green-500" };
@switch (entry.Level) { case DiagnoseLevel.Error: break; case DiagnoseLevel.Warning: break; case DiagnoseLevel.Healthy: break; }
@entry.Title @(string.Join(" / ", entry.Tags))
@if (!string.IsNullOrWhiteSpace(entry.StackStrace)) {
@entry.StackStrace
} @if (!string.IsNullOrWhiteSpace(entry.Message)) {

@entry.Message

} @if ( !string.IsNullOrWhiteSpace(entry.ReportUrl) || !string.IsNullOrWhiteSpace(entry.StackStrace) || !string.IsNullOrWhiteSpace(entry.SolutionUrl) ) {
@if (!string.IsNullOrWhiteSpace(entry.StackStrace)) { } @if (!string.IsNullOrWhiteSpace(entry.SolutionUrl)) { } @if (!string.IsNullOrWhiteSpace(entry.ReportUrl)) { }
}
}
} } else { No results available yet Press the start button to start the automatic diagnosis } }
@code { [CascadingParameter] public Task AuthState { get; set; } private AuthorizationResult AccessResult; private bool IsLoading = false; private bool HasDiagnosed = false; private DiagnoseResultDto[] Entries; protected override async Task OnInitializedAsync() { var authState = await AuthState; AccessResult = await AuthorizationService.AuthorizeAsync(authState.User, Permissions.System.Diagnose); } private async Task DiagnoseAsync() { IsLoading = true; HasDiagnosed = false; await InvokeAsync(StateHasChanged); var results = await HttpClient.GetFromJsonAsync("api/admin/system/diagnose"); Entries = results ?? []; IsLoading = false; HasDiagnosed = true; await InvokeAsync(StateHasChanged); } }