Fix layout x GPW SMART

This commit is contained in:
Samuele Locatelli
2024-03-05 08:30:25 +01:00
parent b40764c2bc
commit f4d2265de2
6 changed files with 19 additions and 157 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<Version>3.0.2403.0119</Version>
<Version>3.0.2403.0508</Version>
<ImplicitUsings>enable</ImplicitUsings>
<PackageProjectUrl>www.egalware.com</PackageProjectUrl>
<Description>GPW Smart UI</Description>
+15 -4
View File
@@ -39,10 +39,21 @@
<script type="text/javascript" src="lib/css/bootstrap/js/bootstrap.min.js"></script>
<script src="_framework/blazor.server.js" autostart="false"></script>
@* Modifica da https://github.com/dotnet/aspnetcore/issues/32113 *@
<script src="lib/boot.js"></script>
<script>
Blazor.start({
reconnectionOptions: {
maxRetries: 600,
retryIntervalMilliseconds: 1000
},
}).then(() => {
Blazor.defaultReconnectionHandler._reconnectCallback = function (d) {
console.log("Client reconnected, waiting 5 sec and reload!");
setTimeout(function () {
document.location.reload();
}, 3000);
}
});
</script>
@*Gestione autoriconnessione: https://github.com/dotnet/aspnetcore/issues/38305 (vedere anche https://docs.microsoft.com/it-it/aspnet/core/blazor/fundamentals/signalr?view=aspnetcore-6.0#modify-the-reconnection-handler-blazor-server)*@
@* <script>
-149
View File
@@ -1,149 +0,0 @@
(() => {
class DefaultReconnectionHandler {
_currentReconnectionProcess = null
constructor(overrideDisplay) {
this._reconnectionDisplay = overrideDisplay
this._reconnectCallback = Blazor.reconnect;
}
onConnectionDown(options, _error) {
if (!this._reconnectionDisplay) {
const modal = document.getElementById(options.dialogId)
this._reconnectionDisplay = new UserSpecifiedDisplay(modal, options.maxRetries, document);
}
if (!this._currentReconnectionProcess) {
this._currentReconnectionProcess = new ReconnectionProcess(
options,
this._reconnectCallback,
this._reconnectionDisplay
)
}
}
onConnectionUp() {
if (this._currentReconnectionProcess) {
this._currentReconnectionProcess.dispose()
this._currentReconnectionProcess = null
}
}
}
class ReconnectionProcess {
isDisposed = false
constructor(options, reconnectCallback, display) {
this.reconnectCallback = reconnectCallback
this.reconnectDisplay = display
this.reconnectDisplay.show()
this.attemptPeriodicReconnection(options)
}
dispose() {
this.isDisposed = true
this.reconnectDisplay.hide()
}
async attemptPeriodicReconnection(options) {
for (let i = 0; i < options.maxRetries; i++) {
this.reconnectDisplay.update(i + 1)
if (this.isDisposed) {
break
}
try {
const result = await Blazor.reconnect()
if (!result) {
// If the server responded and refused to reconnect, reload the page
location.reload();
return;
}
return;
} catch (err) {
}
await this.delay(options.retryIntervalMilliseconds)
}
location.reload()
}
delay(durationMilliseconds) {
return new Promise(resolve => setTimeout(resolve, durationMilliseconds))
}
}
class UserSpecifiedDisplay {
static ShowClassName = "components-reconnect-show"
static HideClassName = "components-reconnect-hide"
static FailedClassName = "components-reconnect-failed"
static RejectedClassName = "components-reconnect-rejected"
static MaxRetriesId = "components-reconnect-max-retries"
static CurrentAttemptId = "components-reconnect-current-attempt"
constructor(dialog, maxRetries, document) {
this.dialog = dialog
this.maxRetries = maxRetries
this.document = document
this.document = document
const maxRetriesElement = this.document.getElementById(
UserSpecifiedDisplay.MaxRetriesId
)
if (maxRetriesElement) {
maxRetriesElement.innerText = this.maxRetries.toString()
}
}
show() {
this.removeClasses()
this.dialog.classList.add(UserSpecifiedDisplay.ShowClassName)
}
update(currentAttempt) {
const currentAttemptElement = this.document.getElementById(
UserSpecifiedDisplay.CurrentAttemptId
)
if (currentAttemptElement) {
currentAttemptElement.innerText = currentAttempt.toString()
}
}
hide() {
this.removeClasses()
this.dialog.classList.add(UserSpecifiedDisplay.HideClassName)
}
failed() {
this.removeClasses()
this.dialog.classList.add(UserSpecifiedDisplay.FailedClassName)
}
rejected() {
this.removeClasses()
this.dialog.classList.add(UserSpecifiedDisplay.RejectedClassName)
}
removeClasses() {
this.dialog.classList.remove(
UserSpecifiedDisplay.ShowClassName,
UserSpecifiedDisplay.HideClassName,
UserSpecifiedDisplay.FailedClassName,
UserSpecifiedDisplay.RejectedClassName
)
}
}
Blazor.start({
reconnectionHandler: new DefaultReconnectionHandler(),
reconnectionOptions: {
maxRetries: 6,
retryIntervalMilliseconds: 3000
}
});
})();
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>GPW - Gestione Presenze Web</i>
<h4>Versione: 3.0.2403.0119</h4>
<h4>Versione: 3.0.2403.0508</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
3.0.2403.0119
3.0.2403.0508
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>3.0.2403.0119</version>
<version>3.0.2403.0508</version>
<url>http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.Smart.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html</changelog>
<mandatory>false</mandatory>