Compare commits

...

12 Commits

Author SHA1 Message Date
Samuele Locatelli 417ea1a77d Merge branch 'release/FixRedisRegression' 2022-07-13 08:57:59 +02:00
Samuele Locatelli 335fdf78f0 Correzione regressione test valori redis 2022-07-13 08:57:33 +02:00
Samuele Locatelli d50e5a6860 Merge tag 'UpdatePack' into develop
Update nuget e eliminazione warnings
2022-07-13 08:29:21 +02:00
Samuele Locatelli 86d28f1901 Merge branch 'release/UpdatePack' 2022-07-13 08:28:57 +02:00
Samuele Locatelli 202c5f6faf Refresh pacchetti nuget + minor fix 2022-07-13 08:28:38 +02:00
Samuele Locatelli e2947d1017 Merge tag 'UpdateSlowTimerElapse' into develop
Aggiornamento slow time elapse (+/- 10%)
2022-07-13 07:57:33 +02:00
Samuele Locatelli 55faefcb9a Merge branch 'release/UpdateSlowTimerElapse' 2022-07-13 07:57:19 +02:00
Samuele Locatelli 1e5f894fd9 MON:
- attesa refresh variabile x client
- esclusione compilazione WASM (NON pronta)
2022-07-13 07:55:12 +02:00
Samuele Locatelli cf8baa054f Merge tag 'MonCleanup' into develop
Update con cleanup codice ed un paio di fix dispose
2022-07-12 19:06:59 +02:00
Samuele Locatelli 871a0c8ca5 Merge branch 'release/MonCleanup' 2022-07-12 19:05:53 +02:00
Samuele Locatelli 78cb17d8fc Cleanup MP/MON 2022-07-12 19:05:30 +02:00
Samuele Locatelli 22ff799204 Merge tag 'MonWithRedisChannels' into develop
Gestioen con redis channels (da ripulire...)
2022-07-12 18:45:32 +02:00
17 changed files with 225 additions and 322 deletions
+106 -105
View File
@@ -121,19 +121,19 @@ MON:build:
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
WAMON:build:
stage: build
tags:
- win
variables:
PROJ_PATH: MP.WASM.Mon\Server
APP_NAME: MP.WASM.Mon.Server
SOL_NAME: MP-WAMON
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
script:
- dotnet build $env:PROJ_PATH/$env:APP_NAME.csproj
# WAMON:build:
# stage: build
# tags:
# - win
# variables:
# PROJ_PATH: MP.WASM.Mon\Server
# APP_NAME: MP.WASM.Mon.Server
# SOL_NAME: MP-WAMON
# before_script:
# - *nuget-fix
# - dotnet restore "$env:SOL_NAME.sln"
# script:
# - dotnet build $env:PROJ_PATH/$env:APP_NAME.csproj
LAND:test:
stage: test
@@ -199,22 +199,22 @@ MON:test:
script:
- dotnet test $env:APP_NAME/$env:APP_NAME.csproj
WAMON:test:
stage: test
tags:
- win
variables:
PROJ_PATH: MP.WASM.Mon\Server
APP_NAME: MP.WASM.Mon.Server
SOL_NAME: MP-WAMON
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
only:
- develop
needs: ["WAMON:build"]
script:
- dotnet test $env:PROJ_PATH/$env:APP_NAME.csproj
# WAMON:test:
# stage: test
# tags:
# - win
# variables:
# PROJ_PATH: MP.WASM.Mon\Server
# APP_NAME: MP.WASM.Mon.Server
# SOL_NAME: MP-WAMON
# before_script:
# - *nuget-fix
# - dotnet restore "$env:SOL_NAME.sln"
# only:
# - develop
# needs: ["WAMON:build"]
# script:
# - dotnet test $env:PROJ_PATH/$env:APP_NAME.csproj
LAND:IIS01:deploy:
stage: deploy
@@ -280,22 +280,22 @@ MON:IIS01:deploy:
script:
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj
WAMON:IIS01:deploy:
stage: deploy
tags:
- win
variables:
PROJ_PATH: MP.WASM.Mon\Server
APP_NAME: MP.WASM.Mon.Server
SOL_NAME: MP-WAMON
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
only:
- develop
needs: ["WAMON:test"]
script:
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:PROJ_PATH/$env:APP_NAME.csproj
# WAMON:IIS01:deploy:
# stage: deploy
# tags:
# - win
# variables:
# PROJ_PATH: MP.WASM.Mon\Server
# APP_NAME: MP.WASM.Mon.Server
# SOL_NAME: MP-WAMON
# before_script:
# - *nuget-fix
# - dotnet restore "$env:SOL_NAME.sln"
# only:
# - develop
# needs: ["WAMON:test"]
# script:
# - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:PROJ_PATH/$env:APP_NAME.csproj
LAND:IIS02:deploy:
stage: deploy
@@ -365,23 +365,23 @@ MON:IIS02:deploy:
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj
WAMON:IIS02:deploy:
stage: deploy
tags:
- win
variables:
PROJ_PATH: MP.WASM.Mon\Server
APP_NAME: MP.WASM.Mon.Server
SOL_NAME: MP-WAMON
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
only:
- master
needs: ["WAMON:build"]
script:
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:PROJ_PATH/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:PROJ_PATH/$env:APP_NAME.csproj
# WAMON:IIS02:deploy:
# stage: deploy
# tags:
# - win
# variables:
# PROJ_PATH: MP.WASM.Mon\Server
# APP_NAME: MP.WASM.Mon.Server
# SOL_NAME: MP-WAMON
# before_script:
# - *nuget-fix
# - dotnet restore "$env:SOL_NAME.sln"
# only:
# - master
# needs: ["WAMON:build"]
# script:
# - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:PROJ_PATH/$env:APP_NAME.csproj
# - dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:PROJ_PATH/$env:APP_NAME.csproj
LAND:installer:
stage: installer
@@ -467,27 +467,27 @@ MON:installer:
- *hashBuild
- *nexusUpload
WAMON:installer:
stage: installer
tags:
- win
variables:
PROJ_PATH: MP.WASM.Mon\Server
APP_NAME: MP.WASM.Mon.Server
SOL_NAME: MP-WAMON
NEXUS_PATH: MP-WAMON
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
only:
- develop
- master
needs: ["WAMON:build"]
script:
- dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:PROJ_PATH/$env:APP_NAME.csproj -o:publish
# qui il deploy su nexus...
- *hashBuild
- *nexusUpload
# WAMON:installer:
# stage: installer
# tags:
# - win
# variables:
# PROJ_PATH: MP.WASM.Mon\Server
# APP_NAME: MP.WASM.Mon.Server
# SOL_NAME: MP-WAMON
# NEXUS_PATH: MP-WAMON
# before_script:
# - *nuget-fix
# - dotnet restore "$env:SOL_NAME.sln"
# only:
# - develop
# - master
# needs: ["WAMON:build"]
# script:
# - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:PROJ_PATH/$env:APP_NAME.csproj -o:publish
# # qui il deploy su nexus...
# - *hashBuild
# - *nexusUpload
LAND:release:
stage: release
@@ -583,25 +583,26 @@ MON:release:
script:
- dotnet publish -c Release -o ./publish $env:APP_NAME/$env:APP_NAME.csproj
WAMON:release:
stage: release
tags:
- win
variables:
PROJ_PATH: MP.WASM.Mon\Server
APP_NAME: MP.WASM.Mon.Server
SOL_NAME: MP-WAMON
NEXUS_PATH: MP-WAMON
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
only:
- tags
except:
- branches
needs: ["WAMON:build"]
artifacts:
paths:
- publish/
script:
- dotnet publish -c Release -o ./publish $env:PROJ_PATH/$env:APP_NAME.csproj
# WAMON:release:
# stage: release
# tags:
# - win
# variables:
# PROJ_PATH: MP.WASM.Mon\Server
# APP_NAME: MP.WASM.Mon.Server
# SOL_NAME: MP-WAMON
# NEXUS_PATH: MP-WAMON
# before_script:
# - *nuget-fix
# - dotnet restore "$env:SOL_NAME.sln"
# only:
# - tags
# except:
# - branches
# needs: ["WAMON:build"]
# artifacts:
# paths:
# - publish/
# script:
# - dotnet publish -c Release -o ./publish $env:PROJ_PATH/$env:APP_NAME.csproj
+6 -6
View File
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
@@ -12,14 +12,14 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.6">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.6" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.7" />
<PackageReference Include="NLog" Version="5.0.1" />
</ItemGroup>
</Project>
+1 -1
View File
@@ -1,6 +1,6 @@
<div class="px-2">
<img class="logoImg img-fluid" src="images/LogoMapo.png" height="24" />
<span class="mainHead p-3"><b><span style="color: #DEDEDE;">MP MON</span>itor</b></span>
<span class="mainHead p-3 align-middle"><b><span style="color: #DEDEDE;">MP MON</span>itor</b></span>
</div>
<div class="px-2">
<span id="text-white text-right">
+16 -39
View File
@@ -12,11 +12,6 @@ namespace MP.Mon.Components
[Parameter]
public MappaStatoExpl? CurrRecord { get; set; } = null;
/// <summary>
/// Valore precedente x calcolo variazione
/// </summary>
private MappaStatoExpl? OldRecord { get; set; } = null;
[Parameter]
public List<TagData>? currTagConf { get; set; } = null;
@@ -26,37 +21,22 @@ namespace MP.Mon.Components
[Parameter]
public bool doAnimate { get; set; } = true;
[Parameter]
public bool doBlink { get; set; } = false;
[Parameter]
public int keepAliveMin { get; set; } = 5;
[Parameter]
public string showArt { get; set; } = "";
[Parameter]
public bool doBlink { get; set; } = false;
//{
// set
// {
// // se true --> ricarica
// if (value)
// {
// var pUpd = Task.Run(async () =>
// {
// await InvokeAsync(() => StateHasChanged());
// });
// pUpd.Wait();
// }
// }
//}
#endregion Public Properties
#region Public Methods
public void Dispose()
{
//aTimer.Elapsed -= ElapsedTimer;
aTimer.Elapsed -= ElapsedTimer;
aTimer.Stop();
aTimer.Dispose();
}
@@ -88,10 +68,6 @@ namespace MP.Mon.Components
}
if (needUpdate)
{
if (false)
{
Log.Trace($"Elapsed Timer {CurrRecord?.CodMacchina}");
}
await InvokeAsync(() => StateHasChanged());
}
OldRecord = CurrRecord;
@@ -114,6 +90,7 @@ namespace MP.Mon.Components
#region Protected Fields
protected string baseCss = "sem";
protected int kaFactor = 60 / 2;
#endregion Protected Fields
@@ -209,11 +186,21 @@ namespace MP.Mon.Components
#region Private Fields
private static System.Timers.Timer aTimer { get; set; } = null!;
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
#region Private Properties
private static System.Timers.Timer aTimer { get; set; } = null!;
/// <summary>
/// Valore precedente x calcolo variazione
/// </summary>
private MappaStatoExpl? OldRecord { get; set; } = null;
#endregion Private Properties
#region Private Methods
private string cssComStatus(string semaforo, DateTime? lastUpdateN)
@@ -246,16 +233,6 @@ namespace MP.Mon.Components
string answ = $"{baseCss}{codColore}";
if (doAnimate && codColore != "Ve")
{
#if false
// blink se secondo pari...
DateTime adesso = DateTime.Now;
int resto = 0;
Math.DivRem(adesso.Second, 2, out resto);
if (resto == 0)
{
answ += "_b";
}
#endif
if (doBlink)
{
answ += "_b";
+7 -3
View File
@@ -1,6 +1,10 @@
<div class="row p-5 m-5 bg-light">
<div class="col-12 text-center mt-5 py-5 alert alert-primary">
<div class="row p-5 m-5 alert alert-primary">
<div class="col-6 text-center mt-4 py-3 bg-light">
<h1>MAPO MON</h1>
EgalWare MES suite <img class="logoImg img-fluid" src="images/logoCliente.png" />
</div>
<div class="col-6 text-center mt-4 py-3 bg-light">
<h3>loading data</h3>
<i class="fas fa-spinner fa-spin fa-5x"></i>
<i class="fas fa-spinner fa-spin fa-4x"></i>
</div>
</div>
+65 -68
View File
@@ -36,7 +36,6 @@ namespace MP.Mon.Data
dbController = new MP.Data.Controllers.MpMonController(configuration);
StringBuilder sb = new StringBuilder();
sb.AppendLine($"DbController OK");
//sb.AppendLine($"CST: {dbController.CustomersCount()} | CNT: {dbController.CountersCount()} | BSK: {dbController.BasketsCount()} | NGT: {dbController.NegotiationsCount()} | DOC: {dbController.DocsCount()} | ITM: {dbController.ItemsCount()} | RES: {dbController.ResourcesCount()}");
_logger.LogInformation(sb.ToString());
}
@@ -47,75 +46,21 @@ namespace MP.Mon.Data
startTimers();
}
private void startTimers()
{
fastTimer = new System.Timers.Timer(fastRefreshMs);
fastTimer.Elapsed += ElapsedFastTimer;
fastTimer.Enabled = true;
fastTimer.Start();
}
private void ElapsedFastTimer(object? source, System.Timers.ElapsedEventArgs e)
{
var pUpd = Task.Run(async () =>
{
// secondi pari --> blink, secondi dispari --> ricarica
DateTime adesso = DateTime.Now;
int resto = 0;
Math.DivRem(adesso.Second, 2, out resto);
if (resto == 0)
{
// invio in channel blink il segnale
blinkPipe.sendMessage("true");
Log.Trace("Elapsed Fast Timer Blink");
}
else
{
// invio in channel blink segnale false
blinkPipe.sendMessage("false");
// rileggo dati ed invio
await ReloadData();
Log.Trace("Elapsed Fast Timer reload");
}
});
pUpd.Wait();
}
private async Task ReloadData()
{
// legge i dati e li invia tramite redis channels
var newData = await MseGetAll();
// invio tramite la pipe...
dataPipe.sendMessage(JsonConvert.SerializeObject(newData));
}
/// <summary>
/// Limite in formato data-ora per inviare dati rapidamente (incrementato come now + 1 min ad ogni chiamata client)
/// </summary>
private DateTime fastLimit = DateTime.Now;
private int fastRefreshMs = 1000;
private static System.Timers.Timer fastTimer = new System.Timers.Timer(4000);
/// <summary>
/// Richiesta attivazione --> sposto avanti 1 minuto il periodo limite x fast running
/// </summary>
public void doActivate()
{
fastLimit = DateTime.Now.AddMinutes(1);
}
#endregion Public Constructors
#region Public Properties
public static MP.Data.Controllers.MpMonController dbController { get; set; } = null!;
public MessagePipe blinkPipe { get; set; } = null!;
/// <summary>
/// Dizionario dei tag configurati per IOB
/// </summary>
public Dictionary<string, List<TagData>> currTagConf { get; set; } = new Dictionary<string, List<TagData>>();
public MessagePipe dataPipe { get; set; } = null!;
#endregion Public Properties
#region Public Methods
@@ -131,6 +76,14 @@ namespace MP.Mon.Data
dbController.Dispose();
}
/// <summary>
/// Richiesta attivazione --&gt; sposto avanti 1 minuto il periodo limite x fast running
/// </summary>
public void doActivate()
{
fastLimit = DateTime.Now.AddMinutes(1);
}
/// <summary>
/// Elenco setup dei tag conf correnti
/// </summary>
@@ -166,15 +119,15 @@ namespace MP.Mon.Data
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
List<MappaStatoExpl> result = new List<MappaStatoExpl>();
List<MappaStatoExpl>? result = new List<MappaStatoExpl>();
// cerco in redis...
var rawData = await redisDb.StringGetAsync(redisMseKey);
if (!string.IsNullOrEmpty(rawData))
RedisValue rawData = await redisDb.StringGetAsync(redisMseKey);
if (!string.IsNullOrEmpty($"{rawData}"))
{
result = JsonConvert.DeserializeObject<List<MappaStatoExpl>>(rawData);
result = JsonConvert.DeserializeObject<List<MappaStatoExpl>>($"{rawData}");
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Read from REDIS: {ts.TotalMilliseconds}ms");
Log.Debug($"Read from REDIS: {ts.TotalMilliseconds}ms");
}
else
{
@@ -184,7 +137,7 @@ namespace MP.Mon.Data
await redisDb.StringSetAsync(redisMseKey, rawData, TimeSpan.FromSeconds(2));
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Read from DB: {ts.TotalMilliseconds}ms");
Log.Debug($"Read from DB: {ts.TotalMilliseconds}ms");
}
if (result == null)
{
@@ -195,16 +148,24 @@ namespace MP.Mon.Data
#endregion Public Methods
public MessagePipe dataPipe { get; set; } = null!;
public MessagePipe blinkPipe { get; set; } = null!;
#region Private Fields
private static IConfiguration _configuration = null!;
private static ILogger<MpDataService> _logger = null!;
private static System.Timers.Timer fastTimer = new System.Timers.Timer(4000);
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
/// <summary>
/// Limite in formato data-ora per inviare dati rapidamente (incrementato come now + 1 min
/// ad ogni chiamata client)
/// </summary>
private DateTime fastLimit = DateTime.Now;
private int fastRefreshMs = 1000;
/// <summary>
/// Oggetto per connessione a REDIS
/// </summary>
@@ -222,6 +183,42 @@ namespace MP.Mon.Data
#region Private Methods
private void ElapsedFastTimer(object? source, System.Timers.ElapsedEventArgs e)
{
var pUpd = Task.Run(async () =>
{
// secondi pari --> blink, secondi dispari --> ricarica
DateTime adesso = DateTime.Now;
int resto = 0;
Math.DivRem(adesso.Second, 2, out resto);
if (resto == 0)
{
// invio in channel blink il segnale
blinkPipe.sendMessage("true");
Log.Debug("Elapsed Fast Timer Blink");
}
else
{
// invio in channel blink segnale false
blinkPipe.sendMessage("false");
// rileggo dati...
var newData = await MseGetAll();
// invio tramite la pipe...
dataPipe.sendMessage(JsonConvert.SerializeObject(newData));
Log.Debug("Elapsed Fast Timer reload");
}
});
pUpd.Wait();
}
private void startTimers()
{
fastTimer = new System.Timers.Timer(fastRefreshMs);
fastTimer.Elapsed += ElapsedFastTimer;
fastTimer.Enabled = true;
fastTimer.Start();
}
/// <summary>
/// Prova a caricare da file la conf degli IOB se presente
/// </summary>
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>6.15.2207.1218</Version>
<Version>6.15.2207.1308</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -39,7 +39,7 @@
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
<logger name="*" minlevel="Debug" writeTo="f" />
-->
<logger name="*" minlevel="Trace" writeTo="consoleTarget" />
<logger name="*" minlevel="Debug" writeTo="consoleTarget" />
<!--<logger name="Microsoft.*" maxlevel="Info" final="true" />-->
<logger name="*" minlevel="Info" writeTo="fileTarget" />
</rules>
-1
View File
@@ -5,7 +5,6 @@
<PageTitle>MP MON</PageTitle>
<div class="row statusMap mx-1 my-1">
@if (listMSE == null)
{
<div class="col-12">
+15 -74
View File
@@ -14,62 +14,23 @@ namespace MP.Mon.Pages
public void Dispose()
{
#if false
fastTimer.Stop();
fastTimer.Dispose();
#endif
slowTimer.Stop();
slowTimer.Dispose();
disposeTimers();
}
#if false
public void ElapsedFastTimer(object? source, System.Timers.ElapsedEventArgs e)
{
var pUpd = Task.Run(async () =>
{
// secondi pari --> blink, secondi dispari --> ricarica
DateTime adesso = DateTime.Now;
int resto = 0;
Math.DivRem(adesso.Second, 2, out resto);
if (resto == 0)
{
doBlink = true;
Log.Trace("Elapsed Fast Timer Blink");
await Task.Delay(1);
await InvokeAsync(StateHasChanged);
}
else
{
doBlink = false;
await ReloadData();
Log.Trace("Elapsed Fast Timer reload");
}
});
pUpd.Wait();
}
#endif
public async void ElapsedSlowTimer(object? source, System.Timers.ElapsedEventArgs e)
{
listMSE = null;
await Task.Delay(1);
await Task.Delay(10);
Log.Info("Elapsed Slow Timer --> full page reload");
// dispongo i vari timers...
disposeTimers();
await Task.Delay(10);
// reload pagina
NavManager.NavigateTo(NavManager.Uri);
}
public void StartTimer()
{
#if false
// timer veloce
fastTimer = new System.Timers.Timer(fastRefreshMs);
fastTimer.Elapsed += ElapsedFastTimer;
fastTimer.Enabled = true;
fastTimer.Start();
#endif
// timer lento
slowTimer = new System.Timers.Timer(slowRefreshMs);
slowTimer.Elapsed += ElapsedSlowTimer;
@@ -100,7 +61,12 @@ namespace MP.Mon.Pages
protected int slowRefreshMs
{
get => 1000 * slowRefreshSec;
get
{
// tempo variabile tra +/- 10% del target
int answ = rnd.Next(900, 1100) * slowRefreshSec;
return answ;
}
}
#endregion Protected Properties
@@ -191,12 +157,14 @@ namespace MP.Mon.Pages
protected override async Task OnInitializedAsync()
{
await setupConf();
//await ReloadData();
MMDataService.dataPipe.EA_NewMessage += DataPipe_EA_NewMessage;
MMDataService.blinkPipe.EA_NewMessage += BlinkPipe_EA_NewMessage;
Random rnd = new Random();
await Task.Delay(rnd.Next(1000, 1200));
StartTimer();
}
#endregion Protected Methods
#region Private Fields
@@ -205,12 +173,10 @@ namespace MP.Mon.Pages
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
private static System.Timers.Timer slowTimer = new System.Timers.Timer(300000);
private List<ConfigModel>? CurrConfig = null;
private bool doBlink = false;
private List<MappaStatoExpl>? listMSE = null;
private Random rnd = new Random();
#endregion Private Fields
@@ -247,7 +213,6 @@ namespace MP.Mon.Pages
/// <exception cref="NotImplementedException"></exception>
private void DataPipe_EA_NewMessage(object? sender, EventArgs e)
{
//fastTimer.Stop();
PubSubEventArgs currArgs = (PubSubEventArgs)e;
// conversione on-the-fly List<string> --> allarmi
if (!string.IsNullOrEmpty(currArgs.newMessage))
@@ -275,46 +240,22 @@ namespace MP.Mon.Pages
}
InvokeAsync(() =>
{
#if false
// attesa random 0-50ms...
Random rnd = new Random();
Task.Delay(rnd.Next(5, 50));
Task.Delay(rnd.Next(5, 50));
#endif
StateHasChanged();
});
//fastTimer.Start();
}
private void disposeTimers()
{
//fastTimer.Elapsed -= ElapsedFastTimer;
//fastTimer.Stop();
//fastTimer.Dispose();
slowTimer.Elapsed -= ElapsedSlowTimer;
slowTimer.Stop();
slowTimer.Dispose();
}
#if false
private async Task ReloadData()
{
// legge i dati e li invia tramite redis channels
var newData = await MMDataService.MseGetAll();
// invio tramite la pipe...
MMDataService.dataPipe.sendMessage(JsonConvert.SerializeObject(newData));
//#if DEBUG
// // hack: legge 4 volte i dati x stressare sistema
// var singleData = await MMDataService.MseGetAll();
// listMSE = new List<MappaStatoExpl>();
// for (int i = 0; i < 4; i++)
// {
// listMSE.AddRange(singleData);
// }
//#else
// listMSE = await MMDataService.MseGetAll();
//#endif
}
#endif
private async Task setupConf()
{
CurrConfig = await MMDataService.ConfigGetAll();
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MON MAPO</i>
<h4>Versione: 6.15.2207.1218</h4>
<h4>Versione: 6.15.2207.1308</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.15.2207.1218
6.15.2207.1308
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.15.2207.1218</version>
<version>6.15.2207.1308</version>
<url>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/MP.Mon.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+2 -2
View File
@@ -13,14 +13,14 @@ main {
/*border-bottom: 1px solid #696969;*/
color: #696969;
font-size: 1.4em;
height: 3rem;
height: 2.6rem;
display: flex;
align-items: center;
justify-content: space-evenly;
}
.mainHead{
font-size: 1.7rem;
font-size: 1.6rem;
}
.top-row ::deep a,
+1 -1
View File
@@ -308,7 +308,7 @@ a,
/* Gestione size caratteri */
.mainHead,
.logoImg {
height: 1.6em;
height: 1.5em;
}
@media all and (min-width: 425px) {
.mainHead {
@@ -246,16 +246,6 @@ namespace MP.WASM.Mon.Client.Components
string answ = $"{baseCss}{codColore}";
if (doAnimate && codColore != "Ve")
{
#if false
// blink se secondo pari...
DateTime adesso = DateTime.Now;
int resto = 0;
Math.DivRem(adesso.Second, 2, out resto);
if (resto == 0)
{
answ += "_b";
}
#endif
if (doBlink)
{
answ += "_b";
+1 -7
View File
@@ -11,12 +11,6 @@ namespace MP.WASM.Mon.Client.Pages
public void Dispose()
{
#if false
fastTimer.Stop();
fastTimer.Dispose();
slowTimer.Stop();
slowTimer.Dispose();
#endif
disposeTimers();
}
@@ -222,7 +216,7 @@ namespace MP.WASM.Mon.Client.Pages
{
// leggo stato server...
fastTimer.Interval = fastRefreshMs * 3;
var res = await Http.GetAsync("/api/MSE/checkAlive");
var res = await Http.GetAsync("api/MSE/checkAlive");
Console.WriteLine("GetAsync end");
if (res.IsSuccessStatusCode)
{