[frontend] Fix line wrapping in ErrorUi logs
This commit is contained in:
parent
f9c034ffe4
commit
b074ff723e
1 changed files with 14 additions and 9 deletions
|
@ -19,7 +19,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="log-block">
|
<div class="log-block">
|
||||||
<code>@Exception.GetType(): @Exception.Message @Exception.StackTrace</code>
|
<pre><code>@Exception.GetType(): @Exception.Message
|
||||||
|
@Exception.StackTrace</code></pre>
|
||||||
</div>
|
</div>
|
||||||
<div class="version">
|
<div class="version">
|
||||||
<span class="name">Iceshrimp.NET</span>
|
<span class="name">Iceshrimp.NET</span>
|
||||||
|
@ -40,10 +41,12 @@
|
||||||
</div>
|
</div>
|
||||||
@Loc["Logs"]
|
@Loc["Logs"]
|
||||||
<div class="log-block">
|
<div class="log-block">
|
||||||
@foreach (var line in _logs)
|
<pre><code>
|
||||||
|
@foreach (var line in _rawLog)
|
||||||
{
|
{
|
||||||
<code>@line</code><br/>
|
@line
|
||||||
}
|
}
|
||||||
|
</code></pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn" @onclick="Reload">@Loc["Reload Application"]</button>
|
<button class="btn" @onclick="Reload">@Loc["Reload Application"]</button>
|
||||||
|
@ -53,8 +56,9 @@
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter] [EditorRequired] public required Exception Exception { get; set; }
|
[Parameter] [EditorRequired] public required Exception Exception { get; set; }
|
||||||
private IReadOnlyCollection<string> _logs = [];
|
private IEnumerable<string> _logs = [];
|
||||||
private IJSInProcessObjectReference _module = null!;
|
private IJSInProcessObjectReference _module = null!;
|
||||||
|
private IReadOnlyCollection<string> _rawLog = null!;
|
||||||
|
|
||||||
private void Reload()
|
private void Reload()
|
||||||
{
|
{
|
||||||
|
@ -63,13 +67,14 @@
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
_logs = LogService.GetLogs();
|
_rawLog = LogService.GetLogs();
|
||||||
_module = (IJSInProcessObjectReference) await Js.InvokeAsync<IJSObjectReference>("import", "./Components/ErrorUi.razor.js");
|
_module = (IJSInProcessObjectReference) await Js.InvokeAsync<IJSObjectReference>("import", "./Components/ErrorUi.razor.js");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void DownloadLogs()
|
private void DownloadLogs()
|
||||||
{
|
{
|
||||||
var logBytes = _logs.SelectMany(p => Encoding.UTF8.GetBytes(p)).ToArray();
|
var logBytes = LogService.GetLogs().SelectMany(p => Encoding.UTF8.GetBytes(p)).ToArray();
|
||||||
_module.InvokeVoid("DownloadFile", "log.txt", "text/plain", logBytes);
|
_module.InvokeVoid("DownloadFile", "log.txt", "text/plain", logBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue