feat: Blazor 程序异常页面增加文件日志明细功能
This commit is contained in:
parent
06dae58db1
commit
43b48fc9ae
|
@ -30,3 +30,24 @@
|
|||
</Table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Modal @ref="Modal" Id="exception-detail" Title="程序异常日志窗口" Size="ModalSize.Large">
|
||||
<ModalBody>
|
||||
<form class="form-inline">
|
||||
<div class="row">
|
||||
@foreach(var item in Items)
|
||||
{
|
||||
<div class="form-group col-md-3 col-sm-4 col-6">
|
||||
<a href="#" @onclick:preventDefault OnClick="e => ShowLog(item)">@item</a>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</form>
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">
|
||||
<i class="fa fa-times"></i>
|
||||
<span>关闭</span>
|
||||
</button>
|
||||
</ModalFooter>
|
||||
</Modal>
|
||||
|
|
|
@ -3,6 +3,7 @@ using Bootstrap.Admin.Pages.Extensions;
|
|||
using Bootstrap.DataAccess;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Bootstrap.Admin.Pages.Views.Admin.Components
|
||||
{
|
||||
|
@ -50,10 +51,43 @@ namespace Bootstrap.Admin.Pages.Views.Admin.Components
|
|||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得 错误日志文件集合
|
||||
/// </summary>
|
||||
protected IEnumerable<string> Items { get; set; } = new string[0];
|
||||
|
||||
private bool show;
|
||||
/// <summary>
|
||||
/// 显示异常明细方法
|
||||
/// </summary>
|
||||
protected void ShowDetail()
|
||||
{
|
||||
Items = ExceptionsHelper.RetrieveLogFiles();
|
||||
show = true;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// OnAfterRender 方法
|
||||
/// </summary>
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
if (show)
|
||||
{
|
||||
show = false;
|
||||
Modal?.Toggle();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得/设置 Modal 实例
|
||||
/// </summary>
|
||||
protected ModalBase? Modal { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 显示指定文件内容明细
|
||||
/// </summary>
|
||||
protected void ShowLog(string fileName)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue