MON:
- correzioni x gestione reconnect + stabile - fix vari x condizioni errori visti in Jetco 8da aggiornare anche script PI)
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
(() => {
|
||||
const maximumRetryCount = 3;
|
||||
const retryIntervalMilliseconds = 5000;
|
||||
const reconnectModal = document.getElementById('reconnect-modal');
|
||||
|
||||
const startReconnectionProcess = () => {
|
||||
reconnectModal.style.display = 'block';
|
||||
|
||||
let isCanceled = false;
|
||||
|
||||
(async () => {
|
||||
for (let i = 0; i < maximumRetryCount; i++) {
|
||||
reconnectModal.innerText = `Attempting to reconnect: ${i + 1} of ${maximumRetryCount}`;
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, retryIntervalMilliseconds));
|
||||
|
||||
if (isCanceled) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const result = await Blazor.reconnect();
|
||||
if (!result) {
|
||||
// The server was reached, but the connection was rejected; reload the page.
|
||||
location.reload();
|
||||
return;
|
||||
}
|
||||
|
||||
// Successfully reconnected to the server.
|
||||
return;
|
||||
} catch {
|
||||
// Didn't reach the server; try again.
|
||||
}
|
||||
}
|
||||
|
||||
// Retried too many times; reload the page.
|
||||
location.reload();
|
||||
})();
|
||||
|
||||
return {
|
||||
cancel: () => {
|
||||
isCanceled = true;
|
||||
reconnectModal.style.display = 'none';
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
let currentReconnectionProcess = null;
|
||||
|
||||
Blazor.start({
|
||||
reconnectionHandler: {
|
||||
onConnectionDown: () => currentReconnectionProcess ??= startReconnectionProcess(),
|
||||
onConnectionUp: () => {
|
||||
currentReconnectionProcess?.cancel();
|
||||
currentReconnectionProcess = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
})();
|
||||
@@ -20,6 +20,74 @@
|
||||
@* <script src="_framework/blazor.web.js"></script> *@
|
||||
<script src="_framework/blazor.web.js" autostart="false"></script>
|
||||
<script>
|
||||
(() => {
|
||||
const maximumRetryCount = 3;
|
||||
const retryIntervalMilliseconds = 5000;
|
||||
const reconnectModal = document.getElementById('reconnect-modal');
|
||||
|
||||
const startReconnectionProcess = () => {
|
||||
reconnectModal.style.display = 'block';
|
||||
|
||||
let isCanceled = false;
|
||||
|
||||
(async () => {
|
||||
for (let i = 0; i < maximumRetryCount; i++) {
|
||||
reconnectModal.innerText = `Attempting to reconnect: ${i + 1} of ${maximumRetryCount}`;
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, retryIntervalMilliseconds));
|
||||
|
||||
if (isCanceled) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const result = await Blazor.reconnect();
|
||||
if (!result) {
|
||||
// The server was reached, but the connection was rejected; reload the page.
|
||||
location.reload();
|
||||
return;
|
||||
}
|
||||
|
||||
// Successfully reconnected to the server.
|
||||
return;
|
||||
} catch {
|
||||
// Didn't reach the server; try again.
|
||||
}
|
||||
}
|
||||
|
||||
// Retried too many times; reload the page.
|
||||
location.reload();
|
||||
})();
|
||||
|
||||
return {
|
||||
cancel: () => {
|
||||
isCanceled = true;
|
||||
reconnectModal.style.display = 'none';
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
let currentReconnectionProcess = null;
|
||||
|
||||
Blazor.start({
|
||||
reconnectionHandler: {
|
||||
onConnectionDown: () => currentReconnectionProcess ??= startReconnectionProcess(),
|
||||
onConnectionUp: () => {
|
||||
currentReconnectionProcess?.cancel();
|
||||
currentReconnectionProcess = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
@* <script>
|
||||
Blazor.start({
|
||||
configureSignalR: function (builder) {
|
||||
builder.withServerTimeout(30000).withKeepAliveInterval(15000);
|
||||
}
|
||||
});
|
||||
</script> *@
|
||||
@* <script>
|
||||
Blazor.start({
|
||||
reconnectionOptions: {
|
||||
maxRetries: 3600,
|
||||
@@ -33,7 +101,7 @@
|
||||
}, 3000);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</script> *@
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<a href="" class="reload">Reload</a>
|
||||
<a class="dismiss">🗙</a>
|
||||
</div>
|
||||
@code{
|
||||
@code {
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavMan { get; set; } = null!;
|
||||
@@ -32,17 +32,17 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
var currAssembly = typeof(Program).Assembly.GetName();
|
||||
version = currAssembly.Version != null ? currAssembly.Version : new Version();
|
||||
// controllo URL x riscrivere se non fosse /MP/MON finale...
|
||||
string baseUrl = config.GetValue<string>("ServerConf:BaseAppPath") ?? "/MP/MON/";
|
||||
string wrongEnd = baseUrl.Substring(0, baseUrl.Length - 1);
|
||||
string currUrl = NavMan.Uri;
|
||||
if(currUrl.EndsWith(wrongEnd))
|
||||
if (currUrl.EndsWith(wrongEnd))
|
||||
{
|
||||
NavMan.NavigateTo(baseUrl, true);
|
||||
}
|
||||
// base.OnInitialized();
|
||||
var currAssembly = typeof(Program).Assembly.GetName();
|
||||
version = currAssembly.Version != null ? currAssembly.Version : new Version();
|
||||
base.OnInitialized();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -10,6 +10,7 @@ using System;
|
||||
using static Org.BouncyCastle.Math.EC.ECCurve;
|
||||
using MP.Core.DTO;
|
||||
using MP.Data.Translate;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
|
||||
namespace MP.MON.Components.Pages
|
||||
{
|
||||
@@ -24,14 +25,12 @@ namespace MP.MON.Components.Pages
|
||||
disposeTimers();
|
||||
}
|
||||
|
||||
public async void ElapsedSlowTimer(object? source, System.Timers.ElapsedEventArgs e)
|
||||
public void ElapsedSlowTimer(object? source, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
ListMSE = null;
|
||||
await Task.Delay(10);
|
||||
Log.Info("Elapsed Slow Timer --> full page reload");
|
||||
// dispongo i vari timers...
|
||||
disposeTimers();
|
||||
await Task.Delay(10);
|
||||
// reload pagina intera
|
||||
NavManager.NavigateTo(NavManager.Uri, true);
|
||||
}
|
||||
@@ -233,9 +232,15 @@ namespace MP.MON.Components.Pages
|
||||
MMDataService.blinkPipe.EA_NewMessage += BlinkPipe_EA_NewMessage;
|
||||
Random rnd = new Random();
|
||||
cssOverlayOff = config.GetValue<string>("ServerConf:cssOverlayOff") ?? "";
|
||||
//maxChar4Scroll = config.GetValue<int>("ServerConf:maxChar4Scroll");
|
||||
await Task.Delay(rnd.Next(50, 150));
|
||||
StartTimer();
|
||||
}
|
||||
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
StartTimer();
|
||||
}
|
||||
//base.OnAfterRender(firstRender);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
@@ -392,7 +397,11 @@ namespace MP.MON.Components.Pages
|
||||
scrollText = rawData.ToLower() == "true";
|
||||
getConfVal("MON_showTC", ref rawData);
|
||||
showTC = rawData.ToLower() == "true";
|
||||
#if DEBUG
|
||||
slowRefreshSec = 20;
|
||||
#else
|
||||
getConfValInt("pageRefreshSec", ref slowRefreshSec);
|
||||
#endif
|
||||
getConfVal("sART", ref showArt);
|
||||
// con luminosità, dimensione carattere e num char x andare a capo x gestione specifica in caso di "allargamento componenti"
|
||||
getConfValInt("MON_maxChar4Scroll", ref maxChar4Scroll);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP.MON</RootNamespace>
|
||||
<AssemblyName>$(AssemblyName.Replace(' ', '_'))</AssemblyName>
|
||||
<Version>6.16.2503.1911</Version>
|
||||
<Version>6.16.2503.2018</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2503.1911</h4>
|
||||
<h4>Versione: 6.16.2503.2018</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2503.1911
|
||||
6.16.2503.2018
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2503.1911</version>
|
||||
<version>6.16.2503.2018</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>
|
||||
|
||||
Reference in New Issue
Block a user