Merge branch 'Release/UpdateIoC_03'
This commit is contained in:
@@ -84,50 +84,47 @@ namespace MP.Data.Services.Utils
|
||||
/// <inheritdoc />
|
||||
public List<ChartSeriesDto> GetTimeSeriesData(List<StatsAggregatedModel> rawData, bool groupMach, bool getCount)
|
||||
{
|
||||
DateTime adesso = DateTime.Now;
|
||||
|
||||
List<ChartSeriesDto> series = new();
|
||||
// a seconda della richiesta cambio il group by...
|
||||
if (groupMach)
|
||||
{
|
||||
series = rawData
|
||||
.GroupBy(s => new { s.Destination, s.MachineId }) // Raggruppiamo per la chiave composta
|
||||
.GroupBy(s => new { s.Destination })
|
||||
.Select(group => new ChartSeriesDto
|
||||
{
|
||||
// Creiamo un nome leggibile per la legenda del grafico
|
||||
SeriesName = $"{group.Key.Destination}|{group.Key.MachineId}",
|
||||
|
||||
// Per ogni gruppo, creiamo la lista dei punti temporali
|
||||
SeriesName = group.Key.Destination,
|
||||
DataPoints = group
|
||||
.OrderBy(p => p.Hour) // Fondamentale: l'asse X deve essere cronologico
|
||||
.OrderBy(p => p.Hour)
|
||||
.Select(p => new chartJsData.chartJsTSerie
|
||||
{
|
||||
x = p.Hour,
|
||||
y = getCount ? p.RequestCount : p.AvgDuration * p.RequestCount // La metrica richiesta
|
||||
y = (getCount ? 1 : p.AvgDuration) * p.RequestCount / (p.Hour.Date.Equals(adesso.Date) ? adesso.TimeOfDay.TotalHours : 24)
|
||||
})
|
||||
.ToList()
|
||||
})
|
||||
.OrderBy(s => s.SeriesName) // Opzionale: ordina le serie alfabeticamente
|
||||
.OrderBy(s => s.SeriesName)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
series = rawData
|
||||
.GroupBy(s => new { s.MachineId, s.Destination }) // Raggruppiamo per la chiave composta
|
||||
.GroupBy(s => new { s.MachineId })
|
||||
.Select(group => new ChartSeriesDto
|
||||
{
|
||||
// Creiamo un nome leggibile per la legenda del grafico
|
||||
SeriesName = $"{group.Key.MachineId}|{group.Key.Destination}",
|
||||
SeriesName = group.Key.MachineId,
|
||||
|
||||
// Per ogni gruppo, creiamo la lista dei punti temporali
|
||||
DataPoints = group
|
||||
.OrderBy(p => p.Hour) // Fondamentale: l'asse X deve essere cronologico
|
||||
.OrderBy(p => p.Hour)
|
||||
.Select(p => new chartJsData.chartJsTSerie
|
||||
{
|
||||
x = p.Hour,
|
||||
y = getCount ? p.RequestCount : p.AvgDuration // La metrica richiesta
|
||||
y = (getCount ? 1 : p.AvgDuration) * p.RequestCount / (p.Hour.Date.Equals(adesso.Date) ? adesso.TimeOfDay.TotalHours : 24)
|
||||
})
|
||||
.ToList()
|
||||
})
|
||||
.OrderBy(s => s.SeriesName) // Opzionale: ordina le serie alfabeticamente
|
||||
.OrderBy(s => s.SeriesName)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
@@ -192,6 +189,7 @@ namespace MP.Data.Services.Utils
|
||||
|
||||
protected async Task<Dictionary<string, List<StatDataDTO>>> GetParetoMaccAsync(int numDay)
|
||||
{
|
||||
numDay = numDay > 1 ? numDay : 1;
|
||||
Dictionary<string, List<StatDataDTO>> result = new();
|
||||
DateTime oggi = DateTime.Today;
|
||||
var rawData = await GetFiltAsync(oggi.AddDays(-numDay), oggi);
|
||||
@@ -200,7 +198,7 @@ namespace MP.Data.Services.Utils
|
||||
.Select(g => new StatDataDTO
|
||||
{
|
||||
Label = g.Key,
|
||||
Value = g.Sum(x => x.RequestCount)
|
||||
Value = g.Sum(x => x.RequestCount) / numDay
|
||||
})
|
||||
.OrderByDescending(x => x.Value)
|
||||
.ToList();
|
||||
@@ -210,11 +208,11 @@ namespace MP.Data.Services.Utils
|
||||
.Select(g => new StatDataDTO
|
||||
{
|
||||
Label = g.Key,
|
||||
Value = g.Sum(x => x.RequestCount * x.AvgDuration)
|
||||
Value = g.Sum(x => x.RequestCount * x.AvgDuration) / numDay
|
||||
})
|
||||
.OrderByDescending(x => x.Value)
|
||||
.ToList();
|
||||
result.Add("Mach.Duration (ms)", pDestDuration);
|
||||
result.Add("Mach.Duration (tot ms)", pDestDuration);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,13 @@
|
||||
public string Id { get; set; } = "MyTs";
|
||||
|
||||
[Parameter]
|
||||
public List<string> Titles { get; set; } = new List<string>() { "Demo Line" };
|
||||
public double AspRatio { get; set; } = 0;
|
||||
|
||||
[Parameter]
|
||||
public List<string> backColor { get; set; } = new List<string>();
|
||||
|
||||
[Parameter]
|
||||
public bool BeginAtZero { get; set; } = true;
|
||||
|
||||
[Parameter]
|
||||
public List<List<chartJsData.chartJsTSerie>> DataTSList { get; set; } = null!;
|
||||
@@ -20,19 +26,6 @@
|
||||
[Parameter]
|
||||
public List<string> lineColor { get; set; } = new List<string>();
|
||||
|
||||
[Parameter]
|
||||
public List<string> backColor { get; set; } = new List<string>();
|
||||
|
||||
[Parameter]
|
||||
public double AspRatio { get; set; } = 0;
|
||||
|
||||
[Parameter]
|
||||
public bool Stepped { get; set; } = false;
|
||||
|
||||
[Parameter]
|
||||
public bool Stacked { get; set; } = false;
|
||||
|
||||
|
||||
[Parameter]
|
||||
public string MinValue { get; set; } = "0";
|
||||
|
||||
@@ -41,6 +34,18 @@
|
||||
|
||||
[Parameter]
|
||||
public int lTens { get; set; } = 0;
|
||||
|
||||
[Parameter]
|
||||
public bool ShowLegend { get; set; } = true;
|
||||
|
||||
[Parameter]
|
||||
public bool Stepped { get; set; } = false;
|
||||
|
||||
[Parameter]
|
||||
public bool Stacked { get; set; } = false;
|
||||
|
||||
[Parameter]
|
||||
public List<string> Titles { get; set; } = new List<string>() { "Demo Line" };
|
||||
|
||||
[Parameter]
|
||||
public string yScale { get; set; } = "linear";
|
||||
@@ -96,8 +101,8 @@
|
||||
{
|
||||
stacked = Stacked,
|
||||
type = yScale,
|
||||
// type = "logarithmic",
|
||||
display = true,
|
||||
beginAtZero = BeginAtZero,
|
||||
ticks = new
|
||||
{
|
||||
maxTicksLimit = 10
|
||||
@@ -110,13 +115,20 @@
|
||||
type = "time",
|
||||
time = new
|
||||
{
|
||||
unit = "hour" // Forza l'unità temporale se i dati sono orari
|
||||
unit = "hour"
|
||||
},
|
||||
distribution = "linear",
|
||||
}
|
||||
},
|
||||
animation = false,
|
||||
aspectRatio = AspRatio == 0 ? (object)null : AspRatio
|
||||
aspectRatio = AspRatio == 0 ? (object)null : AspRatio,
|
||||
plugins = new
|
||||
{
|
||||
legend = new
|
||||
{
|
||||
display = ShowLegend
|
||||
}
|
||||
}
|
||||
},
|
||||
data = new
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<div class="card shadow">
|
||||
<div class="card-header">
|
||||
<h3>Current Call Stats (24h)</h3>
|
||||
<h3>Current Stats</h3>
|
||||
</div>
|
||||
<div class="card-body px-1 py-0">
|
||||
<div class="row mb-2">
|
||||
@@ -10,7 +10,7 @@
|
||||
<div class="card shadow">
|
||||
<div class="card-header py-1">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0 fw-bold">Avail Data</div>
|
||||
<div class="px-0 fw-bold">Avail Data (24h)</div>
|
||||
<div class="px-0">
|
||||
<button class="btn btn-sm btn-info" @onclick="() => DoReset()">
|
||||
<i class="fa-solid fa-arrow-rotate-right"></i>
|
||||
@@ -89,7 +89,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<MultiLine Id="@currTsId" AspRatio="3" DataTSList="@TSDataMulti" Labels="@LabelPlot" lineColor="@lineColorsMLine" backColor="@bgColorsMLine" lTens="0" Titles="@lineTitles" Stepped="false" yScale="logarithmic"></MultiLine>
|
||||
<MultiLine Id="@currTsId" AspRatio="3" DataTSList="@TSDataMulti" Labels="@LabelPlot" lineColor="@lineColorsMLine" backColor="@bgColorsMLine" lTens="0" Titles="@lineTitles" BeginAtZero="@beginAtZero" Stepped="false" Stacked="@lineStacked" ShowLegend="@showLegend" yScale="@scaleFormat"></MultiLine>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -20,25 +20,28 @@ namespace MP.IOC.Components.Pages
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private bool beginAtZero = false;
|
||||
private List<StatDataDTO> currData = new();
|
||||
|
||||
private string currDetail = "";
|
||||
|
||||
private string currHistId = "";
|
||||
|
||||
private StatInfoDto? currStatSel = null;
|
||||
private string currPieId = "";
|
||||
|
||||
private StatInfoDto? currStatSel = null;
|
||||
private string currTitle = "";
|
||||
|
||||
private string currTsId = "";
|
||||
|
||||
private bool lineStacked = false;
|
||||
private List<string> lineTitles = new List<string>();
|
||||
|
||||
private int numDays = 5;
|
||||
|
||||
private List<StatInfoDto> ParetoDay = new();
|
||||
|
||||
private string scaleFormat = "linear";
|
||||
private bool showLegend = true;
|
||||
private List<chartJsData.chartJsTSerie> tsData = new List<chartJsData.chartJsTSerie>();
|
||||
|
||||
private List<ChartSeriesDto> tsDataDetail = new();
|
||||
@@ -95,10 +98,10 @@ namespace MP.IOC.Components.Pages
|
||||
}
|
||||
|
||||
[Inject]
|
||||
private IStatsDetailService SDetService { get; set; } = null!;
|
||||
private IStatsAggrService SAggService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
private IStatsAggrService SAggService { get; set; } = null!;
|
||||
private IStatsDetailService SDetService { get; set; } = null!;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
@@ -122,6 +125,10 @@ namespace MP.IOC.Components.Pages
|
||||
{
|
||||
// salvo dati!
|
||||
currStatSel = currStat;
|
||||
lineStacked = currStat.Grouping != StatInfoDto.AggrLevel.Method;
|
||||
showLegend = currStat.Grouping == StatInfoDto.AggrLevel.Method;
|
||||
beginAtZero = currStat.Grouping != StatInfoDto.AggrLevel.Method;
|
||||
scaleFormat = currStat.Grouping == StatInfoDto.AggrLevel.Method ? "logarithmic" : "linear";
|
||||
string reqKey = currStat.Title;
|
||||
currHistId = $"Bar_{reqKey}";
|
||||
currPieId = $"Pie_{reqKey}";
|
||||
@@ -261,6 +268,7 @@ namespace MP.IOC.Components.Pages
|
||||
// ...secondo tipo richiesto (macchina/server e duration/count)
|
||||
tsDataDetail = SAggService.GetTimeSeriesData(rawAggrData, grpMachine, isCount);
|
||||
break;
|
||||
|
||||
case StatInfoDto.AggrLevel.Method:
|
||||
// recupero dettaglio 7gg...
|
||||
List<StatsDetailModel> rawData = await SDetService.GetFiltAsync(adesso.AddDays(-numDays), adesso, "", selDetail);
|
||||
@@ -271,6 +279,7 @@ namespace MP.IOC.Components.Pages
|
||||
// ...secondo tipo richiesto (duration/count)
|
||||
tsDataDetail = SDetService.GetTimeSeriesData(rawData, isCount);
|
||||
break;
|
||||
|
||||
case StatInfoDto.AggrLevel.None:
|
||||
default:
|
||||
break;
|
||||
@@ -278,7 +287,6 @@ namespace MP.IOC.Components.Pages
|
||||
lineTitles = tsDataDetail.Select(x => x.SeriesName).ToList();
|
||||
TSDataMulti = tsDataDetail.Select(x => x.DataPoints).ToList();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>8.16.2604.2818</Version>
|
||||
<Version>8.16.2604.2907</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MP-IOC </i>
|
||||
<h4>Versione: 8.16.2604.2818</h4>
|
||||
<h4>Versione: 8.16.2604.2907</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
8.16.2604.2818
|
||||
8.16.2604.2907
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>8.16.2604.2818</version>
|
||||
<version>8.16.2604.2907</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/MP.IOC.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user