feat: 任务日志增加最大数功能
This commit is contained in:
parent
188470bc1d
commit
41b0dce852
|
@ -10,7 +10,7 @@ namespace BootstrapAdmin.Web.Components;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class TaskInfo
|
public partial class TaskInfo : IDisposable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -20,7 +20,7 @@ public partial class TaskInfo
|
||||||
[EditorRequired]
|
[EditorRequired]
|
||||||
public TasksModel? Model { get; set; }
|
public TasksModel? Model { get; set; }
|
||||||
|
|
||||||
private List<ConsoleMessageItem> Messages { get; } = new();
|
private List<ConsoleMessageItem> Messages { get; } = new(24);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -47,6 +47,31 @@ public partial class TaskInfo
|
||||||
{
|
{
|
||||||
Message = message
|
Message = message
|
||||||
});
|
});
|
||||||
|
if (Messages.Count > 20)
|
||||||
|
{
|
||||||
|
Messages.RemoveAt(0);
|
||||||
|
}
|
||||||
await InvokeAsync(StateHasChanged);
|
await InvokeAsync(StateHasChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing)
|
||||||
|
{
|
||||||
|
var sche = TaskServicesManager.Get(Model.Name);
|
||||||
|
if (sche != null)
|
||||||
|
{
|
||||||
|
sche.Triggers.First().PulseCallback = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
Dispose(true);
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,7 @@ public partial class Tasks
|
||||||
var option = new DialogOption()
|
var option = new DialogOption()
|
||||||
{
|
{
|
||||||
Class = "task-info",
|
Class = "task-info",
|
||||||
Title = $"{model.Name} - 日志窗口(最新50条)",
|
Title = $"{model.Name} - 日志窗口(最新 20 条)",
|
||||||
Component = BootstrapDynamicComponent.CreateComponent<TaskInfo>(new Dictionary<string, object?>
|
Component = BootstrapDynamicComponent.CreateComponent<TaskInfo>(new Dictionary<string, object?>
|
||||||
{
|
{
|
||||||
[nameof(TaskInfo.Model)] = model
|
[nameof(TaskInfo.Model)] = model
|
||||||
|
|
Loading…
Reference in New Issue