Merge branch 'Release/Update202506_06'

This commit is contained in:
Samuele Locatelli
2025-07-07 12:02:27 +02:00
9 changed files with 134 additions and 70 deletions
+12 -3
View File
@@ -31,11 +31,20 @@
<div class="card-footer px-1">
<div class="border" style="max-height: 14em; overflow:hidden; overflow-y: auto;">
<ul class="list-group list-group-sm small">
@foreach (var item in @ParetoData)
@foreach (var item in @ParetoData.OrderBy(x => x.label).ToList())
{
<li class="list-group-item p-1 d-flex justify-content-between align-items-center">
@item.label
<span class="badge badge-primary badge-pill">@item.value</span>
<span>
@if (ShowRem)
{
<button class="btn btn-sm btn-outline-dark" @onclick="() => RemoveMachine(item.label)"><i class="fa-solid fa-xmark"></i> @item.label</button>
}
else
{
@item.label
}
</span>
<span class="badge text-bg-primary rounded-pill">@item.value</span>
</li>
}
</ul>
+12
View File
@@ -8,6 +8,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
namespace MP.Stats.Components
{
@@ -21,6 +22,12 @@ namespace MP.Stats.Components
[Parameter]
public EventCallback<string> EC_CodFluxSel { get; set; }
[Parameter]
public EventCallback<string> EC_IdxMaccRem { get; set; }
[Parameter]
public bool ShowRem { get; set; } = false;
[Parameter]
public List<FLModel> RawData
{
@@ -39,6 +46,11 @@ namespace MP.Stats.Components
#endregion Public Properties
private async Task RemoveMachine(string idxMacc)
{
await EC_IdxMaccRem.InvokeAsync(idxMacc);
}
#region Protected Enums
protected enum PeriodoSel
+1 -1
View File
@@ -42,7 +42,7 @@
<label class="small">macchine sel:</label>
<div class="input-group input-group-sm text-nowrap">
<button class="btn btn-sm btn-primary" @onclick="ShowAdd"><i class="fa-solid fa-pen"></i></button>
<span class="form-control disabled">@listSelected</span>
<span class="form-control disabled" title="@listSelected">@listSelected</span>
<button class="btn btn-sm btn-primary" @onclick="ResetSelMacchine"><i class="fa-solid fa-rotate-right"></i></button>
</div>
}
+2 -2
View File
@@ -4,8 +4,8 @@
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>MP.Stats</RootNamespace>
<UserSecretsId>826e877c-ba70-4253-84cb-d0b1cafd4440</UserSecretsId>
<Version>6.16.2507.0710</Version>
<Version>6.16.2507.0710</Version>
<Version>6.16.2507.0711</Version>
<Version>6.16.2507.0711</Version>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
+1 -1
View File
@@ -16,7 +16,7 @@
{
if (MaccSelValid)
{
<ChartTrends RawData="PlotRecords" EC_CodFluxSel="SetCodFlux" CodFluxList="@CodFluxList"></ChartTrends>
<ChartTrends RawData="PlotRecords" EC_CodFluxSel="SetCodFlux" CodFluxList="@CodFluxList" ShowRem="true" EC_IdxMaccRem="RemoveMachine"></ChartTrends>
}
else
{
+103 -60
View File
@@ -20,6 +20,8 @@ namespace MP.Stats.Pages
public void Dispose()
{
MServ.EA_SearchUpdated -= OnSeachUpdated;
PlotRecords.Clear();
SearchRecords.Clear();
}
public async void OnSeachUpdated()
@@ -38,11 +40,23 @@ namespace MP.Stats.Pages
protected string CodFluxSel = "*";
protected string fileName = "TrendAnalysis.csv";
protected int TotalCount = 0;
protected int SelCount = 0;
protected int TotalCount = 0;
#endregion Protected Fields
#region Protected Enums
protected enum ResolutionLevel
{
Low,
Med,
High,
Custom
}
#endregion Protected Enums
#region Protected Properties
protected List<string> CodFluxList { get; set; } = new List<string>() { "Energy", "Parameter" };
@@ -50,6 +64,14 @@ namespace MP.Stats.Pages
[Inject]
protected IJSRuntime JSRuntime { get; set; }
/// <summary>
/// Verifica validità selezione macchine
/// </summary>
protected bool MaccSelValid
{
get => currFilter.MaccSelValid;
}
/// <summary>
/// Numero max di punti da mostrare
/// </summary>
@@ -72,6 +94,47 @@ namespace MP.Stats.Pages
[Inject]
protected NavigationManager NavManager { get; set; }
protected ResolutionLevel ReqRes
{
get => _reqRes;
set
{
if (_reqRes != value)
{
_reqRes = value;
if (value < ResolutionLevel.Custom)
{
int numSel = currFilter.ListIdxMaccSel.Count;
// verifico selcount valido... che sia almeno MaxDisp/
if (SelCount == 0)
{
SelCount = TotalCount * numSel / NumMacc;
}
int scale = 256;
switch (value)
{
case ResolutionLevel.Low:
MaxPoints = (int)Math.Round(SelCount / numSel / 32 / (double)scale) * scale;
break;
case ResolutionLevel.Med:
MaxPoints = (int)Math.Round(SelCount / numSel / 8 / (double)scale) * scale;
break;
case ResolutionLevel.High:
MaxPoints = (int)Math.Round(SelCount / numSel / (double)scale) * scale;
break;
default:
break;
}
}
}
// limite minimo 256...
MaxPoints = MaxPoints < 256 ? 256 : MaxPoints;
}
}
[Inject]
protected MpStatsService StatService { get; set; }
@@ -102,7 +165,6 @@ namespace MP.Stats.Pages
isLoading = false;
}
protected async Task ResetFilter(SelectData newFilter)
{
SearchRecords = null;
@@ -141,54 +203,17 @@ namespace MP.Stats.Pages
#region Private Fields
private int _maxPoints = 256;
private ResolutionLevel _reqRes = ResolutionLevel.Low;
private List<ConfigModel> ConfigList;
private int MaxDisplay = 10;
private int NumMacc = 0;
private List<FLModel> PlotRecords;
private List<FLModel> SearchRecords;
protected ResolutionLevel ReqRes
{
get => _reqRes;
set
{
if (_reqRes != value)
{
_reqRes = value;
if (value < ResolutionLevel.Custom)
{
// verifico selcount valido... che sia almeno MaxDisp/
if (SelCount == 0)
{
SelCount = TotalCount / NumMacc * MaxDisplay;
}
int scale = 256;
switch (value)
{
case ResolutionLevel.Low:
MaxPoints = (int)Math.Round(SelCount / 10 / (double)scale) * scale;
break;
case ResolutionLevel.Med:
MaxPoints = (int)Math.Round(SelCount / 3 / (double)scale) * scale;
break;
case ResolutionLevel.High:
MaxPoints = (int)Math.Round(SelCount / (double)scale) * scale;
break;
default:
break;
}
}
}
}
}
private ResolutionLevel _reqRes = ResolutionLevel.Low;
protected enum ResolutionLevel
{
Low,
Med,
High,
Custom
}
/// <summary>
/// Dizionario liste valori da mostrare
/// </summary>
private Dictionary<string, List<FLModel>> SearchRecords = new Dictionary<string, List<FLModel>>();
#endregion Private Fields
@@ -210,8 +235,6 @@ namespace MP.Stats.Pages
#endregion Private Properties
private int MaxDisplay = 10;
#region Private Methods
/// <summary>
@@ -232,15 +255,11 @@ namespace MP.Stats.Pages
{
// in primis suddivido in un dizionario x ogni macchina...
PlotRecords = new List<FLModel>();
Dictionary<string, List<FLModel>> grpDict = SearchRecords
.GroupBy(o => o.IdxMacchina)
.ToDictionary(g => g.Key, g => g.ToList());
// per ogni valore recupero timeserie downsampled fino al num max di quelle ottenibili...
int numAdd = 0;
SelCount = 0;
var listSel = currFilter.ListIdxMaccSel;
foreach (var item in grpDict)
foreach (var item in SearchRecords)
{
// verifico se sia tra le macchine selezionate...
if (listSel.Contains(item.Key))
@@ -277,7 +296,21 @@ namespace MP.Stats.Pages
isLoading = true;
var listMacchine = await StatService.MachineList(true);
NumMacc = listMacchine.Count;
// ciclo caricando info x ogni macchina selezionata...
SearchRecords = new Dictionary<string, List<FLModel>>();
if (currFilter.ListIdxMaccSel.Count > 0)
{
foreach (var idxMacc in currFilter.ListIdxMaccSel)
{
currFilter.IdxMacchina = idxMacc;
var tempRec = await StatService.FluxLogRawData(currFilter, CodFluxSel, MServ.SearchVal);
SearchRecords.Add(idxMacc, tempRec);
}
}
#if false
SearchRecords = await StatService.FluxLogRawData(currFilter, CodFluxSel, MServ.SearchVal);
#endif
TotalCount = SearchRecords.Count;
// se ho un elenco di macchine mostro grafici, altrimenti resoconto
@@ -285,16 +318,26 @@ namespace MP.Stats.Pages
isLoading = false;
}
#endregion Private Methods
private int NumMacc = 0;
/// <summary>
/// Verifica validità selezione macchine
/// Elimina da dict macchina indicata
/// </summary>
protected bool MaccSelValid
/// <param name="idxMacc"></param>
private async Task RemoveMachine(string idxMacc)
{
get => currFilter.MaccSelValid;
// in primis se contiene spazio --> prendo prima aprte che è idxMacc...
if (idxMacc.Contains(" "))
{
var sVals = idxMacc.Split(' ');
idxMacc = sVals[0];
}
if (SearchRecords.ContainsKey(idxMacc))
{
currFilter.ListIdxMaccSel.Remove(idxMacc);
SearchRecords.Remove(idxMacc);
await ReloadData();
}
}
#endregion Private Methods
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo statistiche MAPO</i>
<h4>Versione: 6.16.2507.0710</h4>
<h4>Versione: 6.16.2507.0711</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
6.16.2507.0710
6.16.2507.0711
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2507.0710</version>
<version>6.16.2507.0711</version>
<url>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>