OK con filtraggio in cascata
This commit is contained in:
@@ -1,34 +1,36 @@
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
|
||||
<div class="d-flex justify-content-end">
|
||||
<div class="px-2">
|
||||
<select @bind="@selMacchina" class="form-select">
|
||||
<option value="*">--- Tutti ---</option>
|
||||
@if (ListMacchine != null)
|
||||
{
|
||||
foreach (var item in ListMacchine)
|
||||
{
|
||||
<option value="@item">@item</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-6 text-end">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<select @bind="@selMacchina" class="form-select">
|
||||
<option value="*">--- Tutti ---</option>
|
||||
@if (ListMacchine != null)
|
||||
{
|
||||
foreach (var item in ListMacchine)
|
||||
{
|
||||
<option value="@item">@item</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<select @bind="@selFlux" class="form-select">
|
||||
<option value="*">--- Tutti ---</option>
|
||||
@if (ListFlux != null)
|
||||
{
|
||||
foreach (var item in ListFlux)
|
||||
{
|
||||
<option value="@item">@item</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
@if (isLoading)
|
||||
{
|
||||
<select disabled>
|
||||
<option value="*">...loading</option>
|
||||
</select>
|
||||
}
|
||||
else
|
||||
{
|
||||
<select @bind="@selFlux" class="form-select">
|
||||
<option value="*">--- Tutti ---</option>
|
||||
@if (ListFlux != null)
|
||||
{
|
||||
foreach (var item in ListFlux)
|
||||
{
|
||||
<option value="@item">@item</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -37,14 +37,17 @@ namespace MP.SPEC.Components
|
||||
{
|
||||
if (!SelFilter.IdxMacchina.Equals(value))
|
||||
{
|
||||
isLoading = true;
|
||||
Task.Delay(1);
|
||||
//StateHasChanged();
|
||||
SelFilter.IdxMacchina = value;
|
||||
SelFilter.CodFlux = "*";
|
||||
Task.Delay(1);
|
||||
ListFlux = MDService.ParametriGetFilt(selMacchina).Result;
|
||||
Task.Delay(1);
|
||||
StateHasChanged();
|
||||
Task.Delay(1);
|
||||
reportChange();
|
||||
isLoading = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,6 +82,8 @@ namespace MP.SPEC.Components
|
||||
}
|
||||
|
||||
|
||||
private bool isLoading = false;
|
||||
|
||||
private List<string>? ListFlux;
|
||||
|
||||
private List<string>? ListMacchine;
|
||||
|
||||
@@ -391,6 +391,7 @@ namespace MP.SPEC.Data
|
||||
{
|
||||
return Task.FromResult(dbController.MacchineGetAll());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco ID macchine con dati FluxLog gestite
|
||||
/// </summary>
|
||||
@@ -438,9 +439,40 @@ namespace MP.SPEC.Data
|
||||
/// </summary>
|
||||
/// <param name="IdxMacchina">* = tutte, altrimenti solo x una data macchina</param>
|
||||
/// <returns></returns>
|
||||
public Task<List<string>> ParametriGetFilt(string IdxMacchina)
|
||||
public async Task<List<string>> ParametriGetFilt(string IdxMacchina)
|
||||
{
|
||||
return Task.FromResult(dbController.ParametriGetFilt(IdxMacchina));
|
||||
List<string>? result = new List<string>();
|
||||
result = await Task.FromResult(dbController.ParametriGetFilt(IdxMacchina));
|
||||
#if false
|
||||
// 2 minuti valore cache
|
||||
int maxAgeMin = 5;
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
// cerco in redis dato valore sel macchina...
|
||||
RedisValue rawData = await redisDb.StringGetAsync($"{redisFluxByMac}:{IdxMacchina}");
|
||||
if (!string.IsNullOrEmpty($"{rawData}"))
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<string>>($"{rawData}");
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"ParametriGetFilt | Read from REDIS: {ts.TotalMilliseconds}ms");
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await Task.FromResult(dbController.ParametriGetFilt(IdxMacchina));
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync($"{redisFluxByMac}:{IdxMacchina}", rawData, TimeSpan.FromMinutes(maxAgeMin));
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"ParametriGetFilt | Read from DB: {ts.TotalMilliseconds}ms");
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<string>();
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -499,6 +531,7 @@ namespace MP.SPEC.Data
|
||||
private string redisMseKey = "MP:MON:Cache:MSE";
|
||||
private string redisStatoCom = "MP:MON:Cache:StatoCom";
|
||||
private string redisTipoArt = "MP:MON:Cache:TipoArt";
|
||||
private string redisFluxByMac = "MP:MON:Cache:FluxByMac";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
|
||||
Reference in New Issue
Block a user