Files
zaccaria.majid e1bdfe7c71 -Aggiunta link x pdf pagina maintenance
-fix layout index con allarmi visibili in caso !=0
2022-11-02 15:01:14 +01:00

174 lines
4.3 KiB
C#

using MP.MONO.Core.DTO;
using MP.MONO.Data;
using MP.MONO.UI.Data;
using Newtonsoft.Json;
namespace MP.MONO.UI.Pages
{
public partial class Tools
{
private List<DisplayDataDTO>? ListRecords { get; set; } = null;
//protected List<string> selParams { get; set; } = new List<string>();
#region Private Fields
private int maxRecord = 120;
protected int maxDisplay = 16;
private DateTime DateFrom
{
get => SelFilter.DtStart;
set => SelFilter.DtStart = value;
}
private DateTime DateTo
{
get => SelFilter.DtEnd;
set => SelFilter.DtEnd = value;
}
protected DataLogFilter SelFilter { get; set; } = new DataLogFilter();
#endregion Private Fields
#region Protected Fields
protected bool isRT
{
get => currFilter.isActive;
}
protected double sampleSecMin = 1;
protected string RTCSSmode = "fw-bold";
protected string LVCSSmode = "text-secondary";
#endregion Protected Fields
#region Protected Properties
protected int currMode
{
get => isRT ? 0 : 1;
}
protected string btnResetCss
{
get => selTools != null && selTools.Count > 0 ? "" : "disabled";
}
protected bool selectAll { get; set; }
protected List<string> selTools { get; set; } = new List<string>();
#endregion Protected Properties
#region Public Properties
public string pcss
{
get
{
string answ = "col-12";
int numPar = selTools.Count;
if (numPar > 6)
{
answ = "col-4";
}
else if (numPar > 3)
{
answ = "col-6";
}
return answ;
}
}
#endregion Public Properties
#region Private Methods
private selectGlobalToggle currFilter { get; set; } = new selectGlobalToggle();
#endregion Private Methods
#region Protected Methods
protected void toolAdded(string toolName)
{
if (!selTools.Contains(toolName))
{
if (selTools.Count < maxDisplay)
{
selTools.Add(toolName);
}
}
#if false
selectGlobalToggle newFilt = currFilter;
newFilt.reload = true;
await updateFilter(newFilt);
currFilter = newFilt;
#endif
}
protected override async Task OnInitializedAsync()
{
ListRecords = await MMDataService.getTools();
}
protected string lastTool
{
get
{
string answ = "";
if (selTools.Count > 0)
{
answ = $"{selTools.LastOrDefault()}";
}
return answ;
}
}
protected void toolRemoved(string toolName)
{
if (selTools.Contains(toolName))
{
// controllo se è ultimo rimuovo direttamente
if (toolName == lastTool)
{
selTools.Remove(toolName);
}
}
}
protected void resetSel()
{
selTools = new List<string>();
}
protected async Task selAll()
{
selTools = new List<string>();
await Task.Delay(50);
selectAll = true;
if (ListRecords != null)
{
foreach (var item in ListRecords)
{
if (selTools.Count < maxDisplay)
{
selTools.Add(item.Title);
await Task.Delay(1);
}
}
}
}
private async Task updateFilter(selectGlobalToggle newParams)
{
//await Task.Delay(1);
await Task.Delay(1);
newParams.leftString = "Log View";
newParams.rightString = "Real Time";
await InvokeAsync(() => StateHasChanged());
currFilter = newParams;
}
#endregion Protected Methods
}
}