This commit is contained in:
Samuele Locatelli
2022-11-07 14:51:42 +01:00
23 changed files with 185 additions and 96 deletions
+4 -1
View File
@@ -642,7 +642,10 @@ async void AlarmsValPipe_EA_NewMessage(object? sender, EventArgs e)
}
// salvo nuovo elenco allarmi
lastAlarms = alarmList;
if (alarmList != null)
{
lastAlarms = alarmList;
}
}
catch
{ }
+6 -2
View File
@@ -97,6 +97,7 @@ threadMaint.Start();
threadTools.Start();
threadEvHistory.Start();
threadActLog.Start();
#if false
/// <summary>
/// verifica esistenza file oppure lo crea...
@@ -108,7 +109,8 @@ void checkFilePresent(string filePath)
{
File.WriteAllText(filePath, $"{filePath} created!");
}
}
}
#endif
/// <summary>
/// Setup e salvataggio redis delle conf (es modi/stati)
@@ -298,7 +300,9 @@ void simAlarms()
{
DateTime lastOk = DateTime.Now;
DateTime lastAlarm = DateTime.Now.AddMilliseconds(-1);
int stdPeriod = 1000;
#if false
int stdPeriod = 1000;
#endif
/* Modalità simulazione blink...
* - verifico da quanto non ho allarmi
+63 -56
View File
@@ -7,75 +7,82 @@
@if (@ListRecords != null)
{
<div class="card text-dark mb-3">
<h5 class="card-header @css() text-center fw-bold"><i class="bi bi-exclamation-triangle pe-2" aria-hidden="true"></i> ALARMS</h5>
<div class="card-body">
<div class="px-0 mx-1 py-1 text-start rounded">
<div class="card-body px-0 py-0 @css() align-content-center rounded">
<div>
<div class="px-2 text-center">
<div class="card-body px-0 py-0 align-content-center rounded">
<div>
<div class="px-2 text-center">
@if (!compMode)
{
<b>Current alarms</b>
@if (ListRecords.Count == 0)
{
<span class="badge m-2 bg-success text-dark"><b>@ListRecords.Count</b></span>
}@*
else
{
<span class="badge m-2 bg-danger text-warning"><b>@ListRecords.Count</b></span>
}*@
}
else
{
@if (ListRecords.Count == 0)
{
<h6 class="text-dark"><b>ACTIVE ALARMS:</b><span class="badge m-2 bg-success text-light fs-6"><b>@ListRecords.Count</b></span></h6>
}
@*else
{
<h6 class="text-warning"><b>ACTIVE ALARMS:</b><span class="badge m-2 bg-danger text-warning fs-6"><b>@ListRecords.Count</b></span></h6>
}*@
}
</div>
</div>
@if (!compMode)
{
<div class="d-grid p-0">
<NavLink class="btn btn-outline-dark btn-block fw-bold" href="AlarmsAnalysis">
<i class="bi bi-bar-chart pe-2" aria-hidden="true"></i> Alarm Analysis
</NavLink>
</div>
}
</div>
@if (!compMode)
{
<b>Current alarms</b>
@if (ListRecords.Count == 0)
if (@ListRecords.Count == 0)
{
<span class="badge m-2 bg-success text-light"><b>@ListRecords.Count</b></span>
<div class="alert alert-success text-center display-4 mb-0">All OK</div>
}
else
{
<span class="badge m-2 bg-danger text-warning"><b>@ListRecords.Count</b></span>
}
}
else
{
@if (ListRecords.Count == 0)
{
<h6 class="text-light"><b>ACTIVE ALARMS:</b><span class="badge m-2 bg-success text-light fs-6"><b>@ListRecords.Count</b></span></h6>
}
else
{
<h6 class="text-warning"><b>ACTIVE ALARMS:</b><span class="badge m-2 bg-danger text-warning fs-6"><b>@ListRecords.Count</b></span></h6>
<ul class="list-group">
@foreach (var item in ListRecords)
{
<li class="list-group-item alarms list-group-item-action text-warning bg-danger px-2">
<div class="textConsensed w-100 small" title="order">
<div class="small">
@item.Title
</div>
<div class="">
<span class="text-break">@item.Value</span>
</div>
</div>
</li>
}
</ul>
}
}
</div>
</div>
@if (!compMode)
{
<div class="d-grid p-0">
<NavLink class="btn btn-outline-dark btn-block fw-bold" href="AlarmsAnalysis">
<i class="bi bi-bar-chart pe-2" aria-hidden="true"></i> Alarm Analysis
</NavLink>
</div>
}
</div>
@if (!compMode)
{
if (@ListRecords.Count == 0)
{
<div class="alert alert-success text-center display-4 mb-0">All OK</div>
}
else
{
<ul class="list-group">
@foreach (var item in ListRecords)
{
<li class="list-group-item alarms list-group-item-action text-warning bg-danger px-2">
<div class="textConsensed w-100 small" title="order">
<div class="small">
@item.Title
</div>
<div class="">
<span class="text-break">@item.Value</span>
</div>
</div>
</li>
}
</ul>
}
}
}
else
{
+20 -11
View File
@@ -28,18 +28,15 @@ namespace MP.MONO.UI.Components
private string css()
{
string answ = "";
if (compMode)
if (ListRecords != null)
{
if (ListRecords != null)
if (ListRecords.Count == 0)
{
if (ListRecords.Count == 0)
{
answ = "text-dark bg-success";
}
else
{
answ = "pulse-warning text-dark bg-danger";
}
answ = "text-dark";
}
else
{
answ = "pulse-warning text-warning bg-danger ";
}
}
return answ;
@@ -115,6 +112,16 @@ namespace MP.MONO.UI.Components
}).ToList();
messageReceived.InvokeAsync(alarmList.Count);
}
if (ListRecords.Count != 0 || ListRecords == null)
{
compMode = false;
trigger.show = false;
}
else
{
compMode = true;
trigger.show = true;
}
}
catch
{ }
@@ -124,8 +131,10 @@ namespace MP.MONO.UI.Components
StateHasChanged();
});
numAlarm = ListRecords.Count;
}
}
toolsTrigger trigger = new toolsTrigger();
#endregion Private Methods
}
}
+12 -2
View File
@@ -103,6 +103,7 @@
<tr>
@if (!compMode)
{
<th></th>
<th>ID</th>
<th>Created</th>
<th>Topic</th>
@@ -124,7 +125,17 @@
<tr>
@if (!compMode)
{
<td>@record.PMTaskeNav.ExtIdx</td>
<td>
<NavLink href="@pathFinder(@record.PMTaskeNav.ExtIdx)" target="_blank">
<button class="btn btn-sm btn-primary text-decoration-none" title="Open relative file"><i class="fa-solid fa-up-right-from-square"></i></button>
</NavLink>
</td>
<td>
<div class="d-flex justify-content-between text-nowrap">
@record.PMTaskeNav.ExtIdx &nbsp;
</div>
</td>
<td>@record.DtCreation.ToString("yyyy-MM-dd HH:mm:ss")</td>
<td>@record.PMTaskeNav.TopicNav.Description</td>
<td>@record.PMTaskeNav.MachGroupNav.Description</td>
@@ -170,7 +181,6 @@
opacity: 0.0;
-webkit-transition: all 500ms ease-in-out;
-moz-transition: all 500ms ease-in-out;
-ms-transition: all 500ms ease-in-out;
-o-transition: all 500ms ease-in-out;
transition: all 500ms ease-in-out;
}
@@ -3,11 +3,20 @@ using MP.MONO.Core;
using MP.MONO.Data;
using MP.MONO.Data.DbModels;
using Newtonsoft.Json;
using System.IO;
using System.Web;
using IHostingEnvironment = Microsoft.AspNetCore.Hosting.IWebHostEnvironment;
namespace MP.MONO.UI.Components
{
public partial class MaintTaskPending
{
//private readonly IWebHostEnvironment _environment;
//public MaintTaskPending(IWebHostEnvironment environment)
//{
// _environment = environment;
//}
#region Private Fields
private int _MaxRecord = 1000;
@@ -64,7 +73,8 @@ namespace MP.MONO.UI.Components
{
get => compMode ? "p-1" : "";
}
public string dir = "";
#endregion Public Properties
@@ -172,9 +182,10 @@ namespace MP.MONO.UI.Components
#endregion Private Properties
#region Protected Methods
//private readonly IWebHostEnvironment _HostEnvironment;
protected override async Task OnInitializedAsync()
{
//dir = _HostEnvironment.WebRootPath;
await ReloadData();
MaintPendingRefreshVetoMin = Configuration.GetValue<int>("OptPar:MaintPendingRefreshVetoMin");
PercLim = Configuration.GetValue<int>("OptPar:MaintLimitPerc");
@@ -208,6 +219,29 @@ namespace MP.MONO.UI.Components
ShowConfirm(0);
}
}
#if false
string wwwroot = "";
string file = "";
#endif
private string pathFinder(int id)
{
//wwwroot = _environment.WebRootPath;
#if false
file = Path.Combine(wwwroot, id + ".pdf");
#endif
string answ = "";
string path = "Docs/Maint/" + id + ".pdf";
if (File.Exists("wwwroot/" + path))
{
answ = path;
}
else
{
path = "Docs/Maint/empty.pdf";
answ = path;
}
return answ;
}
private void ForceReload(int newNum)
{
@@ -262,11 +296,13 @@ namespace MP.MONO.UI.Components
}
#endregion Private Methods
#if false
private bool showParams = false;
private void toggleShowParams()
{
showParams = !showParams;
}
}
#endif
}
}
@@ -151,7 +151,6 @@
opacity: 0.0;
-webkit-transition: all 500ms ease-in-out;
-moz-transition: all 500ms ease-in-out;
-ms-transition: all 500ms ease-in-out;
-o-transition: all 500ms ease-in-out;
transition: all 500ms ease-in-out;
}
@@ -43,7 +43,9 @@ namespace MP.MONO.UI.Components
private int _MaxRecord = 200;
private PrevMaintTaskModel? currRec = new PrevMaintTaskModel();
private bool doSetup = false;
#if false
private bool doSetup = false;
#endif
private List<PrevMaintTaskModel>? ListRecords = null;
@@ -52,7 +54,6 @@ namespace MP.MONO.UI.Components
private List<PrevMaintTaskModel>? SearchRecords = null;
private bool showParams = false;
#endregion Private Fields
@@ -187,7 +188,9 @@ namespace MP.MONO.UI.Components
/// <returns></returns>
private async Task DeleteRecord(PrevMaintTaskModel currRec)
{
#if false
bool stopDelete = false;
# endif
bool forceDelete = false;
string confirmMessage = "Are you sure?";
// verifico messaggio secondo livello protezione...
@@ -273,7 +276,7 @@ namespace MP.MONO.UI.Components
isLoading = false;
}
private async Task ShowDetail(PrevMaintTaskModel currRec)
private async Task ShowDetail(PrevMaintTaskModel? currRec)
{
selRecord = currRec;
if (currRec != null)
+3 -1
View File
@@ -103,11 +103,13 @@ namespace MP.MONO.UI.Components
return answ;
}
#if false
protected override async Task OnInitializedAsync()
{
//await ReloadData();
//await Task.Delay(1);
}
}
#endif
protected override async Task OnParametersSetAsync()
{
+7
View File
@@ -0,0 +1,7 @@
namespace MP.MONO.UI.Data
{
public class toolsTrigger
{
public bool show { get; set; } = true;
}
}
+10
View File
@@ -18,6 +18,16 @@
<Content Remove="NLog.config" />
</ItemGroup>
<ItemGroup>
<None Remove="Docs\Maint\empty.pdf" />
</ItemGroup>
<ItemGroup>
<Content Include="Docs\Maint\empty.pdf">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="compilerconfig.json" />
<None Include="NLog.config">
+13 -7
View File
@@ -7,13 +7,13 @@
<div class="d-flex justify-content-between">
<h1 class="col-9">@AppName</h1>
<div class="col-3">
<div class="px-0 mx-1 py-1 text-center rounded">
<NavLink href="Alarms" class="text-decoration-none" title="ALARMS Detail Page">
<AlarmsOverview compMode="true"></AlarmsOverview>
</NavLink>
</div>
@*<div class="col-3">
<div class="px-0 mx-1 py-1 text-center rounded">
<NavLink href="Alarms" class="text-decoration-none" title="ALARMS Detail Page">
<AlarmsOverview compMode="true"></AlarmsOverview>
</NavLink>
</div>
</div>*@
</div>
</div>
<div class="card-body">
@@ -49,7 +49,13 @@
</div>
</NavLink>
</div>
<div class="col-3">
<div class="px-0 mx-1 py-1 text-center rounded">
<NavLink href="Alarms" class="text-decoration-none" title="ALARMS Detail Page">
<AlarmsOverview compMode="true"></AlarmsOverview>
</NavLink>
</div>
<NavLink href="Tools" class="text-decoration-none" title="TOOLS Detail Page">
<div class="card text-dark mb-3">
<h5 class="card-header text-center fw-bold"><i class="fa-solid fa-toolbox"></i> TOOLS</h5>
@@ -61,4 +67,4 @@
</div>
</div>
</div>
</div>
</div>
+1 -1
View File
@@ -21,4 +21,4 @@ namespace MP.MONO.UI.Pages
#endregion Private Properties
}
}
}
-1
View File
@@ -13,7 +13,6 @@ namespace MP.MONO.UI.Pages
#region Private Fields
private int maxRecord = 120;
private bool showParam = false;
protected int maxDisplay = 16;
Binary file not shown.
-3
View File
@@ -24,9 +24,6 @@ body {
box-shadow: 0px 0px 20px 5px rgba(255, 0, 0, 0.8);
animation: pulse-warning 2.5s infinite;
}
.pulse-warning:hover {
color: #ffffff !important;
}
@-webkit-keyframes pulse-warning {
0% {
-webkit-box-shadow: 0px 0px 20px 5px rgba(255, 0, 0, 0.8);
-3
View File
@@ -18,9 +18,6 @@ html, body {
animation: pulse-warning 2.5s infinite;
}
.pulse-warning:hover {
color: rgba(255, 255, 255, 1) !important;
}
@-webkit-keyframes pulse-warning {
0% {
File diff suppressed because one or more lines are too long