aggiunta componente alarmDur + cleanUp

This commit is contained in:
zaccaria.majid
2022-09-29 11:06:01 +02:00
parent ac759f53ee
commit 5f7d2ab1ae
11 changed files with 268 additions and 250 deletions
+56
View File
@@ -0,0 +1,56 @@
<div class="row">
<div class="col-12">
@if (ListRecordsDur == null)
{
<LoadingData></LoadingData>
}
else if (totalCount == 0)
{
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
}
else
{
<div class="row">
<div class="col-12">
<table class="table table-sm table-striped">
<thead>
<tr>
<th>Alarm Description</th>
<th>Alarm Duration</th>
<th>Event Duration</th>
<th>Event Duration Chart</th>
</tr>
</thead>
<tbody>
@foreach (var item in ListRecordsDur)
{
<tr>
<td>
<div>@item.AlarmDescription</div>
</td>
<td>
<div>@Math.Round(item.Duration,2)</div>
</td>
<td>
<div>
@if (totalVar != 0)
{
<span class="text-success">@calcPercDur((double)item.Duration)</span>
}
</div>
</td>
<td>
<div class="progress">
<div class="progress-bar @styleColourPBarDur((double)item.Duration/totalVar)" role="progressbar" style="@valDur((double)item.Duration)" aria-valuemin="0" aria-valuemax="100">@Math.Round(item.Duration,2)</div>
</div>
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
}
</div>
</div>
@@ -0,0 +1,169 @@
using Microsoft.AspNetCore.Components;
using MP.MONO.Data.DTO;
using MP.MONO.UI.Data;
namespace MP.MONO.UI.Components
{
public partial class ListDurAlarms
{
#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<AlarmDurationDTO>? ListRecordsDur { get; set; } = null;
protected List<AlarmDurationDTO>? SearchRecordsDur { get; set; } = null;
protected double 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;
set
{
if (_totalCount != value)
{
_totalCount = value;
TotRecordChanged.InvokeAsync(value);
}
}
}
#endregion Private Properties
#region Private Methods
private void calcolaSoglieDur()
{
int numRecord = totalCount;
if (SearchRecordsDur != null)
{
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 string calcPercDur(double duration)
{
string ans = $"{duration / totalVar:P2}";
return ans;
}
private async Task ReloadData()
{
SearchRecordsDur = CurrentDataService.dbController.AlarmRecGetParetoDur(1, dtStart, dtEnd);
ListRecordsDur = SearchRecordsDur.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
totalCount = SearchRecordsDur.Count;
totalVar = SearchRecordsDur.Sum(x => x.Duration);
//calcolaSoglieDur();
await Task.Delay(1);
}
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 valDur(double duration)
{
string ans = "";
if (SearchRecordsDur != null)
{
double max = SearchRecordsDur.Max(a => a.Duration);
double divisione = duration / max;
int percentage = (int)(divisione * 100);
ans = $"width: {percentage}%";
}
return ans;
}
#endregion Private Methods
}
}
+1 -1
View File
@@ -49,4 +49,4 @@
</table>
}
</div>
</div>
</div>
+1 -1
View File
@@ -1 +1 @@
31e9cc1c2e8f30a1b4098cb157d712f11f3f2e60fb74169a354c3fa646d6d0e28518b4e3139f844b25824fbcc4340051fc507d22c1c2d2786d3786c777c31cc3
467e4b24bc3fe9d237169aa274ae589b64f072fb1cd91f4d79aaee76c64afbfced7fb51536b62cf612dedfb304202a1e653778b7cc8c758f83bb058984460301
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Platforms>AnyCPU;x86;x64</Platforms>
<Version>1.2.2209.2910</Version>
<Version>1.2.2209.2911</Version>
</PropertyGroup>
<ItemGroup>
+3 -55
View File
@@ -13,65 +13,13 @@
</div>
</div>
<div class="card-body py-0 px-1">
@if ((ListRecordsFreq == null && setFreqDur) || (ListRecordsDur == null && !setFreqDur))
@if (setFreqDur)
{
<LoadingData></LoadingData>
}
else if (totalCount == 0)
{
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
<ListFreqAlarms selFilter="@currFilter" TotRecordChanged="@updateTotal"></ListFreqAlarms>
}
else
{
@if (setFreqDur)
{
<ListFreqAlarms selFilter="@currFilter" TotRecordChanged="@updateTotal"></ListFreqAlarms>
}
else
{
<div class="row">
<div class="col-12">
<table class="table table-sm table-striped">
<thead>
<tr>
<th>Alarm Description</th>
<th>Alarm Duration</th>
<th>Event Duration</th>
<th>Event Duration Chart</th>
</tr>
</thead>
<tbody>
@foreach (var item in ListRecordsDur)
{
<tr>
<td>
<div>@item.AlarmDescription</div>
</td>
<td>
<div>@Math.Round(item.Duration,2)</div>
</td>
<td>
<div>
@if (totalVar != 0)
{
<span class="text-success">@calcPercDur((double)item.Duration)</span>
}
</div>
</td>
<td>
<div class="progress">
<div class="progress-bar @styleColourPBarDur((double)item.Duration/totalVar)" role="progressbar" style="@valDur((double)item.Duration)" aria-valuemin="0" aria-valuemax="100">@Math.Round(item.Duration,2)</div>
</div>
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
}
<ListDurAlarms selFilter="@currFilter" TotRecordChanged="@updateTotal"></ListDurAlarms>
}
</div>
<div class="card-footer py-1">
+1 -156
View File
@@ -52,20 +52,6 @@ namespace MP.MONO.UI.Pages
#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;
@@ -79,20 +65,6 @@ namespace MP.MONO.UI.Pages
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);
}
@@ -114,52 +86,6 @@ namespace MP.MONO.UI.Pages
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;
@@ -178,44 +104,12 @@ namespace MP.MONO.UI.Pages
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
@@ -252,63 +146,14 @@ namespace MP.MONO.UI.Pages
#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;
DateTime adesso = DateTime.Now;
//SearchRecords = CurrentDataService.dbController.AlarmRecGetParetoFreq(1, adesso.AddHours(-numHourPrev), adesso);
if (setFreqDur)
{
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);
}
else
{
SearchRecordsDur = CurrentDataService.dbController.AlarmRecGetParetoDur(1, dtStart, dtEnd);
ListRecordsDur = SearchRecordsDur.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
totalCount = SearchRecordsDur.Count;
totalVar = SearchRecordsDur.Sum(x => x.Duration);
//calcolaSoglieDur();
await Task.Delay(1);
}
await Task.Delay(1);
isLoading = false;
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.2.2209.2910</h4>
<h4>Version: 1.2.2209.2911</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.2.2209.2910
1.2.2209.2911
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.2.2209.2910</version>
<version>1.2.2209.2911</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": "ALASKA - 1072009",
"BuildNumber": "19044",
"Caption": "Microsoft Windows 10 Pro N",
"ConfiguredClockSpeed": "3600",
"BiosVersion": "_ASUS_ - 1072009",
"BuildNumber": "19043",
"Caption": "Microsoft Windows 10 Pro",
"ConfiguredClockSpeed": "2400",
"ConfiguredVoltage": "1200",
"CpuVersion": "Modello 1, Stepping 0",
"CurrentClockSpeed": "3501",
"CurrentVoltage": "11",
"CurrentClockSpeed": "2200",
"CurrentVoltage": "12",
"DataWidth": "64",
"Description": "AMD64 Family 23 Model 113 Stepping 0",
"DeviceLocator": "DIMM 1",
"Description": "AMD64 Family 23 Model 17 Stepping 0",
"DeviceLocator": "ChannelA-DIMM0",
"ExtClock": "100",
"Family": "107",
"FormFactor": "8",
"GUID": "{E76995C4-F180-406E-B9C3-E491C65A8FCF}",
"L2CacheSize": "8192",
"L3CacheSize": "65536",
"FormFactor": "12",
"GUID": "{7F313732-DBA3-46E5-9FA7-BEF235B0682E}",
"L2CacheSize": "2048",
"L3CacheSize": "4096",
"Level": "23",
"LoadPercentage": "62",
"MACAddress": "0C:9D:92:B8:FD:E8",
"Manufacturer": "American Megatrends International, LLC.",
"LoadPercentage": "2",
"MACAddress": "4C:ED:FB:D9:78:83",
"Manufacturer": "American Megatrends Inc.",
"MaxNumberOfProcesses": "4294967295",
"MaxProcessMemorySize": "137438953344",
"MaxVoltage": "1200",
"MinVoltage": "1200",
"Name": "ASUS XG-C100C 10G PCI-E Network Adapter",
"NumberOfCores": "16",
"NumberOfLogicalProcessors": "32",
"Name": "Realtek PCIe GbE Family Controller",
"NumberOfCores": "4",
"NumberOfLogicalProcessors": "8",
"OSArchitecture": "64 bit",
"PartNumber": "CMK64GX4M2D3600C18",
"PartNumber": "8ATF1G64HZ-2G3E1 ",
"PhysicalAdapter": "True",
"ProcessorId": "178BFBFF00870F10",
"ProcessorId": "178BFBFF00810F10",
"ProcessorType": "3",
"ProductName": "ASUS XG-C100C 10G PCI-E Network Adapter",
"ReleaseDate": "20210521000000.000000+000",
"Revision": "28928",
"ProductName": "Realtek PCIe GbE Family Controller",
"ReleaseDate": "20190521000000.000000+000",
"Revision": "4352",
"Role": "CPU",
"SerialNumber": "00332-00332-17209-AA940",
"ServiceName": "aqnic650",
"SMBIOSBIOSVersion": "F33",
"SerialNumber": "00330-80951-85780-AA242",
"ServiceName": "rt640x64",
"SMBIOSBIOSVersion": "X505ZA.311",
"SMBIOSMajorVersion": "3",
"SMBIOSMemoryType": "26",
"SMBIOSMinorVersion": "3",
"SocketDesignation": "AM4",
"SoftwareElementID": "F33",
"SMBIOSMinorVersion": "1",
"SocketDesignation": "FP5",
"SoftwareElementID": "X505ZA.311",
"SoftwareElementState": "3",
"Speed": "3600",
"Speed": "2400",
"SystemBiosMajorVersion": "5",
"SystemBiosMinorVersion": "17",
"SystemName": "WRKST-R9-SAM",
"Version": "10.0.19044"
"SystemBiosMinorVersion": "13",
"SystemName": "EGALW-NB-004",
"Version": "10.0.19043"
}