Merge branch 'feature/FixAlAnBlocks' into develop

This commit is contained in:
Samuele Locatelli
2022-09-29 10:17:05 +02:00
26 changed files with 571 additions and 585 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>AnyCPU;x86;x64</Platforms>
<Version>1.2.2209.2318</Version>
<Version>1.2.2209.2910</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.2.2209.2318</h4>
<h4>Version: 1.2.2209.2910</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.2.2209.2318
1.2.2209.2910
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.2.2209.2318</version>
<version>1.2.2209.2910</version>
<url>http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/MP.Mon.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1 -1
View File
@@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>AnyCPU;x86;x64</Platforms>
<Version>1.2.2209.2318</Version>
<Version>1.2.2209.2910</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.2.2209.2318</h4>
<h4>Version: 1.2.2209.2910</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.2.2209.2318
1.2.2209.2910
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.2.2209.2318</version>
<version>1.2.2209.2910</version>
<url>http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/MP.Mon.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1 -1
View File
@@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>AnyCPU;x86;x64</Platforms>
<Version>1.2.2209.2318</Version>
<Version>1.2.2209.2910</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.2.2209.2318</h4>
<h4>Version: 1.2.2209.2910</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.2.2209.2318
1.2.2209.2910
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.2.2209.2318</version>
<version>1.2.2209.2910</version>
<url>http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/MP.Mon.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
@@ -8,10 +8,10 @@
</div>
<div class="col-6 d-flex justify-content-between">
<div class="input-group mb-3">
<label class="input-group-text" title="Choose Date/Time where to start analizing">Start</label>
<input @bind=dtStart id="DtRef" class="form-control" type="datetime-local" title="Choose Date/Time where to start analizing">
<label class="input-group-text" title="Choose Date/Time where to finish analizing">End</label>
<input @bind=dtEnd id="DtRef" class="form-control" type="datetime-local" title="Choose Date/Time where to finish analizing">
<label class="input-group-text" title="Analisys: dataset start">Start</label>
<input @bind="@dtStart" id="DtRefStart" class="form-control" type="datetime-local" title="Analisys: dataset start">
<label class="input-group-text" title="Analisys: dataset end">End</label>
<input @bind="@dtEnd" id="DtRefEnd" class="form-control" type="datetime-local" title="Analisys: dataset end">
</div>
</div>
</div>
@@ -1,24 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using System.Net.Http;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.Web.Virtualization;
using Microsoft.JSInterop;
using MP.MONO.UI;
using MP.MONO.UI.Shared;
using MP.MONO.UI.Components;
using MP.MONO.UI.Data;
namespace MP.MONO.UI.Components
{
public partial class ChartFilter
public partial class AlAnFilter
{
#region Public Properties
@@ -26,88 +11,107 @@ namespace MP.MONO.UI.Components
public EventCallback<selectChartParams> FilterChanged { get; set; }
[Parameter]
public selectChartParams SelFilter { get; set; } = null!;
public selectChartParams SelFilter { get; set; } = new selectChartParams();
#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 override async Task OnInitializedAsync()
{
SelFilter = new selectChartParams();
await FilterChanged.InvokeAsync(SelFilter);
setDtMinMax();
}
protected void setDtMinMax()
{
// copio il filtro
var currFilt = SelFilter;
currFilt.CurrPage = 0;
currFilt.dtMax = RoundDatetime(5);
currFilt.dtMin = RoundDatetime(5).AddHours(-2);
SelFilter = currFilt;
}
protected async Task toggleRec()
{
var currFilt = SelFilter;
currFilt.setFreqDur = !currFilt.setFreqDur;
#region Protected Fields
await Task.Delay(1);
protected DateTime _dtEnd = DateTime.Now;
#endregion Protected Fields
#region Protected Properties
protected string currMode
{
get => setFreqDur ? "Alarm frequency" : "Alarm duration";
}
protected bool setFreqDur
{
get => SelFilter.setFreqDur;
set => SelFilter.setFreqDur = value;
}
private DateTime? dtStart
{
get => SelFilter.dtMin;
set
{
if (SelFilter.dtMax != value)
if (SelFilter.setFreqDur != value)
{
SelFilter.dtMin = value;
SelFilter.setFreqDur = value;
reportChange();
}
}
}
protected DateTime _dtEnd = DateTime.Now;
private DateTime? dtEnd
#endregion Protected Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
await FilterChanged.InvokeAsync(SelFilter);
}
protected async Task toggleRec()
{
var currFilt = SelFilter;
currFilt.setFreqDur = !currFilt.setFreqDur;
SelFilter = currFilt;
await Task.Delay(1);
reportChange();
}
#endregion Protected Methods
#region Private Properties
private DateTime dtEnd
{
get => SelFilter.dtMax;
set
{
if (SelFilter.dtMax != value)
{
// verifico coerenza
if (value <= dtStart)
{
value = dtStart.AddHours(1);
}
SelFilter.dtMax = value;
reportChange();
}
}
}
protected string currMode
private DateTime dtStart
{
get => setFreqDur ? "Alarm frequency" : "Alarm duration";
get => SelFilter.dtMin;
set
{
if (SelFilter.dtMin != value)
{
// verifico coerenza
if (value >= dtEnd)
{
value = dtEnd.AddHours(-1);
}
SelFilter.dtMin = value;
reportChange();
}
}
}
#endregion Private Properties
#region Private Methods
private void reportChange()
{
FilterChanged.InvokeAsync(SelFilter);
}
#endregion Protected Properties
#endregion Private Methods
}
}
+46 -35
View File
@@ -1,41 +1,52 @@
<div class="row">
<div class="col-12">
<table class="table table-sm table-striped">
<thead>
<tr>
<th>Alarm Description</th>
<th>Alarm Event Count</th>
<th>Event Frequence</th>
<th>Event Frequence Chart</th>
</tr>
</thead>
<tbody>
@foreach (var record in ListRecordsFreq)
{
@if (ListRecordsFreq == null)
{
<LoadingData></LoadingData>
}
else if (totalCount == 0)
{
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
}
else
{
<table class="table table-sm table-striped">
<thead>
<tr>
<td>
<div>@record.AlarmDescription</div>
</td>
<td>
<div>@record.EventCount</div>
</td>
<td>
<div>
@if (totalVar != 0)
{
<span class="text-success">@calcPercFreq((double)record.EventCount)</span>
}
</div>
</td>
<td>
<div class="progress">
<div class="progress-bar @styleColourPBarFreq((double)record.EventCount/totalVar)" role="progressbar" style="@valFreq((double)record.EventCount)" aria-valuemin="0" aria-valuemax="100">@record.EventCount</div>
</div>
</td>
<th>Alarm Description</th>
<th>Alarm Event Count</th>
<th>Event Frequence</th>
<th>Event Frequence Chart</th>
</tr>
}
</tbody>
</table>
</thead>
<tbody>
@foreach (var record in ListRecordsFreq)
{
<tr>
<td>
<div>@record.AlarmDescription</div>
</td>
<td>
<div>@record.EventCount</div>
</td>
<td>
<div>
@if (totalVar != 0)
{
<span class="text-success">@calcPercFreq((double)record.EventCount)</span>
}
</div>
</td>
<td>
<div class="progress">
<div class="progress-bar @styleColourPBarFreq((double)record.EventCount/totalVar)" role="progressbar" style="@valFreq((double)record.EventCount)" aria-valuemin="0" aria-valuemax="100">@record.EventCount</div>
</div>
</td>
</tr>
}
</tbody>
</table>
}
</div>
</div>
+101 -105
View File
@@ -6,9 +6,70 @@ namespace MP.MONO.UI.Components
{
public partial class ListFreqAlarms
{
#region Public Properties
[Parameter]
public selectChartParams selFilter { get; set; } = null!;
[Parameter]
public EventCallback<int> TotRecordChanged { get; set; }
#endregion Public Properties
#region Protected Properties
protected int currPage
{
get => selFilter.CurrPage;
}
protected DateTime dtEnd
{
get => selFilter.dtMax;
}
protected DateTime dtStart
{
get => selFilter.dtMin;
}
protected List<AlarmFreqDTO>? ListRecordsFreq { get; set; } = null;
protected List<AlarmFreqDTO>? SearchRecordsFreq { get; set; } = null;
protected int totalVar { get; set; } = 0;
#endregion Protected Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
}
protected override async Task OnParametersSetAsync()
{
await ReloadData();
}
#endregion Protected Methods
#region Private Fields
private double sogliaGreen = 0;
private double sogliaRed = 1;
#endregion Private Fields
#region Private Properties
private int _totalCount { get; set; } = 0;
private int numRecord
{
get => selFilter.NumRecord;
}
private int totalCount
{
get => _totalCount;
@@ -21,125 +82,47 @@ namespace MP.MONO.UI.Components
}
}
}
[Parameter]
public EventCallback<bool> PagerResetReq { get; set; }
[Parameter]
public selectChartParams selFilter { get; set; } = null!;
#endregion Private Properties
[Parameter]
public EventCallback<int> TotRecordChanged { get; set; }
protected List<AlarmFreqDTO>? SearchRecordsFreq { get; set; } = null;
public int totalVar { get; set; } = 0;
private int numRecord
{
get => selFilter.MaxRecord;
set
{
if (selFilter.MaxRecord != value)
{
selFilter.MaxRecord = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
}
public int currPage
{
get => selFilter.CurrPage;
set
{
if (selFilter.CurrPage != value)
{
selFilter.CurrPage = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
}
protected DateTime _dtStart = DateTime.Now.AddHours(-24);
protected DateTime? dtStart
{
get => selFilter.dtMin;
set => selFilter.dtMin = value;
}
protected DateTime? dtEnd
{
get => selFilter.dtMax;
set => selFilter.dtMax = value;
}
private bool isLoading { get; set; } = false;
private async Task ReloadData()
{
DateTime dtMax = dtStart == null ? DateTime.Now : (DateTime)dtStart;
DateTime dtMin = dtEnd == null ? DateTime.Now.AddDays(-2) : (DateTime)dtEnd;
isLoading = true;
SearchRecordsFreq = CurrentDataService.dbController.AlarmRecGetParetoFreq(1, dtMin, dtMax);
ListRecordsFreq = SearchRecordsFreq.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
totalCount = SearchRecordsFreq.Count;
totalVar = SearchRecordsFreq.Sum(x => x.EventCount);
calcolaSoglieFreq();
await Task.Delay(1);
isLoading = false;
}
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;
}
protected override async Task OnInitializedAsync()
{
DateTime dtMax = dtStart == null ? DateTime.Now : (DateTime)dtStart;
DateTime dtMin = dtEnd == null ? DateTime.Now.AddDays(-2) : (DateTime)dtEnd;
SearchRecordsFreq = CurrentDataService.dbController.AlarmRecGetParetoFreq(1, dtMin, dtMax);
ListRecordsFreq = SearchRecordsFreq.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
await ReloadData();
}
private double sogliaGreen = 0;
private double sogliaRed = 1;
#region Private Methods
private void calcolaSoglieFreq()
{
int numRecord = totalCount;
var firstRecord = SearchRecordsFreq.Skip((int)(numRecord * 0.2)).FirstOrDefault();
var lastRecord = SearchRecordsFreq.Skip((int)(numRecord * 0.8)).FirstOrDefault();
if (firstRecord != null)
if (SearchRecordsFreq != null)
{
sogliaGreen = (double)firstRecord.EventCount / totalVar;
}
if (lastRecord != null)
{
sogliaRed = (double)lastRecord.EventCount / totalVar;
var firstRecord = SearchRecordsFreq.Skip((int)(numRecord * 0.2)).FirstOrDefault();
var lastRecord = SearchRecordsFreq.Skip((int)(numRecord * 0.8)).FirstOrDefault();
if (firstRecord != null)
{
sogliaGreen = (double)firstRecord.EventCount / totalVar;
}
if (lastRecord != null)
{
sogliaRed = (double)lastRecord.EventCount / totalVar;
}
}
}
protected string calcPercFreq(double numEvent)
private string calcPercFreq(double numEvent)
{
string ans = $"{numEvent / totalVar:P2}";
return ans;
}
protected string valFreq(double eventCount)
private async Task ReloadData()
{
int max = SearchRecordsFreq.Max(a => a.EventCount);
double divisione = eventCount / max;
int percentage = (int)(divisione * 100);
string ans = $"width: {percentage}%";
return ans;
SearchRecordsFreq = CurrentDataService.dbController.AlarmRecGetParetoFreq(1, dtStart, dtEnd);
ListRecordsFreq = SearchRecordsFreq.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
totalCount = SearchRecordsFreq.Count;
totalVar = SearchRecordsFreq.Sum(x => x.EventCount);
calcolaSoglieFreq();
await Task.Delay(1);
}
protected string styleColourPBarFreq(double eventFreq)
private string styleColourPBarFreq(double eventFreq)
{
string ans = "";
var source = ListRecordsFreq;
@@ -159,9 +142,22 @@ namespace MP.MONO.UI.Components
ans = "bg-warning";
}
return ans;
}
private string valFreq(double eventCount)
{
string ans = "";
if (SearchRecordsFreq != null)
{
int max = SearchRecordsFreq.Max(a => a.EventCount);
double divisione = eventCount / max;
int percentage = (int)(divisione * 100);
ans = $"width: {percentage}%";
}
return ans;
}
#endregion Private Methods
}
}
}
+1 -1
View File
@@ -1 +1 @@
467e4b24bc3fe9d237169aa274ae589b64f072fb1cd91f4d79aaee76c64afbfced7fb51536b62cf612dedfb304202a1e653778b7cc8c758f83bb058984460301
31e9cc1c2e8f30a1b4098cb157d712f11f3f2e60fb74169a354c3fa646d6d0e28518b4e3139f844b25824fbcc4340051fc507d22c1c2d2786d3786c777c31cc3
+29
View File
@@ -0,0 +1,29 @@
namespace MP.MONO.UI.Data
{
public class Utils
{
#region Public Methods
/// <summary> Inizializzazione con periodo e arrotondamento </summary> <param
/// name="dtRef">DataORa di riferimento</param> <param name="minRound">Arrotondamento
/// desiderato</param> <param name="roundMode">Parametro arrotondamento: se > 0 per eccesso,
/// se <= 0 per difetto</param> <returns></returns>
public static DateTime RoundDatetime(DateTime dtRef, int minRound, int roundMode)
{
TimeSpan DayElapsed = dtRef.Subtract(dtRef.Date);
int minDay = 0;
if (roundMode > 0)
{
minDay = (int)Math.Ceiling((double)(DayElapsed.TotalMinutes / minRound)) * minRound;
}
else
{
minDay = (int)Math.Floor((double)(DayElapsed.TotalMinutes / minRound)) * minRound;
}
DateTime endRounded = dtRef.Date.AddMinutes(minDay);
return endRounded;
}
#endregion Public Methods
}
}
+29 -4
View File
@@ -11,10 +11,29 @@
#region Public Properties
/// <summary>
/// Pagina corrente selezionata
/// </summary>
public int CurrPage { get; set; } = 1;
public DateTime? dtMax { get; set; } = null;
public DateTime? dtMin { get; set; } = null;
public int MaxRecord { get; set; } = 100;
/// <summary>
/// Data fine periodo
/// </summary>
public DateTime dtMax { get; set; } = Utils.RoundDatetime(DateTime.Now, 5, 1);
/// <summary>
/// Data inizio periodo
/// </summary>
public DateTime dtMin { get; set; } = Utils.RoundDatetime(DateTime.Now.AddDays(-1), 5, 0);
/// <summary>
/// Numero di record per pagina
/// </summary>
public int NumRecord { get; set; } = 10;
/// <summary>
/// Bool: indica se sia richeista analisi per frequenza (vs durata)
/// </summary>
public bool setFreqDur { get; set; } = true;
#endregion Public Properties
@@ -26,7 +45,7 @@
if (!(obj is selectChartParams item))
return false;
if (MaxRecord != item.MaxRecord)
if (NumRecord != item.NumRecord)
return false;
if (CurrPage != item.CurrPage)
@@ -35,6 +54,12 @@
if (setFreqDur != item.setFreqDur)
return false;
if (dtMax != item.dtMax)
return false;
if (dtMin != item.dtMin)
return false;
return true;
}
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Platforms>AnyCPU;x86;x64</Platforms>
<Version>1.2.2209.2909</Version>
<Version>1.2.2209.2910</Version>
</PropertyGroup>
<ItemGroup>
+3 -60
View File
@@ -4,28 +4,13 @@
@using MP.MONO.UI.Components
<div class="card mb-5">
<div class=" col-12 card-header table-primary p-1 d-flex justify-content-between">
<div class=" col-12 card-header table-primary d-flex justify-content-between">
<div class="col-2">
<h5>Alarm analysis</h5>
</div>
<div class ="col-10">
<ChartFilter FilterChanged="updateFilter"></ChartFilter>
<div class="col-10">
<AlAnFilter FilterChanged="updateFilter"></AlAnFilter>
</div>
@*<div class="px-2 col-4 d-flex justify-content-between">
<h7 class="py-1">Choose mode:</h7>
<div class="form-switch mx-3 py-1 col-7 d-flex justify-content-between">
<input class="form-check-input col-2 py-1" type="checkbox" role="switch" id="toggleRec" title="Show Alarms log or Alarm rec" @onclick="() => toggleRec()">
<label class="col-12" for="toggleRec">@currMode</label>
</div>
</div>
<div class="col-6 d-flex justify-content-between">
<div class="input-group mb-3">
<label class="input-group-text" title="Choose Date/Time where to start analizing">Start</label>
<input @bind=dtStart id="DtRef" class="form-control" type="datetime-local" title="Choose Date/Time where to start analizing">
<label class="input-group-text" title="Choose Date/Time where to finish analizing">End</label>
<input @bind=dtEnd id="DtRef" class="form-control" type="datetime-local" title="Choose Date/Time where to finish analizing">
</div>
</div>*@
</div>
<div class="card-body py-0 px-1">
@@ -42,48 +27,6 @@
@if (setFreqDur)
{
<ListFreqAlarms selFilter="@currFilter" TotRecordChanged="@updateTotal"></ListFreqAlarms>
@*<div class="row">
<div class="col-12">
<table class="table table-sm table-striped">
<thead>
<tr>
<th>Alarm Description</th>
<th>Alarm Event Count</th>
<th>Event Frequency</th>
<th>Event Frequency Chart</th>
</tr>
</thead>
<tbody>
@foreach (var record in ListRecordsFreq)
{
<tr>
<td>
<div>@record.AlarmDescription</div>
</td>
<td>
<div>@record.EventCount</div>
</td>
<td>
<div>
@if (totalVar != 0)
{
<span class="text-success">@calcPercFreq((double)record.EventCount)</span>
}
</div>
</td>
<td>
<div class="progress">
<div class="progress-bar @styleColourPBarFreq((double)record.EventCount/totalVar)" role="progressbar" style="@valFreq((double)record.EventCount)" aria-valuemin="0" aria-valuemax="100">@record.EventCount</div>
</div>
</td>
</tr>
}
</tbody>
</table>
</div>
</div>*@
}
else
{
+242 -264
View File
@@ -5,42 +5,9 @@ namespace MP.MONO.UI.Pages
{
public partial class AlarmsAnalysis
{
#region Private Fields
#region Public Properties
private AlarmFreqDTO? currRecord = null;
private List<AlarmFreqDTO>? ListRecordsFreq = null;
private List<AlarmDurationDTO>? ListRecordsDur = null;
private List<AlarmFreqDTO>? SearchRecordsFreq = null;
private List<AlarmDurationDTO>? SearchRecordsDur = null;
private selectChartParams currFilter { get; set; } = new selectChartParams();
#endregion Private Fields
#region Private Properties
private int _currPage { get; set; } = 1;
private int _numRecord { get; set; } = 10;
private int currPage
{
get => _currPage;
set
{
if (_currPage != value)
{
_currPage = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
}
public bool setFreqDur
public bool setFreqDur
{
get => currFilter.setFreqDur;
set
@@ -52,27 +19,147 @@ namespace MP.MONO.UI.Pages
pUpd.Wait();
}
}
}
private bool isLoading { get; set; } = false;
private int numRecord
{
get => _numRecord;
set
{
if (_numRecord != value)
{
_numRecord = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
}
#endregion Private Properties
#endregion Public Properties
#region Protected Fields
protected string percEvents = "";
protected double totalVar = 0;
#endregion Protected Fields
#region Protected Properties
protected string currMode
{
get => setFreqDur ? "Alarm frequency" : "Alarm duration";
}
protected DateTime dtEnd
{
get => currFilter.dtMax;
}
protected DateTime dtStart
{
get => currFilter.dtMin;
}
protected int totalCount { get; set; } = 0;
#endregion Protected Properties
#region Protected Methods
protected string calcPercDur(double duration)
{
string ans = $"{duration / totalVar:P2}";
return ans;
}
protected string calcPercFreq(double numEvent)
{
string ans = $"{numEvent / totalVar:P2}";
return ans;
}
protected void ForceReload(int newNum)
{
numRecord = newNum;
}
protected void ForceReloadPage(int newNum)
{
currPage = newNum;
}
protected override async Task OnInitializedAsync()
{
numRecord = 10;
#if false
if (setFreqDur)
{
SearchRecordsFreq = CurrentDataService.dbController.AlarmRecGetParetoFreq(1, dtStart, dtEnd);
ListRecordsFreq = SearchRecordsFreq.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
}
else
{
SearchRecordsDur = CurrentDataService.dbController.AlarmRecGetParetoDur(1, dtStart, dtEnd);
ListRecordsDur = SearchRecordsDur.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
//calcolaSoglieDur();
}
await ReloadData();
#endif
await Task.Delay(1);
}
protected override async Task OnParametersSetAsync()
{
isLoading = true;
await ReloadData();
await Task.Delay(1);
}
protected void ResetData()
{
currRecord = null;
}
protected void Select(AlarmFreqDTO selRecord)
{
// applico filtro da selezione
currRecord = selRecord;
}
protected string styleColourPBarDur(double duration)
{
string ans = "";
//var source = ListRecordsDur;
calcolaSoglieDur();
if (duration >= sogliaGreen)
{
ans = "bg-danger";
}
else if (duration <= sogliaRed)
{
ans = "bg-success";
}
else
{
ans = "bg-warning";
}
return ans;
}
protected string styleColourPBarFreq(double eventFreq)
{
string ans = "";
var source = ListRecordsFreq;
calcolaSoglieFreq();
if (eventFreq >= sogliaGreen)
{
ans = "bg-danger";
}
else if (eventFreq <= sogliaRed)
{
ans = "bg-success";
}
else
{
ans = "bg-warning";
}
return ans;
}
protected async Task toggleRec()
{
setFreqDur = !setFreqDur;
@@ -80,52 +167,125 @@ namespace MP.MONO.UI.Pages
await ReloadData();
}
protected DateTime _dtStart = DateTime.Now.AddHours(-24);
protected DateTime dtStart
protected async Task UpdateData()
{
get => _dtStart;
currRecord = null;
await ReloadData();
}
protected void updateTotal(int newTotCount)
{
totalCount = newTotCount;
}
protected string valDur(double duration)
{
double max = SearchRecordsDur.Max(a => a.Duration);
double divisione = duration / max;
int percentage = (int)(divisione * 100);
string ans = $"width: {percentage}%";
return ans;
}
protected string valFreq(double eventCount)
{
int max = SearchRecordsFreq.Max(a => a.EventCount);
double divisione = eventCount / max;
int percentage = (int)(divisione * 100);
string ans = $"width: {percentage}%";
return ans;
}
#endregion Protected Methods
#region Private Fields
private AlarmFreqDTO? currRecord = null;
private List<AlarmDurationDTO>? ListRecordsDur = null;
private List<AlarmFreqDTO>? ListRecordsFreq = null;
private List<AlarmDurationDTO>? SearchRecordsDur = null;
private List<AlarmFreqDTO>? SearchRecordsFreq = null;
private double sogliaGreen = 0;
private double sogliaRed = 1;
#endregion Private Fields
#region Private Properties
private int _numRecord { get; set; } = 10;
private selectChartParams currFilter { get; set; } = new selectChartParams();
private int currPage
{
get => currFilter.CurrPage;
set
{
_dtStart = value;
var pUpd = Task.Run(async () =>
if (currFilter.CurrPage != value)
{
await ReloadData();
});
pUpd.Wait();
currFilter.CurrPage = value;
}
}
}
protected DateTime _dtEnd = DateTime.Now;
private bool isLoading { get; set; } = false;
protected DateTime dtEnd
private int numRecord
{
get => _dtEnd;
get => currFilter.NumRecord;
set
{
_dtEnd = value;
var pUpd = Task.Run(async () =>
if (currFilter.NumRecord != value)
{
await ReloadData();
});
pUpd.Wait();
currFilter.NumRecord = value;
}
}
}
protected int totalCount { get; set; } = 0;
protected string currMode
{
get => setFreqDur ? "Alarm frequency" : "Alarm duration";
}
protected double totalVar = 0;
protected string percEvents = "";
#endregion Protected Properties
#region Private Methods isLoading = false;
#endregion Private Properties
//}
#region Private Methods
private void calcolaSoglieDur()
{
int numRecord = totalCount;
var firstRecord = SearchRecordsDur.Skip((int)(numRecord * 0.2)).FirstOrDefault();
var lastRecord = SearchRecordsDur.Skip((int)(numRecord * 0.8)).FirstOrDefault();
if (firstRecord != null)
{
sogliaGreen = (double)firstRecord.Duration / totalVar;
}
if (lastRecord != null)
{
sogliaRed = (double)lastRecord.Duration / totalVar;
}
}
private void calcolaSoglieFreq()
{
int numRecord = totalCount;
var firstRecord = SearchRecordsFreq.Skip((int)(numRecord * 0.2)).FirstOrDefault();
var lastRecord = SearchRecordsFreq.Skip((int)(numRecord * 0.8)).FirstOrDefault();
if (firstRecord != null)
{
sogliaGreen = (double)firstRecord.EventCount / totalVar;
}
if (lastRecord != null)
{
sogliaRed = (double)lastRecord.EventCount / totalVar;
}
}
private async Task ReloadData()
{
isLoading = true;
@@ -153,188 +313,6 @@ namespace MP.MONO.UI.Pages
isLoading = false;
}
#endregion Private Methods isLoading = false;
#region Protected Methods
protected void ForceReload(int newNum)
{
numRecord = newNum;
}
protected void ForceReloadPage(int newNum)
{
currPage = newNum;
}
protected override async Task OnInitializedAsync()
{
numRecord = 10;
if (setFreqDur)
{
SearchRecordsFreq = CurrentDataService.dbController.AlarmRecGetParetoFreq(1, dtStart, dtEnd);
ListRecordsFreq = SearchRecordsFreq.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
}
else
{
SearchRecordsDur = CurrentDataService.dbController.AlarmRecGetParetoDur(1, dtStart, dtEnd);
ListRecordsDur = SearchRecordsDur.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
//calcolaSoglieDur();
}
await ReloadData();
}
private double sogliaGreen = 0;
private double sogliaRed = 1;
private void calcolaSoglieFreq()
{
int numRecord = totalCount;
var firstRecord = SearchRecordsFreq.Skip((int)(numRecord * 0.2)).FirstOrDefault();
var lastRecord = SearchRecordsFreq.Skip((int)(numRecord * 0.8)).FirstOrDefault();
if (firstRecord != null)
{
sogliaGreen = (double)firstRecord.EventCount / totalVar;
}
if (lastRecord != null)
{
sogliaRed = (double)lastRecord.EventCount / totalVar;
}
}
private void calcolaSoglieDur()
{
int numRecord = totalCount;
var firstRecord = SearchRecordsDur.Skip((int)(numRecord * 0.2)).FirstOrDefault();
var lastRecord = SearchRecordsDur.Skip((int)(numRecord * 0.8)).FirstOrDefault();
if (firstRecord != null)
{
sogliaGreen = (double)firstRecord.Duration / totalVar;
}
if (lastRecord != null)
{
sogliaRed = (double)lastRecord.Duration / totalVar;
}
}
protected void ResetData()
{
currRecord = null;
}
protected string calcPercFreq(double numEvent)
{
string ans = $"{numEvent / totalVar:P2}";
return ans;
}
protected string calcPercDur(double duration)
{
string ans = $"{duration / totalVar:P2}";
return ans;
}
protected string valFreq(double eventCount)
{
int max = SearchRecordsFreq.Max(a => a.EventCount);
double divisione = eventCount / max;
int percentage = (int)(divisione * 100);
string ans = $"width: {percentage}%";
return ans;
}
protected string valDur(double duration)
{
double max = SearchRecordsDur.Max(a => a.Duration);
double divisione = duration / max;
int percentage = (int)(divisione * 100);
string ans = $"width: {percentage}%";
return ans;
}
protected string styleColourPBarFreq(double eventFreq)
{
string ans = "";
var source = ListRecordsFreq;
calcolaSoglieFreq();
if (eventFreq >= sogliaGreen)
{
ans = "bg-danger";
}
else if (eventFreq <= sogliaRed)
{
ans = "bg-success";
}
else
{
ans = "bg-warning";
}
return ans;
}
protected string styleColourPBarDur(double duration)
{
string ans = "";
//var source = ListRecordsDur;
calcolaSoglieDur();
if (duration >= sogliaGreen)
{
ans = "bg-danger";
}
else if (duration <= sogliaRed)
{
ans = "bg-success";
}
else
{
ans = "bg-warning";
}
return ans;
}
protected void Select(AlarmFreqDTO selRecord)
{
// applico filtro da selezione
currRecord = selRecord;
}
protected async Task UpdateData()
{
currRecord = null;
await ReloadData();
}
protected override async Task OnParametersSetAsync()
{
isLoading = true;
await ReloadData();
await Task.Delay(1);
}
#endregion Protected Methods
#region Public Methods
protected void updateTotal(int newTotCount)
{
totalCount = newTotCount;
}
private async Task updateFilter(selectChartParams newParams)
{
isLoading = true;
@@ -345,7 +323,7 @@ namespace MP.MONO.UI.Pages
newParams.CurrPage = 1;
}
await Task.Delay(1);
newParams.dtMax = dtEnd;
newParams.dtMin = dtStart;
await InvokeAsync(() => StateHasChanged());
@@ -353,6 +331,6 @@ namespace MP.MONO.UI.Pages
isLoading = false;
}
#endregion Public Methods
#endregion Private Methods
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.2.2209.2909</h4>
<h4>Version: 1.2.2209.2910</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.2.2209.2909
1.2.2209.2910
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.2.2209.2909</version>
<version>1.2.2209.2910</version>
<url>http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/MP.Mon.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+33 -33
View File
@@ -2,55 +2,55 @@
"AdapterType": "Ethernet 802.3",
"AddressWidth": "64",
"Architecture": "9",
"BiosVersion": "_ASUS_ - 1072009",
"BuildNumber": "19043",
"Caption": "Microsoft Windows 10 Pro",
"ConfiguredClockSpeed": "2400",
"BiosVersion": "ALASKA - 1072009",
"BuildNumber": "19044",
"Caption": "Microsoft Windows 10 Pro N",
"ConfiguredClockSpeed": "3600",
"ConfiguredVoltage": "1200",
"CpuVersion": "Modello 1, Stepping 0",
"CurrentClockSpeed": "2200",
"CurrentVoltage": "12",
"CurrentClockSpeed": "3501",
"CurrentVoltage": "11",
"DataWidth": "64",
"Description": "AMD64 Family 23 Model 17 Stepping 0",
"DeviceLocator": "ChannelA-DIMM0",
"Description": "AMD64 Family 23 Model 113 Stepping 0",
"DeviceLocator": "DIMM 1",
"ExtClock": "100",
"Family": "107",
"FormFactor": "12",
"GUID": "{7F313732-DBA3-46E5-9FA7-BEF235B0682E}",
"L2CacheSize": "2048",
"L3CacheSize": "4096",
"FormFactor": "8",
"GUID": "{E76995C4-F180-406E-B9C3-E491C65A8FCF}",
"L2CacheSize": "8192",
"L3CacheSize": "65536",
"Level": "23",
"LoadPercentage": "32",
"MACAddress": "4C:ED:FB:D9:78:83",
"Manufacturer": "American Megatrends Inc.",
"LoadPercentage": "62",
"MACAddress": "0C:9D:92:B8:FD:E8",
"Manufacturer": "American Megatrends International, LLC.",
"MaxNumberOfProcesses": "4294967295",
"MaxProcessMemorySize": "137438953344",
"MaxVoltage": "1200",
"MinVoltage": "1200",
"Name": "Realtek PCIe GbE Family Controller",
"NumberOfCores": "4",
"NumberOfLogicalProcessors": "8",
"Name": "ASUS XG-C100C 10G PCI-E Network Adapter",
"NumberOfCores": "16",
"NumberOfLogicalProcessors": "32",
"OSArchitecture": "64 bit",
"PartNumber": "8ATF1G64HZ-2G3E1 ",
"PartNumber": "CMK64GX4M2D3600C18",
"PhysicalAdapter": "True",
"ProcessorId": "178BFBFF00810F10",
"ProcessorId": "178BFBFF00870F10",
"ProcessorType": "3",
"ProductName": "Realtek PCIe GbE Family Controller",
"ReleaseDate": "20190521000000.000000+000",
"Revision": "4352",
"ProductName": "ASUS XG-C100C 10G PCI-E Network Adapter",
"ReleaseDate": "20210521000000.000000+000",
"Revision": "28928",
"Role": "CPU",
"SerialNumber": "00330-80951-85780-AA242",
"ServiceName": "rt640x64",
"SMBIOSBIOSVersion": "X505ZA.311",
"SerialNumber": "00332-00332-17209-AA940",
"ServiceName": "aqnic650",
"SMBIOSBIOSVersion": "F33",
"SMBIOSMajorVersion": "3",
"SMBIOSMemoryType": "26",
"SMBIOSMinorVersion": "1",
"SocketDesignation": "FP5",
"SoftwareElementID": "X505ZA.311",
"SMBIOSMinorVersion": "3",
"SocketDesignation": "AM4",
"SoftwareElementID": "F33",
"SoftwareElementState": "3",
"Speed": "2400",
"Speed": "3600",
"SystemBiosMajorVersion": "5",
"SystemBiosMinorVersion": "13",
"SystemName": "EGALW-NB-004",
"Version": "10.0.19043"
"SystemBiosMinorVersion": "17",
"SystemName": "WRKST-R9-SAM",
"Version": "10.0.19044"
}