Merge branch 'release/FixReloadPageAndTestChart'

This commit is contained in:
Samuele Locatelli
2024-02-24 11:56:05 +01:00
11 changed files with 172 additions and 152 deletions
+5 -1
View File
@@ -1,5 +1,5 @@
variables:
VERS_MAIN: '1.4'
VERS_MAIN: '1.5'
NEW_REL: ''
NUM_REL: '0.1.2.3'
NUM_DEB: '0.1.2-beta.3'
@@ -104,6 +104,7 @@ EgwCoreLib.Utils:build:
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
- *version-fix
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
@@ -117,6 +118,7 @@ EgwCoreLib.Razor:build:
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
- *version-fix
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
@@ -130,6 +132,7 @@ EgwCoreLib.BlazorTest:build:
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
- *version-fix
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
@@ -144,6 +147,7 @@ EgwCoreLib.BlazorTest:IIS01:deploy:
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
- *version-fix
rules:
- if: $CI_COMMIT_BRANCH == 'develop'
needs: ["EgwCoreLib.BlazorTest:build"]
@@ -2,7 +2,7 @@
<div class="col-4 px-0">
</div>
<div class="col-4 px-0 d-none d-lg-block text-center h4 text-truncate">
<NavLink class="btn btn-primary" href="" Match="NavLinkMatch.All">
<NavLink class="btn btn-primary" href="ForceReload" >
<span class="oi oi-home" aria-hidden="true"></span> Home
</NavLink>
</div>
+1 -2
View File
@@ -16,8 +16,7 @@ namespace EgwCoreLib.BlazorTest.Data
{"TestComponenti", "Test Componenti"},
{"TestSvgDraw", "Test SVG draw"},
{"TestGauges", "Test Gauges"},
{"TestChart", "Test Chart"},
{"TestMultiline", "Test Chart Multiline"},
{"TestChart", "Test Chart.js"},
};
}
}
@@ -0,0 +1,10 @@
@page "/ForceReload"
@inject NavigationManager NavMan
<h3>ForceReload</h3>
@code {
protected override void OnInitialized()
{
NavMan.NavigateTo("/", true);
}
}
+53 -25
View File
@@ -4,35 +4,63 @@
<PageTitle>Test</PageTitle>
<h3>TestCompo</h3>
<div class="row">
<div class="col-6">
@if (periodo != null)
<div class="card">
<div class="card-header d-flex justify-content-between">
<div class="px-0">
<h3>Test Grafici Chart.js</h3>
</div>
<div class="px-0">
<Toggler SelFilter="CurrFilt" FilterChanged="SetTipo"></Toggler>
</div>
</div>
<div class="card-body py-1">
@if (showMulti)
{
<div>
Periodo Selezionato: <b>@($"{periodo.Inizio:yyyy/MM/dd}") &rarr; @($"{periodo.Fine:yyyy/MM/dd}")</b>
<div class="row" style="height: 400px;">
<div class="col-6">
<ChartHist Id="01" Data="@histData(1)" Labels="@histLabel(1)" LineColor="rgb(7, 173, 236)" BackColor="rgba(107, 223, 255, 0.5)" ChartLabel="Ore 01"></ChartHist>
</div>
<div class="col-6">
<ChartMultiLine DataSets="currDS" ChartLabels="ChLabels"></ChartMultiLine>
</div>
</div>
}
else
{
<div class="row" style="height: 400px;">
<div class="col-6">
@if (periodo != null)
{
<div>
Periodo Selezionato: <b>@($"{periodo.Inizio:yyyy/MM/dd}") &rarr; @($"{periodo.Fine:yyyy/MM/dd}")</b>
</div>
}
</div>
<div class="col-6">
<PeriodoSel E_PeriodoSel="setPeriodo" CurrPeriodo="@periodo"></PeriodoSel>
</div>
<div class="col-4">
<ChartHist Id="01" Data="@histData(1)" Labels="@histLabel(1)" LineColor="rgb(7, 173, 236)" BackColor="rgba(107, 223, 255, 0.5)" ChartLabel="Ore 01"></ChartHist>
</div>
<div class="col-2 text-center">
<div>
<Doughnut Id="00" Type="@Doughnut.ChartType.Doughnut" Data="@SimData()" BackgroundColor="@colors"></Doughnut>
</div>
<small>display con animazione</small>
</div>
<div class="col-2 text-center">
<div>
<Doughnut Id="03" Type="@Doughnut.ChartType.Doughnut" Data="@SimData()" BackgroundColor="@colors"></Doughnut>
</div>
<small>display con animazione</small>
</div>
<div class="col-4">
<ChartHist Id="02" Data="@histData(2)" Labels="@histLabel(2)" LineColor="rgb(173, 7, 236)" BackColor="rgba(223,107, 255, 0.5)" ChartLabel="Ore 02"></ChartHist>
</div>
</div>
}
</div>
<div class="col-6">
<PeriodoSel E_PeriodoSel="setPeriodo" CurrPeriodo="@periodo"></PeriodoSel>
</div>
</div>
<div class="row" style="max-height: 30rem;">
<div class="col-2">
<Doughnut Id="00" Type="@Doughnut.ChartType.Doughnut" Data="@SimData()" BackgroundColor="@colors"></Doughnut>
</div>
<div class="col-4">
<ChartHist Id="01" Data="@histData(1)" Labels="@histLabel(1)" LineColor="rgb(7, 173, 236)" BackColor="rgba(107, 223, 255, 0.5)" ChartLabel="Ore 01"></ChartHist>
</div>
<div class="col-4">
<ChartHist Id="02" Data="@histData(2)" Labels="@histLabel(2)" LineColor="rgb(173, 7, 236)" BackColor="rgba(223,107, 255, 0.5)" ChartLabel="Ore 02"></ChartHist>
</div>
<div class="col-2">
<Doughnut Id="03" Type="@Doughnut.ChartType.Doughnut" Data="@SimData()" BackgroundColor="@colors"></Doughnut>
</div>
</div>
+78 -1
View File
@@ -1,5 +1,8 @@
using EgwCoreLib.Razor;
using EgwCoreLib.Razor.Data;
using EgwCoreLib.Utils;
using static EgwCoreLib.Razor.Data.chartJsData;
using static EgwCoreLib.Razor.Toggler;
namespace EgwCoreLib.BlazorTest.Pages
{
@@ -21,6 +24,8 @@ namespace EgwCoreLib.BlazorTest.Pages
#region Protected Properties
protected List<string>? ChLabels { get; set; } = null;
protected List<chartJsData.chartJsDataSetXY>? currDS { get; set; } = null;
protected DtUtils.Periodo? periodo { get; set; } = new DtUtils.Periodo(DtUtils.PeriodSet.ThisTrim);
#endregion Protected Properties
@@ -49,7 +54,16 @@ namespace EgwCoreLib.BlazorTest.Pages
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
CurrFilt = new Toggler.SelectGlobalToggle()
{
leftString = "Multi-linea",
rightString = "Singolo",
isActive = true,
toolTip = "Tipo di grafico"
};
currDS = null;
await Task.Delay(200);
await setupData();
}
protected override async Task OnParametersSetAsync()
@@ -69,6 +83,14 @@ namespace EgwCoreLib.BlazorTest.Pages
periodo = newPeriodo;
}
protected void SetTipo(SelectGlobalToggle selFilt)
{
if (selFilt != null)
{
showMulti = !selFilt.isActive;
}
}
protected double[] SimData()
{
List<double> answ = new List<double>();
@@ -94,5 +116,60 @@ namespace EgwCoreLib.BlazorTest.Pages
}
#endregion Protected Methods
#region Private Fields
private bool showMulti = false;
#endregion Private Fields
#region Private Properties
private Toggler.SelectGlobalToggle CurrFilt { get; set; } = new Toggler.SelectGlobalToggle();
#endregion Private Properties
#region Private Methods
private async Task setupData()
{
currDS = null;
List<chartJsData.chartJsDataSetXY> currDemo = new List<chartJsData.chartJsDataSetXY>();
ChLabels = new List<string>();
int numMesi = 6;
for (int iMese = 1; iMese <= numMesi; iMese++)
{
ChLabels.Add($"{iMese:00}");
}
for (int iSerie = 0; iSerie < 4; iSerie++)
{
// simulo 12 mesi...
List<chartJsXY> simData = new List<chartJsXY>();
for (int iMese = 1; iMese <= numMesi; iMese++)
{
simData.Add(new chartJsXY() { x = iMese, y = iMese + rnd.Next(-4, 4) });
}
int rCol = rnd.Next(0, 155);
int gCol = rnd.Next(0, 155);
int bCol = rnd.Next(0, 100);
chartJsData.chartJsDataSetXY singleData = new chartJsData.chartJsDataSetXY()
{
label = $"Data_{iSerie:00}",
data = simData,
borderColor = $"#{10 + rCol:X2}{30 + gCol:X2}{100 + bCol:X2}",
backgroundColor = $"rgba({60 + rCol},{80 + gCol},{155 + bCol},0.3)",
lineTension = 0,
stepped = iSerie % 5 == 0,
fill = iSerie % 3 == 0 ? "start" : "false"
};
// aggiungo
currDemo.Add(singleData);
}
currDS = currDemo;
await Task.Delay(10);
}
#endregion Private Methods
}
}
@@ -1,18 +0,0 @@
@page "/TestMultiLine"
@if (currDS == null)
{
<LoadingData></LoadingData>
}
else
{
<h3>TestMultiLine</h3>
<div class="row" style="height: 500px;">
<div class="col-6">
<ChartHist Id="01" Data="@histData(1)" Labels="@histLabel(1)" LineColor="rgb(7, 173, 236)" BackColor="rgba(107, 223, 255, 0.5)" ChartLabel="Ore 01"></ChartHist>
</div>
<div class="col-6">
<ChartMultiLine DataSets="currDS" ChartLabels="ChLabels"></ChartMultiLine>
</div>
</div>
}
@@ -1,97 +0,0 @@
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 EgwCoreLib.BlazorTest;
using EgwCoreLib.BlazorTest.Components;
using EgwCoreLib.BlazorTest.Shared;
using EgwCoreLib.Razor;
using EgwCoreLib.Razor.Data;
using static EgwCoreLib.Razor.Data.chartJsData;
namespace EgwCoreLib.BlazorTest.Pages
{
public partial class TestMultiLine
{
protected override async Task OnInitializedAsync()
{
currDS = null;
await Task.Delay(200);
await setupData();
}
protected List<chartJsData.chartJsDataSetXY>? currDS { get; set; } = null;
protected List<string>? ChLabels { get; set; } = null;
protected Random rnd = new Random();
private async Task setupData()
{
currDS = null;
List<chartJsData.chartJsDataSetXY> currDemo = new List<chartJsData.chartJsDataSetXY>();
ChLabels = new List<string>();
int numMesi = 6;
for (int iMese = 1; iMese <= numMesi; iMese++)
{
ChLabels.Add($"{iMese:00}");
}
for (int iSerie = 0; iSerie < 4; iSerie++)
{
// simulo 12 mesi...
List<chartJsXY> simData = new List<chartJsXY>();
for (int iMese = 1; iMese <= numMesi; iMese++)
{
simData.Add(new chartJsXY() { x = iMese, y = iMese + rnd.Next(-4, 4) });
}
int rCol = rnd.Next(0, 155);
int gCol = rnd.Next(0, 155);
int bCol = rnd.Next(0, 100);
chartJsData.chartJsDataSetXY singleData = new chartJsData.chartJsDataSetXY()
{
label = $"Data_{iSerie:00}",
data = simData,
borderColor = $"#{10 + rCol:X2}{30 + gCol:X2}{100 + bCol:X2}",
backgroundColor = $"rgba({60 + rCol},{80 + gCol},{155 + bCol},0.3)",
lineTension = 0,
stepped = iSerie % 5 == 0,
fill = iSerie % 3 == 0 ? "start" : "false"
};
// aggiungo
currDemo.Add(singleData);
}
currDS = currDemo;
await Task.Delay(10);
}
protected string[] histLabel(int num)
{
List<string> answ = new List<string>();
for (int i = 0; i < 50; i++)
{
answ.Add($"LBL_{i:00}");
}
return answ.ToArray();
}
protected string[] histData(int num)
{
List<string> answ = new List<string>();
for (int i = 0; i < 50; i++)
{
answ.Add($"{(double)(rnd.Next(10, 100)) / 10 + i}");
}
return answ.ToArray();
}
}
}
@@ -13,7 +13,7 @@
<div class="card">
<div class="card-header"><b>AZTEC</b></div>
<div class="card-body">
<div class="d-flex align-items-center" style=" height: 13rem;">
<div class="d-flex align-items-center text-center" style=" height: 13rem;">
<QrCodeDisplay rawCode="@qrCodeVal" ImgFormat="ZXing.BarcodeFormat.AZTEC"></QrCodeDisplay>
</div>
<hr />
+17 -6
View File
@@ -38,19 +38,30 @@
<script>
Blazor.start({
reconnectionOptions: {
maxRetries: 600,
retryIntervalMilliseconds: 1000
maxRetries: 1500,
retryIntervalMilliseconds: 4000
},
reconnectionHandler: {
onConnectionDown: (options, error) => console.error(error),
onConnectionUp: () => console.log("Client reconnected!")
onConnectionUp: () => console.log("Connection up!,restarting!")
}
}).then(() => {
Blazor.defaultReconnectionHandler._reconnectCallback = function (d) {
document.location.reload();
}
Object.defineProperty(Blazor.defaultReconnectionHandler, '_reconnectionDisplay', {
get() {
return this.__reconnectionDisplay;
},
set(value) {
this.__reconnectionDisplay = {
show: () => value.show(),
update: (d) => value.update(d),
rejected: (d) => document.location.reload()
}
}
});
});
</script>
@*Gestione ricollegamento successivo: https://learn.microsoft.com/en-us/aspnet/core/blazor/fundamentals/signalr?view=aspnetcore-6.0*@
@* <script>Blazor.defaultReconnectionHandler._reconnectCallback = function (d) { document.location.reload(); }</script> *@
</body>
</html>
+6
View File
@@ -19,6 +19,12 @@ if (!app.Environment.IsDevelopment())
app.UseHsts();
}
// disabilita risposta compressa in debug
if (!app.Environment.IsDevelopment())
{
app.UseResponseCompression();
}
app.UseHttpsRedirection();
app.UseStaticFiles();