Update conf maxDisplay da tabella

This commit is contained in:
Samuele Locatelli
2025-07-07 10:54:35 +02:00
parent 814de375ff
commit a65ece8f2d
8 changed files with 56 additions and 19 deletions
+10 -5
View File
@@ -7,7 +7,7 @@
<h3>Imp Sel: <b>@ListSelected</b></h3>
</div>
<div class="px-0">
<button class="btn btn-outline-dark" @onclick="() => SearchMaccToggle()"><i class="fa-solid fa-save"></i> @numSelected / @MaxSelection</button>
<button class="btn btn-outline-dark" @onclick="() => SearchMaccToggle()"><i class="fa-solid fa-xmark"></i></button>
</div>
</div>
@* <div class="input-group input-group-lg my-2 shadow">
@@ -34,21 +34,21 @@
<tbody>
@foreach (var record in ListRecords)
{
<tr>
<tr class="@CheckSelect(record)">
<td>
@if (CurrList.Contains(record.ValueField))
{
<button class="btn btn-sm btn-info" @onclick="() => ToggleSel(record.ValueField)"><i class="fa-solid fa-minus"></i></button>
<button class="btn btn-outline-primary border-0" @onclick="() => ToggleSel(record.ValueField)"><i class="fa-solid fa-toggle-on"></i></button>
}
else
{
if (numSelected < MaxSelection)
{
<button class="btn btn-sm btn-primary" @onclick="() => ToggleSel(record.ValueField)"><i class="fa-solid fa-plus"></i></button>
<button class="btn btn-outline-dark border-0" @onclick="() => ToggleSel(record.ValueField)"><i class="fa-solid fa-toggle-off"></i></button>
}
else
{
<button class="btn btn-sm btn-secondary" disabled><i class="fa-solid fa-plus"></i></button>
<button class="btn btn-outline-secondary border-0" disabled><i class="fa-solid fa-toggle-off"></i></button>
}
}
</td>
@@ -67,6 +67,11 @@
</table>
</div>
</div>
<div class="modal-footer d-flex justify-content-around">
<div class="px-2">
<button class="btn btn-success w-100" @onclick="() => SearchMaccToggle()"><i class="fa-solid fa-save"></i> Salva selezione (@numSelected / @MaxSelection)</button>
</div>
</div>
</div>
</div>
</dialog>
@@ -40,6 +40,20 @@ namespace MP.Stats.Components
get => string.IsNullOrEmpty(SearchVal) ? "btn-outline-secondary" : "btn-primary";
}
protected string CheckSelect(AutocompleteModel currRec)
{
string answ = "";
if (CurrList.Contains(currRec.ValueField))
{
answ = "table-info";
}
else if (numSelected >= MaxSelection)
{
answ = "opacity-25";
}
return answ;
}
protected List<AutocompleteModel> ListRecords { get; set; } = null!;
protected string ListSelected
+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.0709</Version>
<Version>6.16.2507.0709</Version>
<Version>6.16.2507.0710</Version>
<Version>6.16.2507.0710</Version>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
+3 -3
View File
@@ -23,10 +23,10 @@
<div class="alert alert-info my-2">
<div class="fs-4 d-flex justify-content-around">
<div>
Selezionare impianti per attivare grafici
Selezionare impianti per attivare grafici (fino a @MaxDisplay)
</div>
<div>
# Impianti: <b>@NumMacc</b>
# Impianti: <b>@NumMacc</b> | # Rec tot: <b>@TotalCount.ToString("N0")</b>
</div>
</div>
</div>
@@ -54,7 +54,7 @@
</div>
</div>
<div class="px-0">
# Rec Sel: <b>@totalCount.ToString("N0")</b>
# Rec Sel: <b>@SelCount.ToString("N0")</b>
</div>
</div>
</div>
+24 -6
View File
@@ -3,6 +3,7 @@ using Microsoft.JSInterop;
using MP.Data.DbModels;
using MP.Data.Services;
using MP.Stats.Data;
using NLog.Config;
using Org.BouncyCastle.Utilities;
using System;
using System.Collections.Generic;
@@ -37,7 +38,8 @@ namespace MP.Stats.Pages
protected string CodFluxSel = "*";
protected string fileName = "TrendAnalysis.csv";
protected int totalCount = 0;
protected int TotalCount = 0;
protected int SelCount = 0;
#endregion Protected Fields
@@ -100,6 +102,7 @@ namespace MP.Stats.Pages
isLoading = false;
}
protected async Task ResetFilter(SelectData newFilter)
{
SearchRecords = null;
@@ -153,17 +156,22 @@ namespace MP.Stats.Pages
_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(totalCount / 10 / (double)scale) * scale;
MaxPoints = (int)Math.Round(SelCount / 10 / (double)scale) * scale;
break;
case ResolutionLevel.Med:
MaxPoints = (int)Math.Round(totalCount / 3 / (double)scale) * scale;
MaxPoints = (int)Math.Round(SelCount / 3 / (double)scale) * scale;
break;
case ResolutionLevel.High:
MaxPoints = (int)Math.Round(totalCount / (double)scale) * scale;
MaxPoints = (int)Math.Round(SelCount / (double)scale) * scale;
break;
default:
break;
@@ -202,7 +210,7 @@ namespace MP.Stats.Pages
#endregion Private Properties
private int MaxDisplay = 5;
private int MaxDisplay = 10;
#region Private Methods
@@ -230,6 +238,7 @@ namespace MP.Stats.Pages
// 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)
{
@@ -237,6 +246,7 @@ namespace MP.Stats.Pages
if (listSel.Contains(item.Key))
{
numAdd++;
SelCount += item.Value.Count;
// ora effettuo deduplica valori per tenere un subset minore ed evitare problemi visualizzazione...
PlotRecords.AddRange(TimeSeriesUtils.DownsampleFluxModels(item.Value, MaxPoints));
// verifico comunque superamento limite amcchine
@@ -251,6 +261,14 @@ namespace MP.Stats.Pages
private async Task LoadConfData()
{
ConfigList = await StatService.ConfigGetAll();
if (ConfigList.Count > 0)
{
var recConf = ConfigList.Where(x => x.Chiave == "STATS_TrendMaxSelect").FirstOrDefault();
if (recConf != null)
{
int.TryParse(recConf.Valore, out MaxDisplay);
}
}
CodFluxList = await StatService.FluxTypeList();
}
@@ -260,7 +278,7 @@ namespace MP.Stats.Pages
var listMacchine = await StatService.MachineList(true);
NumMacc = listMacchine.Count;
SearchRecords = await StatService.FluxLogRawData(currFilter, CodFluxSel, MServ.SearchVal);
totalCount = SearchRecords.Count;
TotalCount = SearchRecords.Count;
// se ho un elenco di macchine mostro grafici, altrimenti resoconto
FiltData();
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo statistiche MAPO</i>
<h4>Versione: 6.16.2507.0709</h4>
<h4>Versione: 6.16.2507.0710</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
6.16.2507.0709
6.16.2507.0710
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2507.0709</version>
<version>6.16.2507.0710</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>