Inizio gestione filtro parametri con data max

This commit is contained in:
Samuele Locatelli
2022-09-27 09:47:41 +02:00
parent 523b1683d9
commit 5014bb1ecb
17 changed files with 178 additions and 100 deletions
+4 -2
View File
@@ -23,6 +23,7 @@ else
<th><i class="fa-regular fa-calendar-days"></i> Data</th>
<th><i class="fa-solid fa-sliders"></i> ODL</th>
<th><i class="fa-solid fa-circle-info"></i> DATA TYPE</th>
<th></th>
</tr>
</thead>
<tbody>
@@ -44,6 +45,8 @@ else
<td>
@record.DataType
</td>
<td>
<button @onclick="() => deleteRecord(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button></td>
</tr>
}
</tbody>
@@ -63,7 +66,7 @@ else
<tr>
<th><i class="fa-solid fa-hard-drive"></i> Macchina</th>
<th><i class="fa-regular fa-calendar-days"></i> Data</th>
<th><i class="fa-solid fa-sliders"></i> ODL</th>
<th><i class="fa-solid fa-sliders"></i> Data Type</th>
<th class="d-flex justify-content-between"> Valore <button class="btn btn-primary btn-sm py-0" @onclick="() => unToggleTableFlux()"><i class="fa-solid fa-xmark"></i></button></th>
</tr>
</thead>
@@ -89,7 +92,6 @@ else
</table>
</div>
}
}
</div>
</div>
+16
View File
@@ -37,6 +37,22 @@ namespace MP.SPEC.Components
return answ;
}
/// <summary>
/// Eliminazione record selezionato (previa conferma)
/// </summary>
/// <param name="selRec"></param>
/// <returns></returns>
protected async Task deleteRecord(Dossiers selRec)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Eliminazione Dossier: sei sicuro di voler procedere?"))
return;
await Task.Delay(1);
var done = await MDService.DossiersDeleteRecord(selRec);
currRecord = null;
await reloadData();
await Task.Delay(1);
}
public async Task reloadData(bool setChanged)
{
isLoading = true;
-7
View File
@@ -23,7 +23,6 @@ else
<th><i class="fa-solid fa-hard-drive"></i> Macchina</th>
<th><i class="fa-solid fa-sliders"></i> Parametro</th>
<th style="text-align: right">Valore</th>
<th></th>
</tr>
</thead>
<tbody>
@@ -45,12 +44,6 @@ else
<td style="text-align: right">
<b>@record.Valore</b>
</td>
<td>
@*@if (ArticoloDelEnabled(record.CodArticolo))
{
<button @onclick="() => deleteRecord(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button>
}*@
</td>
</tr>
}
</tbody>
+1 -1
View File
@@ -52,7 +52,7 @@ namespace MP.SPEC.Components
#region Protected Methods
/// <summary>
/// Eliminazione record selezioanto (previa conferma)
/// Eliminazione record selezionato (previa conferma)
/// </summary>
/// <param name="selRec"></param>
/// <returns></returns>
+11 -2
View File
@@ -35,7 +35,7 @@
<div class="d-flex justify-content-end">
@if (showEditPar)
{
<div class="px-0 input-group py-1" id="basic-addon1">
<div class="px-0 input-group py-1">
<button class="btn btn-primary" @onclick="() => toggleParams()"> <i class="fa-solid fa-arrow-right"></i></button>
<label class="input-group-text" for="tempoAgg" title="Selezionare il tempo di aggiornamento dei dati"><i class="fa-solid fa-clock"></i></label>
<select @bind="@selTempoAgg" class="form-select" id="tempoAgg" title="Selezionare il tempo di aggiornamento dei dati" style="width: 3em;">
@@ -78,7 +78,7 @@
</div>
}
<div class="px-0 py-1">
<div class="px-2 input-group" id="basic-addon1">
<div class="px-2 input-group">
<label class="input-group-text" for="macchina" title="Selezionare la macchina"><i class="fa-solid fa-hard-drive"></i></label>
<select @bind="@selMacchina" class="form-select" id="macchina" title="Selezionare la macchina">
<option value="*">--- Tutti ---</option>
@@ -101,6 +101,15 @@
}
}
</select>
@if (dtMax == null)
{
<button class="btn btn-primary" @onclick="() => setDtMax()"><i class="fa-regular fa-calendar-check"></i></button>
}
else
{
<label class="input-group-text" for="flusso" title="Selezionare il tipo di flusso"><i class="fa-solid fa-sliders"></i></label>
<input class="form" @bind="@dtMax" type="datetime-local" title="Data massima eventi da visualizzare">
}
</div>
</div>
</div>
+43 -10
View File
@@ -15,6 +15,23 @@ namespace MP.SPEC.Components
#endregion Public Properties
#region Public Methods
/// <summary>
/// Inizializzazione con periodo e arrotondamento
/// </summary>
/// <param name="minRound"></param>
/// <returns></returns>
public static DateTime RoundDatetime(int minRound)
{
TimeSpan DayElapsed = DateTime.Now.Subtract(DateTime.Today);
int minDay = (int)Math.Ceiling((double)(DayElapsed.TotalMinutes / minRound)) * minRound;
DateTime endRounded = DateTime.Today.AddMinutes(minDay);
return endRounded;
}
#endregion Public Methods
#region Protected Properties
protected string lastUpdate
@@ -64,10 +81,7 @@ namespace MP.SPEC.Components
protected string selMacchina
{
get
{
return SelFilter.IdxMacchina;
}
get => SelFilter.IdxMacchina;
set
{
if (!SelFilter.IdxMacchina.Equals(value))
@@ -130,6 +144,14 @@ namespace MP.SPEC.Components
await FilterChanged.InvokeAsync(SelFilter);
}
protected void setDtMax()
{
dtMax = RoundDatetime(5);
// fermo udpate
liveUpdate = false;
lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}";
}
protected async Task takeSnapshot()
{
// fermo udpate
@@ -139,7 +161,7 @@ namespace MP.SPEC.Components
// aggiungo 2 sec
dtRif = dtRif.AddSeconds(1);
await MDService.DossiersTakeParamsSnapshot(selMacchina, 10, dtRif);
lastUpdate = $"Last Snapshot: {DateTime.Now:yyyy/MM/dd HH:mm:ss}";
lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}";
}
protected void toggleParams()
@@ -153,7 +175,11 @@ namespace MP.SPEC.Components
await Task.Delay(1);
if (!liveUpdate)
{
lastUpdate = $"Last Snapshot: {DateTime.Now:yyyy/MM/dd HH:mm:ss}";
lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}";
}
else
{
dtMax = null;
}
}
@@ -162,19 +188,26 @@ namespace MP.SPEC.Components
#region Private Fields
private List<string>? ListFlux = null;
private List<string>? ListMacchine = null;
#endregion Private Fields
#region Private Properties
private DateTime? dtMax
{
get => SelFilter.dtMax;
set => SelFilter.dtMax = value;
}
private bool showEditPar { get; set; } = false;
private string snapMode
{
get => SelFilter.dtRif == null ? "Realtime Rec" : $"Rec {SelFilter.dtRif:yyyy/MM/dd HH:mm:ss}";
}
#region Private Properties
private bool showEditPar { get; set; } = false;
#endregion Private Properties
#region Private Methods
+31 -12
View File
@@ -294,15 +294,18 @@ namespace MP.SPEC.Data
/// </summary>
/// <param name="selRecord">record dossier da eliminare</param>
/// <returns></returns>
public async Task<bool> DossiersDelete(Dossiers selRecord)
public async Task<bool> DossiersDeleteRecord(Dossiers selRecord)
{
bool result = false;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
result = await Task.FromResult(dbController.DossiersDelete(selRecord));
result = await dbController.DossiersDeleteRecord(selRecord);
// elimino cache redis...
RedisValue pattern = new RedisValue($"{redisDossByMac}:*");
bool answ = await ExecFlushRedisPattern(pattern);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"DossiersDelete | IdxMacchina {selRecord.IdxMacchina} | DtRif {selRecord.DtRif} | IdxODL {selRecord.IdxODL} | {ts.TotalMilliseconds}ms");
Log.Debug($"DossiersDeleteRecord | IdxMacchina {selRecord.IdxMacchina} | DtRif {selRecord.DtRif} | IdxODL {selRecord.IdxODL} | {ts.TotalMilliseconds}ms");
return result;
}
@@ -392,21 +395,37 @@ namespace MP.SPEC.Data
public async Task<bool> FlushRedisCache()
{
await Task.Delay(1);
RedisValue pattern = new RedisValue($"{redisBaseAddr}*");
bool answ = await ExecFlushRedisPattern(pattern);
return answ;
}
/// <summary>
/// Esegue flush memoria redis dato pattern
/// </summary>
/// <param name="pattern"></param>
/// <returns></returns>
private async Task<bool> ExecFlushRedisPattern(RedisValue pattern)
{
bool answ = false;
var listEndpoints = redisConnAdmin.GetEndPoints();
var server = redisConnAdmin.GetServer(listEndpoints[0]);
RedisValue pattern = new RedisValue($"{redisBaseAddr}*");
if (server != null)
foreach (var endPoint in listEndpoints)
{
var keyList = server.Keys(redisDb.Database, pattern);
foreach (var item in keyList)
//var server = redisConnAdmin.GetServer(listEndpoints[0]);
var server = redisConnAdmin.GetServer(endPoint);
if (server != null)
{
await redisDb.KeyDeleteAsync(item);
var keyList = server.Keys(redisDb.Database, pattern);
foreach (var item in keyList)
{
await redisDb.KeyDeleteAsync(item);
}
// brutalmente rimuovo intero contenuto DB... DANGER
//await server.FlushDatabaseAsync();
answ = true;
}
// brutalmente rimuovo intero contenuto DB... DANGER
//await server.FlushDatabaseAsync();
answ = true;
}
return answ;
}
+6 -7
View File
@@ -13,7 +13,7 @@
public int CurrPage { get; set; } = 1;
public DateTime DtRef { get; set; } = Init(5);
public DateTime DtRef { get; set; } = InitDatetime(5);
public string IdxMacchina { get; set; } = "*";
@@ -24,12 +24,11 @@
#region Public Methods
/// <summary>
        /// Inizializzazione con periodo e arrotondamento
        /// </summary>
        /// <param name="minRound"></param>
        /// <param name="numDayPrev"></param>
        /// <returns></returns>
public static DateTime Init(int minRound)
/// Inizializzazione con periodo e arrotondamento
/// </summary>
/// <param name="minRound"></param>
/// <returns></returns>
public static DateTime InitDatetime(int minRound)
{
TimeSpan DayElapsed = DateTime.Now.Subtract(DateTime.Today);
int minDay = (int)Math.Ceiling((double)(DayElapsed.TotalMinutes / minRound)) * minRound;
+1
View File
@@ -14,6 +14,7 @@
public string CodFlux { get; set; } = "*";
public int CurrPage { get; set; } = 1;
public DateTime? dtRif { get; set; } = null;
public DateTime? dtMax { 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.2708</Version>
<Version>6.16.2209.2709</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -97,7 +97,7 @@ namespace MP.SPEC.Pages
}
/// <summary>
/// Eliminazione record selezioanto (previa conferma)
/// Eliminazione record selezionato (previa conferma)
/// </summary>
/// <param name="selRec"></param>
/// <returns></returns>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2209.2708</h4>
<h4>Versione: 6.16.2209.2709</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2209.2708
6.16.2209.2709
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2209.2708</version>
<version>6.16.2209.2709</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>