Inizio update selezione parametri

This commit is contained in:
Samuele Locatelli
2022-09-26 19:31:55 +02:00
parent b748c76cad
commit add4fe13fa
9 changed files with 69 additions and 16 deletions
+3 -3
View File
@@ -17,7 +17,7 @@ else
<thead>
<tr>
<th>
@*<button @onclick="() => resetSel()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>*@
<button @onclick="() => resetSel()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>
</th>
<th><i class="fa-regular fa-calendar-days"></i> Data</th>
<th><i class="fa-solid fa-hard-drive"></i> Macchina</th>
@@ -29,9 +29,9 @@ else
<tbody>
@foreach (var record in ListRecords)
{
<tr class="@checkSelect(@record.IdxMacchina)">
<tr class="@checkSelect(@record)">
<td>
@*<button @onclick="() => selRecord(record)" class="btn btn-primary btn-sm"><i class="bi bi-pencil-square"></i></button>*@
<button @onclick="() => selRecord(record)" class="btn btn-primary btn-sm"><i class="bi bi-search"></i></button>
</td>
<td>
@record.dtEvento
+33 -6
View File
@@ -13,6 +13,9 @@ namespace MP.SPEC.Components
[Parameter]
public EventCallback<bool> PagerResetReq { get; set; }
[Parameter]
public EventCallback<FluxLog> RecordSel { get; set; }
[Parameter]
public SelectFluxParams SelFilter { get; set; } = null!;
@@ -23,14 +26,14 @@ namespace MP.SPEC.Components
#region Public Methods
public string checkSelect(string IdxMacchina)
public string checkSelect(FluxLog selRecord)
{
string answ = "";
if (currRecord != null)
{
try
{
answ = (currRecord.IdxMacchina == IdxMacchina) ? "table-info" : "";
answ = (currRecord.IdxMacchina == selRecord.IdxMacchina && currRecord.dtEvento == selRecord.dtEvento && currRecord.CodFlux == selRecord.CodFlux) ? "table-info" : "";
}
catch
{ }
@@ -38,6 +41,21 @@ namespace MP.SPEC.Components
return answ;
}
protected override async Task OnParametersSetAsync()
{
await Task.Delay(1);
// se sono live + parametri cambiati --> rileggo...
if (SelFilter.LiveUpdate)
{
await reloadData(false);
}
// se sono live --> elimino record selezionato
//if (SelFilter.LiveUpdate)
//{
// currRecord = null;
//}
}
public void Dispose()
{
aTimer.Elapsed -= ElapsedTimer;
@@ -86,11 +104,9 @@ namespace MP.SPEC.Components
public void StartTimer()
{
//int.TryParse(Configuration["ReloadStatusTimer"], out tOutPeriod);
aTimer = new System.Timers.Timer(RefreshPeriod);
aTimer.Elapsed += ElapsedTimer;
aTimer.Enabled = true;
//aTimer.AutoReset = true;
aTimer.Start();
}
@@ -114,8 +130,6 @@ namespace MP.SPEC.Components
#endregion Protected Properties
//protected int RefreshPeriod { get; set; } = 5000;
#region Protected Methods
protected override async Task OnInitializedAsync()
@@ -127,6 +141,7 @@ namespace MP.SPEC.Components
await reloadData(true);
}
//protected int RefreshPeriod { get; set; } = 5000;
protected async void OnSeachUpdated()
{
await InvokeAsync(() =>
@@ -138,6 +153,18 @@ namespace MP.SPEC.Components
});
}
protected async Task resetSel()
{
currRecord = null;
await RecordSel.InvokeAsync(null);
}
protected async Task selRecord(FluxLog selRec)
{
currRecord = selRec;
await RecordSel.InvokeAsync(selRec);
}
protected async Task UpdateData()
{
currRecord = null;
+1
View File
@@ -13,6 +13,7 @@
public string CodFlux { get; set; } = "*";
public int CurrPage { get; set; } = 1;
public DateTime? dtRif { get; set; } = null;
public string IdxMacchina { get; set; } = "*";
public string lastUpdate { get; set; } = "-";
public bool LiveUpdate { get; set; } = true;
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2209.2209</Version>
<Version>6.16.2209.2619</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -25,7 +25,7 @@
}
else
{
<ListPARAMS SelFilter="@currFilter" TotRecordChanged="@updateTotal"></ListPARAMS>
<ListPARAMS SelFilter="@currFilter" TotRecordChanged="@updateTotal" RecordSel="@detailSel"></ListPARAMS>
}
</div>
<div class="card-footer py-1">
+27 -2
View File
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Components;
using MP.Data.DatabaseModels;
using MP.SPEC.Components;
using MP.SPEC.Data;
@@ -29,8 +30,12 @@ namespace MP.SPEC.Pages
protected void ForceReloadPage(int newNum)
{
currPage = newNum;
currFilter.lastUpdate = $"Last Snapshot: {DateTime.Now:yyyy/MM/dd HH:mm:ss}";
currFilter.LiveUpdate = (currPage == 1);
DateTime adesso = DateTime.Now.AddSeconds(1);
var updFilter = currFilter;
updFilter.LiveUpdate = (currPage == 1);
updFilter.lastUpdate = updFilter.LiveUpdate ? "-" : $"Last Snapshot: {adesso:yyyy/MM/dd HH:mm:ss}";
// salvo filtro
currFilter = updFilter;
StateHasChanged();
}
@@ -64,6 +69,26 @@ namespace MP.SPEC.Pages
totalCount = newTotCount;
}
protected void detailSel(FluxLog newRec)
{
var updFilter = currFilter;
DateTime adesso = DateTime.Now.AddSeconds(1);
updFilter.LiveUpdate = (newRec == null);
// sistemo la data di riferimento x eventuale snapshot nel passato
updFilter.dtRif = newRec != null ? newRec.dtEvento : null;
if (newRec != null)
{
updFilter.lastUpdate = updFilter.lastUpdate == "-" ? $"Last Snapshot: {adesso:yyyy/MM/dd HH:mm:ss}" : updFilter.lastUpdate;
}
else
{
updFilter.lastUpdate = "-";
}
// salvo filtro
currFilter = updFilter;
}
#endregion Protected Methods
#region Private Properties
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2209.2209</h4>
<h4>Versione: 6.16.2209.2619</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2209.2209
6.16.2209.2619
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2209.2209</version>
<version>6.16.2209.2619</version>
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>