138 lines
3.3 KiB
C#
138 lines
3.3 KiB
C#
namespace Lux.UI.Components.Compo.WorkLoad
|
|
{
|
|
public partial class JobQueue
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public EventCallback<string> EC_ReRunJob { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback<string> EC_ResetQueue { get; set; }
|
|
|
|
[Parameter]
|
|
public bool EnableClear { get; set; } = false;
|
|
|
|
[Parameter]
|
|
public bool EnableReRun { get; set; } = false;
|
|
|
|
[Parameter]
|
|
public bool EnableReset { get; set; } = false;
|
|
|
|
[Parameter]
|
|
public List<string> QueueAll { get; set; } = new List<string>();
|
|
|
|
[Parameter]
|
|
public string QueueType { get; set; } = "Run";
|
|
|
|
[Parameter]
|
|
public string TitleCss { get; set; } = "bg-success";
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
UpdateTable();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
/// <summary>
|
|
/// pagina attuale
|
|
/// </summary>
|
|
private int currPage = 1;
|
|
|
|
/// <summary>
|
|
/// elementi per pagina
|
|
/// </summary>
|
|
private int numRecord = 5;
|
|
|
|
private string searchVal = "";
|
|
|
|
/// <summary>
|
|
/// Numero tot records
|
|
/// </summary>
|
|
private int totalCount = 0;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
private IEnumerable<string>? QueuePaged { get; set; } = null;
|
|
|
|
private string SearchCss
|
|
{
|
|
get => !string.IsNullOrEmpty(searchVal) ? "btn-primary" : "btn-outline-secondary";
|
|
}
|
|
|
|
private string SearchVal
|
|
{
|
|
get => searchVal;
|
|
set
|
|
{
|
|
if (searchVal != value)
|
|
{
|
|
searchVal = value;
|
|
UpdateTable();
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
private Task ReRunJob(string? JobCode)
|
|
{
|
|
return EC_ReRunJob.InvokeAsync(JobCode);
|
|
}
|
|
|
|
private Task ResetQueue()
|
|
{
|
|
return EC_ResetQueue.InvokeAsync(QueueType);
|
|
}
|
|
|
|
private void ResetSearch(MouseEventArgs args)
|
|
{
|
|
SearchVal = "";
|
|
}
|
|
|
|
private void SaveNumRec(int newNum)
|
|
{
|
|
numRecord = newNum;
|
|
UpdateTable();
|
|
}
|
|
|
|
private void SavePage(int newNum)
|
|
{
|
|
currPage = newNum;
|
|
UpdateTable();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Filtro e paginazione
|
|
/// </summary>
|
|
private void UpdateTable()
|
|
{
|
|
// eventuale filtro...
|
|
List<string> QueueFilt = QueueAll;
|
|
if (!string.IsNullOrEmpty(SearchVal) && SearchVal.Count() > 1)
|
|
{
|
|
QueueFilt = QueueAll
|
|
.Where(x => x.Contains(SearchVal, StringComparison.InvariantCultureIgnoreCase))
|
|
.ToList();
|
|
}
|
|
// fix paginazione
|
|
QueuePaged = QueueFilt
|
|
.Skip(numRecord * (currPage - 1))
|
|
.Take(numRecord);
|
|
totalCount = QueueFilt.Count();
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |