Files
lux/Lux.UI/Components/Compo/WorkLoad/JobQueueDisplay.razor.cs
T
2025-12-23 18:53:45 +01:00

77 lines
1.8 KiB
C#

using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using System.Reflection.Emit;
namespace Lux.UI.Components.Compo.WorkLoad
{
public partial class JobQueueDisplay
{
#region Public Properties
[Parameter]
public EventCallback<string> EC_ReRunJob { get; set; }
[Parameter]
public EventCallback<string> EC_ResetQueue { get; set; }
[Parameter]
public List<string> QueueRun { get; set; } = new List<string>();
[Parameter]
public List<string> QueueWait { get; set; } = new List<string>();
#endregion Public Properties
#region Protected Methods
protected async Task ReRunJob(string? JobCode)
{
await EC_ReRunJob.InvokeAsync(JobCode);
}
protected async Task ResetRunQueue()
{
await EC_ResetQueue.InvokeAsync("Run");
}
protected async Task ResetWaitQueue()
{
await EC_ResetQueue.InvokeAsync("Wait");
}
#endregion Protected Methods
#region Private Properties
private int NumRun
{
get => QueueRun.Count();
}
/// <summary>
/// elementi per pagina
/// </summary>
private int PageSize = 10;
/// <summary>
/// pagina attuale
/// </summary>
private int CurrentPage = 1;
private IEnumerable<string> PagedQueueRun =>
QueueRun
.Skip((CurrentPage - 1) * PageSize)
.Take(PageSize);
private int TotalPages => (int)Math.Ceiling((double)QueueRun.Count / PageSize);
private void GoToPage(int page)
{
if (page < 1) page = 1;
if (page > TotalPages) page = TotalPages;
CurrentPage = page;
}
#endregion Private Properties
}
}