Setup allarmi:
- abbozzata selezione modulo setup da alarmMode
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Platforms>AnyCPU;x86;x64</Platforms>
|
||||
<Version>1.12206.1919</Version>
|
||||
<Version>1.12206.1920</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>MAPO-MONO</i>
|
||||
<h4>Version: 1.12206.1919</h4>
|
||||
<h4>Version: 1.12206.1920</h4>
|
||||
<br /> Release Note:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.12206.1919
|
||||
1.12206.1920
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>1.12206.1919</version>
|
||||
<version>1.12206.1920</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>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Platforms>AnyCPU;x86;x64</Platforms>
|
||||
<Version>1.12206.1919</Version>
|
||||
<Version>1.12206.1920</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>MAPO-MONO</i>
|
||||
<h4>Version: 1.12206.1919</h4>
|
||||
<h4>Version: 1.12206.1920</h4>
|
||||
<br /> Release Note:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.12206.1919
|
||||
1.12206.1920
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>1.12206.1919</version>
|
||||
<version>1.12206.1920</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>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Platforms>AnyCPU;x86;x64</Platforms>
|
||||
<Version>1.12206.1919</Version>
|
||||
<Version>1.12206.1920</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>MAPO-MONO</i>
|
||||
<h4>Version: 1.12206.1919</h4>
|
||||
<h4>Version: 1.12206.1920</h4>
|
||||
<br /> Release Note:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.12206.1919
|
||||
1.12206.1920
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>1.12206.1919</version>
|
||||
<version>1.12206.1920</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>
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
},
|
||||
"SimPar": {
|
||||
"AlarmMode": "RawList",
|
||||
"PercAllarmi": 20,
|
||||
"PercAllarmi": 10,
|
||||
"MaxAddAllarmi": 3,
|
||||
"MaxDurationAllarmi": 15
|
||||
"MaxDurationAllarmi": 10
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,79 +3,14 @@
|
||||
@using MP.MONO.Core.DTO
|
||||
@using MP.MONO.UI.Data
|
||||
|
||||
@inject IJSRuntime JSRuntime
|
||||
@inject CurrentDataService MMDataService
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header bg-secondary text-light">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="p-2">
|
||||
<h5>Alarm Messages Setup</h5>
|
||||
</div>
|
||||
<div class="p-2">
|
||||
<button class="btn btn-sm btn-primary" @onclick="() => resetAlarmSetup()" title="Reset Alarm Config"><i class="fa-solid fa-gear"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (ListRecords.Count == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center h3">No record found</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<b>Alarm Bank</b>
|
||||
<ul class="list-group">
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<li class="list-group-item list-group-item-action @cssActive(item.memAddr)" @onclick="() => raiseSelect(item)">
|
||||
@item.description
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
</div>
|
||||
<div class="col-9">
|
||||
@if (AlarmMap == null)
|
||||
{
|
||||
<div class="alert alert-warning text-center h3">Select Bank First</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12 mb-2">
|
||||
<ul class="list-group">
|
||||
@foreach (var item in AlarmMap.messagesMap)
|
||||
{
|
||||
<li class="list-group-item list-group-item-action @cssSilenced(item.Key)" @onclick="() => toggleMute(item.Key)">
|
||||
<div>@item.Value</div>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<i>click to mute/unmute alarms</i>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="btn-group btn-group-sm">
|
||||
<button type="button" class="btn btn-primary">Alarm Enabled</button>
|
||||
<button type="button" class="btn btn-secondary">Alarm Disabled</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
@if (AlarmMode == Core.Enums.AlarmReportingMode.BankBit)
|
||||
{
|
||||
<AlarmsSetupBankBit></AlarmsSetupBankBit>
|
||||
}
|
||||
else
|
||||
{
|
||||
<AlarmsSetupRawList></AlarmsSetupRawList>
|
||||
}
|
||||
|
||||
@@ -1,98 +1,30 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.MONO.Core;
|
||||
using MP.MONO.Core.CONF;
|
||||
using static MP.MONO.Core.Enums;
|
||||
|
||||
namespace MP.MONO.UI.Components
|
||||
{
|
||||
public partial class AlarmsSetup
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
|
||||
protected List<BaseAlarmBankConf>? ListRecords = null;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected BaseAlarmBankConf? AlarmMap { get; set; } = null;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string cssActive(string memAddr)
|
||||
{
|
||||
string answ = "";
|
||||
if (AlarmMap != null)
|
||||
{
|
||||
answ = AlarmMap.memAddr.Equals(memAddr) ? "bg-dark text-light" : "";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
protected string cssSilenced(int messIndex)
|
||||
{
|
||||
string answ = "";
|
||||
if (AlarmMap != null)
|
||||
{
|
||||
answ = AlarmMap.isSilenced(messIndex) ? "bg-secondary text-light" : "bg-primary text-light";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task raiseSelect(BaseAlarmBankConf selBank)
|
||||
{
|
||||
AlarmMap = selBank;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
protected AlarmReportingMode AlarmMode { get; set; } = AlarmReportingMode.RawList;
|
||||
|
||||
protected async Task ReloadData()
|
||||
{
|
||||
ListRecords = null;
|
||||
await Task.Delay(1);
|
||||
ListRecords = await MMDataService.getAlarmSetup();
|
||||
AlarmMode = await MMDataService.getAlarmMode();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected async Task resetAlarmSetup()
|
||||
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Reset Alarm Config: you are going to reset actual alarm configuration. Are you sure to proceed?"))
|
||||
return;
|
||||
await Task.Delay(1);
|
||||
var baseConf = await MMDataService.getAlarmConfig();
|
||||
await MMDataService.setAlarmSetup(baseConf);
|
||||
AlarmMap = null;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task toggleMute(int alarmIndex)
|
||||
{
|
||||
// base 1 --> base 0
|
||||
alarmIndex--;
|
||||
int bank = alarmIndex / 16;
|
||||
// calcolo inverso del valore richiesto
|
||||
if (ListRecords != null && AlarmMap != null)
|
||||
{
|
||||
AlarmMap.silenceMask[bank] = AlarmMap.silenceMask[bank] ^ (uint)(1 << alarmIndex);
|
||||
// sostituisco...
|
||||
var currObj = ListRecords.FirstOrDefault(x => x.memAddr == AlarmMap.memAddr);
|
||||
if (currObj != null)
|
||||
{
|
||||
currObj.silenceMask = AlarmMap.silenceMask;
|
||||
// salvo su redis...
|
||||
await MMDataService.setAlarmSetup(ListRecords);
|
||||
}
|
||||
}
|
||||
await Task.Delay(1);
|
||||
await ReloadData();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
@using MP.MONO.Data
|
||||
@using MP.MONO.UI.Components
|
||||
@using MP.MONO.Core.DTO
|
||||
@using MP.MONO.UI.Data
|
||||
|
||||
@inject IJSRuntime JSRuntime
|
||||
@inject CurrentDataService MMDataService
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header bg-secondary text-light">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="p-2">
|
||||
<h5>Alarm Messages Setup </h5>
|
||||
(BB)
|
||||
</div>
|
||||
<div class="p-2">
|
||||
<button class="btn btn-sm btn-primary" @onclick="() => resetAlarmSetup()" title="Reset Alarm Config"><i class="fa-solid fa-gear"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (ListRecords.Count == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center h3">No record found</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<b>Alarm Bank</b>
|
||||
<ul class="list-group">
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<li class="list-group-item list-group-item-action @cssActive(item.memAddr)" @onclick="() => raiseSelect(item)">
|
||||
@item.description
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
</div>
|
||||
<div class="col-9">
|
||||
@if (AlarmMap == null)
|
||||
{
|
||||
<div class="alert alert-warning text-center h3">Select Bank First</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12 mb-2">
|
||||
<ul class="list-group">
|
||||
@foreach (var item in AlarmMap.messagesMap)
|
||||
{
|
||||
<li class="list-group-item list-group-item-action @cssSilenced(item.Key)" @onclick="() => toggleMute(item.Key)">
|
||||
<div>@item.Value</div>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<i>click to mute/unmute alarms</i>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="btn-group btn-group-sm">
|
||||
<button type="button" class="btn btn-primary">Alarm Enabled</button>
|
||||
<button type="button" class="btn btn-secondary">Alarm Disabled</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.MONO.Core.CONF;
|
||||
|
||||
namespace MP.MONO.UI.Components
|
||||
{
|
||||
public partial class AlarmsSetupBankBit
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
|
||||
protected List<BaseAlarmBankConf>? ListRecords = null;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected BaseAlarmBankConf? AlarmMap { get; set; } = null;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string cssActive(string memAddr)
|
||||
{
|
||||
string answ = "";
|
||||
if (AlarmMap != null)
|
||||
{
|
||||
answ = AlarmMap.memAddr.Equals(memAddr) ? "bg-dark text-light" : "";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
protected string cssSilenced(int messIndex)
|
||||
{
|
||||
string answ = "";
|
||||
if (AlarmMap != null)
|
||||
{
|
||||
answ = AlarmMap.isSilenced(messIndex) ? "bg-secondary text-light" : "bg-primary text-light";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task raiseSelect(BaseAlarmBankConf selBank)
|
||||
{
|
||||
AlarmMap = selBank;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected async Task ReloadData()
|
||||
{
|
||||
ListRecords = null;
|
||||
await Task.Delay(1);
|
||||
ListRecords = await MMDataService.getAlarmSetup();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected async Task resetAlarmSetup()
|
||||
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Reset Alarm Config: you are going to reset actual alarm configuration. Are you sure to proceed?"))
|
||||
return;
|
||||
await Task.Delay(1);
|
||||
var baseConf = await MMDataService.getAlarmConfig();
|
||||
await MMDataService.setAlarmSetup(baseConf);
|
||||
AlarmMap = null;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task toggleMute(int alarmIndex)
|
||||
{
|
||||
// base 1 --> base 0
|
||||
alarmIndex--;
|
||||
int bank = alarmIndex / 16;
|
||||
// calcolo inverso del valore richiesto
|
||||
if (ListRecords != null && AlarmMap != null)
|
||||
{
|
||||
AlarmMap.silenceMask[bank] = AlarmMap.silenceMask[bank] ^ (uint)(1 << alarmIndex);
|
||||
// sostituisco...
|
||||
var currObj = ListRecords.FirstOrDefault(x => x.memAddr == AlarmMap.memAddr);
|
||||
if (currObj != null)
|
||||
{
|
||||
currObj.silenceMask = AlarmMap.silenceMask;
|
||||
// salvo su redis...
|
||||
await MMDataService.setAlarmSetup(ListRecords);
|
||||
}
|
||||
}
|
||||
await Task.Delay(1);
|
||||
await ReloadData();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
<h3>AlarmsSetupRawList</h3>
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
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;
|
||||
|
||||
namespace MP.MONO.UI.Components
|
||||
{
|
||||
public partial class AlarmsSetupRawList
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using StackExchange.Redis;
|
||||
using System.Diagnostics;
|
||||
using static MP.MONO.Core.Enums;
|
||||
|
||||
namespace MP.MONO.UI.Data
|
||||
{
|
||||
@@ -173,17 +174,33 @@ namespace MP.MONO.UI.Data
|
||||
|
||||
public async Task<List<DisplayDataDTO>> getActLog()
|
||||
{
|
||||
List<DisplayDataDTO>? dbResult = new List<DisplayDataDTO>();
|
||||
List<DisplayDataDTO>? answ = new List<DisplayDataDTO>();
|
||||
string rawData = await redisDb.StringGetAsync(Constants.ACT_LOG_CURR_KEY);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
dbResult = JsonConvert.DeserializeObject<List<DisplayDataDTO>>(rawData);
|
||||
answ = JsonConvert.DeserializeObject<List<DisplayDataDTO>>(rawData);
|
||||
}
|
||||
if (dbResult == null)
|
||||
if (answ == null)
|
||||
{
|
||||
dbResult = new List<DisplayDataDTO>();
|
||||
answ = new List<DisplayDataDTO>();
|
||||
}
|
||||
return await Task.FromResult(dbResult);
|
||||
return await Task.FromResult(answ);
|
||||
}
|
||||
|
||||
|
||||
public async Task<AlarmReportingMode> getAlarmMode()
|
||||
{
|
||||
AlarmReportingMode answ = AlarmReportingMode.ND;
|
||||
string rawData = await redisDb.StringGetAsync(Constants.ALARMS_MODE_KEY);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
answ = JsonConvert.DeserializeObject<AlarmReportingMode>(rawData);
|
||||
}
|
||||
if (answ == AlarmReportingMode.ND)
|
||||
{
|
||||
answ = AlarmReportingMode.RawList;
|
||||
}
|
||||
return await Task.FromResult(answ);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Platforms>AnyCPU;x86;x64</Platforms>
|
||||
<Version>1.12206.1919</Version>
|
||||
<Version>1.12206.1920</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>MAPO-MONO</i>
|
||||
<h4>Version: 1.12206.1919</h4>
|
||||
<h4>Version: 1.12206.1920</h4>
|
||||
<br /> Release Note:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.12206.1919
|
||||
1.12206.1920
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>1.12206.1919</version>
|
||||
<version>1.12206.1920</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>
|
||||
|
||||
Reference in New Issue
Block a user