diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 83019a4a..9d9847b0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,6 @@ variables: NEXUS_PATH: 'MP-STATS' + PROJ_PATH: '' APP_NAME: 'MP.Stats' SOL_NAME: 'MP-STATS' @@ -120,6 +121,20 @@ 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 + LAND:test: stage: test tags: @@ -184,6 +199,23 @@ 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 + LAND:IIS01:deploy: stage: deploy tags: @@ -248,6 +280,23 @@ 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 + LAND:IIS02:deploy: stage: deploy tags: @@ -316,6 +365,24 @@ 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 + LAND:installer: stage: installer tags: @@ -400,6 +467,28 @@ 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 + LAND:release: stage: release tags: @@ -484,8 +573,6 @@ MON:release: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" only: - #- feature/Deploy_CI_CD - # - master - tags except: - branches @@ -495,3 +582,26 @@ MON:release: - publish/ 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 \ No newline at end of file diff --git a/MP-WAMON.sln b/MP-WAMON.sln new file mode 100644 index 00000000..d0829635 --- /dev/null +++ b/MP-WAMON.sln @@ -0,0 +1,43 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.32126.317 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.Data", "MP.Data\MP.Data.csproj", "{10BA8450-301D-49C7-8E1E-21B7469C225C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.Mon", "MP.Mon\MP.Mon.csproj", "{7780FA7A-3597-4098-81C1-DC9AD6AE7A98}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MP.WASM.Mon.Server", "MP.WASM.Mon\Server\MP.WASM.Mon.Server.csproj", "{4A98B7F4-4EC6-4284-9D6C-63203DB981B1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MP.WASM.Mon.Client", "MP.WASM.Mon\Client\MP.WASM.Mon.Client.csproj", "{9BF7BDE7-016A-458C-8791-494FD4204301}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {10BA8450-301D-49C7-8E1E-21B7469C225C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {10BA8450-301D-49C7-8E1E-21B7469C225C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {10BA8450-301D-49C7-8E1E-21B7469C225C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {10BA8450-301D-49C7-8E1E-21B7469C225C}.Release|Any CPU.Build.0 = Release|Any CPU + {7780FA7A-3597-4098-81C1-DC9AD6AE7A98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7780FA7A-3597-4098-81C1-DC9AD6AE7A98}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7780FA7A-3597-4098-81C1-DC9AD6AE7A98}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7780FA7A-3597-4098-81C1-DC9AD6AE7A98}.Release|Any CPU.Build.0 = Release|Any CPU + {4A98B7F4-4EC6-4284-9D6C-63203DB981B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4A98B7F4-4EC6-4284-9D6C-63203DB981B1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4A98B7F4-4EC6-4284-9D6C-63203DB981B1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4A98B7F4-4EC6-4284-9D6C-63203DB981B1}.Release|Any CPU.Build.0 = Release|Any CPU + {9BF7BDE7-016A-458C-8791-494FD4204301}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9BF7BDE7-016A-458C-8791-494FD4204301}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9BF7BDE7-016A-458C-8791-494FD4204301}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9BF7BDE7-016A-458C-8791-494FD4204301}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {632D11D1-088B-4795-97E5-048534002558} + EndGlobalSection +EndGlobal diff --git a/MP.Data/Controllers/MpMonController.cs b/MP.Data/Controllers/MpMonController.cs index 9c2ed87b..fd0ec868 100644 --- a/MP.Data/Controllers/MpMonController.cs +++ b/MP.Data/Controllers/MpMonController.cs @@ -43,6 +43,7 @@ namespace MP.Data.Controllers { dbResult = dbCtx .DbSetArticoli + .AsNoTracking() .Where(x => x.CodArticolo.Contains(searchVal) || x.DescArticolo.Contains(searchVal) || x.Disegno.Contains(searchVal) || string.IsNullOrEmpty(searchVal)) .OrderBy(x => x.CodArticolo) .Take(numRecord) @@ -66,6 +67,7 @@ namespace MP.Data.Controllers { dbResult = dbCtx .DbSetMacchine + .AsNoTracking() .OrderBy(x => x.IdxMacchina) .ToList(); } @@ -83,6 +85,7 @@ namespace MP.Data.Controllers { dbResult = dbCtx .DbSetConfig + .AsNoTracking() .OrderBy(x => x.Chiave) .ToList(); } @@ -103,6 +106,7 @@ namespace MP.Data.Controllers dbResult = dbCtx .DbSetMSE .FromSqlRaw("EXEC stp_MSE_getData @maxAgeSec", maxAgeSec) + .AsNoTracking() .ToList(); } return dbResult; diff --git a/MP.Mon/Components/CmpFooter.razor.cs b/MP.Mon/Components/CmpFooter.razor.cs index 71252e09..bf322b8f 100644 --- a/MP.Mon/Components/CmpFooter.razor.cs +++ b/MP.Mon/Components/CmpFooter.razor.cs @@ -1,3 +1,5 @@ +using NLog; + namespace MP.Mon.Components { public partial class CmpFooter @@ -6,6 +8,7 @@ namespace MP.Mon.Components public void Dispose() { + //aTimer.Elapsed -= ElapsedTimer; aTimer.Stop(); aTimer.Dispose(); } @@ -13,17 +16,17 @@ namespace MP.Mon.Components public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e) { var pUpd = Task.Run(async () => - { - //await ReloadData(); - await Task.Delay(1); - await InvokeAsync(StateHasChanged); - }); + { + await Task.Delay(1); + await InvokeAsync(() => StateHasChanged()); + }); pUpd.Wait(); + //Log.Trace($"Elapsed Timer Footer"); } public void StartTimer() { - int tOutPeriod = 1000; + int tOutPeriod = 5000; //int.TryParse(Configuration["ReloadStatusTimer"], out tOutPeriod); aTimer = new System.Timers.Timer(tOutPeriod); aTimer.Elapsed += ElapsedTimer; @@ -35,12 +38,11 @@ namespace MP.Mon.Components #region Protected Methods - protected override async Task OnInitializedAsync() + protected override void OnInitialized() { var currAssembly = typeof(Program).Assembly.GetName(); version = currAssembly.Version != null ? currAssembly.Version : new Version(); StartTimer(); - await Task.Delay(1); } #endregion Protected Methods @@ -48,6 +50,7 @@ namespace MP.Mon.Components #region Private Fields private static System.Timers.Timer aTimer = null!; + private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); private Version version = null!; #endregion Private Fields diff --git a/MP.Mon/Components/CmpHeader.razor b/MP.Mon/Components/CmpHeader.razor index 1c2ae42d..38798b9d 100644 --- a/MP.Mon/Components/CmpHeader.razor +++ b/MP.Mon/Components/CmpHeader.razor @@ -1,12 +1,12 @@ 
- + MP MONitor
@($"{DateTime.Now:dddd dd MMMM yyyy}") - + EgalWare
diff --git a/MP.Mon/Components/DetailMSE.razor.cs b/MP.Mon/Components/DetailMSE.razor.cs index b67e53cb..11f58d24 100644 --- a/MP.Mon/Components/DetailMSE.razor.cs +++ b/MP.Mon/Components/DetailMSE.razor.cs @@ -12,6 +12,11 @@ namespace MP.Mon.Components [Parameter] public MappaStatoExpl? CurrRecord { get; set; } = null; + /// + /// Valore precedente x calcolo variazione + /// + private MappaStatoExpl? OldRecord { get; set; } = null; + [Parameter] public List? currTagConf { get; set; } = null; @@ -27,12 +32,31 @@ namespace MP.Mon.Components [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.Stop(); aTimer.Dispose(); } @@ -41,9 +65,36 @@ namespace MP.Mon.Components { var pUpd = Task.Run(async () => { - Log.Trace($"Elapsed Timer {CurrRecord?.CodMacchina}"); await Task.Delay(1); - await InvokeAsync(StateHasChanged); + // verifica variazione x blink... + bool needUpdate = false; + if (CurrRecord == null) + { + needUpdate = true; + } + else + { + if (OldRecord == null) + { + needUpdate = true; + } + else + { + if (!CurrRecord.Semaforo.Equals(OldRecord.Semaforo) || CurrRecord.Semaforo != "sVe") + { + needUpdate = true; + } + } + } + if (needUpdate) + { + if (false) + { + Log.Trace($"Elapsed Timer {CurrRecord?.CodMacchina}"); + } + await InvokeAsync(() => StateHasChanged()); + } + OldRecord = CurrRecord; }); pUpd.Wait(); } @@ -124,7 +175,7 @@ namespace MP.Mon.Components protected override async Task OnInitializedAsync() { - StartTimer(); + //StartTimer(); Random rnd = new Random(); await Task.Delay(rnd.Next(5)); setupConf(); @@ -195,11 +246,17 @@ 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"; } diff --git a/MP.Mon/Data/MpDataService.cs b/MP.Mon/Data/MpDataService.cs index cda398cd..ab191f88 100644 --- a/MP.Mon/Data/MpDataService.cs +++ b/MP.Mon/Data/MpDataService.cs @@ -3,38 +3,13 @@ using MP.Data.DatabaseModels; using Newtonsoft.Json; using NLog; using StackExchange.Redis; +using System.Diagnostics; using System.Text; namespace MP.Mon.Data { public class MpDataService : IDisposable { - #region Public Fields - - public static MP.Data.Controllers.MpMonController dbController { get; set; } = null!; - - #endregion Public Fields - - #region Private Fields - - private static IConfiguration _configuration = null!; - private static ILogger _logger = null!; - - private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); - - /// - /// Oggetto per connessione a REDIS - /// - private ConnectionMultiplexer redisConn = null!; - - //ISubscriber sub = redis.GetSubscriber(); - /// - /// Oggetto DB redis da impiegare x chiamate R/W - /// - private IDatabase redisDb = null!; - - #endregion Private Fields - #region Public Constructors public MpDataService(IConfiguration configuration, ILogger logger) @@ -71,6 +46,8 @@ namespace MP.Mon.Data #region Public Properties + public static MP.Data.Controllers.MpMonController dbController { get; set; } = null!; + /// /// Dizionario dei tag configurati per IOB /// @@ -91,6 +68,15 @@ namespace MP.Mon.Data dbController.Dispose(); } + /// + /// Elenco setup dei tag conf correnti + /// + /// + public Task>> getAllTags() + { + return Task.FromResult(currTagConf); + } + /// /// restituisce il valore da REDIS associato al tag richeisto /// @@ -110,21 +96,64 @@ namespace MP.Mon.Data public Task> MacchineGetAll() { - return Task.FromResult(dbController.MacchineGetAll().ToList()); + return Task.FromResult(dbController.MacchineGetAll()); } - public Task> MseGetAll() + public async Task> MseGetAll() { - var dbResult = dbController.MseGetAll(); - if (dbResult == null) + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + List result = new List(); + // cerco in redis... + var rawData = await redisDb.StringGetAsync(redisMseKey); + if (!string.IsNullOrEmpty(rawData)) { - dbResult = new List(); + result = JsonConvert.DeserializeObject>(rawData); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Trace($"Read from REDIS: {ts.TotalMilliseconds}ms"); } - return Task.FromResult(dbResult); + else + { + result = await Task.FromResult(dbController.MseGetAll()); + // serializzp e salvo... + rawData = JsonConvert.SerializeObject(result); + await redisDb.StringSetAsync(redisMseKey, rawData, TimeSpan.FromSeconds(2)); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Trace($"Read from DB: {ts.TotalMilliseconds}ms"); + } + if (result == null) + { + result = new List(); + } + return result; } #endregion Public Methods + #region Private Fields + + private static IConfiguration _configuration = null!; + private static ILogger _logger = null!; + + private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); + + /// + /// Oggetto per connessione a REDIS + /// + private ConnectionMultiplexer redisConn = null!; + + //ISubscriber sub = redis.GetSubscriber(); + /// + /// Oggetto DB redis da impiegare x chiamate R/W + /// + private IDatabase redisDb = null!; + + private string redisMseKey = "MP:MON:Cache:MSE"; + + #endregion Private Fields + #region Private Methods /// @@ -148,7 +177,8 @@ namespace MP.Mon.Data var fileConfData = JsonConvert.DeserializeObject(rawData); if (fileConfData != null) { - // effettuo esplosione conf SE contenesse il valore "***" = tutti gli IOB + // effettuo esplosione conf SE contenesse il valore "***" = tutti + // gli IOB if (fileConfData.IobSetup.ContainsKey("***")) { // recupero elenco macchine... @@ -159,8 +189,8 @@ namespace MP.Mon.Data { if (!string.IsNullOrEmpty(item.IdxMacchina)) { - // converto i valori x la macchina corrente... - // clono in nuovo oggetto + // converto i valori x la macchina corrente... clono in + // nuovo oggetto var specVal = baseConf.Value.Select(i => i.Clone()).ToList(); // sostituisco segnaposto foreach (var singleVal in specVal) @@ -192,7 +222,6 @@ namespace MP.Mon.Data currConf.Add(item.IdxMacchina, specVal); } } - } // altrimenti copio ed ho finito else diff --git a/MP.Mon/MP.Mon.csproj b/MP.Mon/MP.Mon.csproj index a97f1c6d..8a237fff 100644 --- a/MP.Mon/MP.Mon.csproj +++ b/MP.Mon/MP.Mon.csproj @@ -4,7 +4,7 @@ net6.0 enable enable - 6.15.2207.810 + 6.15.2207.1217 diff --git a/MP.Mon/Pages/Index.razor b/MP.Mon/Pages/Index.razor index 9a424e02..df68c4fa 100644 --- a/MP.Mon/Pages/Index.razor +++ b/MP.Mon/Pages/Index.razor @@ -2,18 +2,17 @@ -Index - - +MP MON
- @if (ListMSE == null) + + @if (listMSE == null) {
} - else if (ListMSE.Count == 0) + else if (listMSE.Count == 0) {
@@ -24,9 +23,9 @@ else { int currIdx = 0; - foreach (var recordIob in ListMSE) + foreach (var recordIob in listMSE) { - + currIdx++; if (currIdx >= maxCol) { @@ -38,8 +37,7 @@ int currNum = (currIdx % maxCol); while (currNum < (maxCol)) { - @((MarkupString)"
 
") - ; + @((MarkupString)"
 
"); currNum++; } diff --git a/MP.Mon/Pages/Index.razor.cs b/MP.Mon/Pages/Index.razor.cs index d028d1b9..c4409d3a 100644 --- a/MP.Mon/Pages/Index.razor.cs +++ b/MP.Mon/Pages/Index.razor.cs @@ -8,64 +8,39 @@ namespace MP.Mon.Pages { public partial class Index : IDisposable { - #region Protected Fields - - protected bool doAnimate = true; - protected int fastRefreshSec = 10; - protected int keepAliveMin = 1; - protected List? ListMSE = null; - protected int maxCol = 4; - protected string showArt = ""; - protected int slowRefreshSec = 300; - - #endregion Protected Fields - - #region Private Fields - - private static System.Timers.Timer fastTimer = new System.Timers.Timer(4000); - private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); - private static System.Timers.Timer slowTimer = new System.Timers.Timer(300000); - private List? CurrConfig = null; - - #endregion Private Fields - - #region Protected Properties - - protected int fastRefreshMs - { - get => 1000 * fastRefreshSec; - } - - [Inject] - protected MpDataService MMDataService { get; set; } = null!; - - [Inject] - protected NavigationManager NavManager { get; set; } = null!; - - protected int slowRefreshMs - { - get => 1000 * slowRefreshSec; - } - - #endregion Protected Properties - #region Public Methods public void Dispose() { +#if false fastTimer.Stop(); fastTimer.Dispose(); slowTimer.Stop(); slowTimer.Dispose(); +#endif + disposeTimers(); } public void ElapsedFastTimer(object? source, System.Timers.ElapsedEventArgs e) { var pUpd = Task.Run(async () => { - await ReloadData(); + // 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"); + } + else + { + doBlink = false; + await ReloadData(); + Log.Trace("Elapsed Fast Timer reload"); + } await Task.Delay(1); - Log.Trace("Elapsed Fast Timer"); await InvokeAsync(StateHasChanged); }); pUpd.Wait(); @@ -73,9 +48,12 @@ namespace MP.Mon.Pages public async void ElapsedSlowTimer(object? source, System.Timers.ElapsedEventArgs e) { - ListMSE = null; + listMSE = null; await Task.Delay(1); - Log.Trace("Elapsed Slow Timer"); + Log.Info("Elapsed Slow Timer --> full page reload"); + // dispongo i vari timers... + disposeTimers(); + // reload pagina NavManager.NavigateTo(NavManager.Uri); } @@ -95,6 +73,32 @@ namespace MP.Mon.Pages #endregion Public Methods + #region Protected Fields + + protected bool doAnimate = true; + protected int fastRefreshMs = 1000; + protected int keepAliveMin = 1; + protected int maxCol = 6; + protected string showArt = ""; + protected int slowRefreshSec = 300; + + #endregion Protected Fields + + #region Protected Properties + + [Inject] + protected MpDataService MMDataService { get; set; } = null!; + + [Inject] + protected NavigationManager NavManager { get; set; } = null!; + + protected int slowRefreshMs + { + get => 1000 * slowRefreshSec; + } + + #endregion Protected Properties + #region Protected Methods /// @@ -160,7 +164,8 @@ namespace MP.Mon.Pages } /// - /// Recupera da redis (in una chiamata soltanto) tutti i valori richiesti e compone un dizionario x ottimizzare visualizzazione + /// Recupera da redis (in una chiamata soltanto) tutti i valori richiesti e compone un + /// dizionario x ottimizzare visualizzazione /// /// /// @@ -186,25 +191,42 @@ namespace MP.Mon.Pages #endregion Protected Methods + #region Private Fields + + private static System.Timers.Timer fastTimer = new System.Timers.Timer(4000); + private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); + private static System.Timers.Timer slowTimer = new System.Timers.Timer(300000); + private List? CurrConfig = null; + private bool doBlink = false; + private List? listMSE = null; + + #endregion Private Fields + #region Private Methods + private void disposeTimers() + { + fastTimer.Elapsed -= ElapsedFastTimer; + fastTimer.Stop(); + fastTimer.Dispose(); + slowTimer.Elapsed -= ElapsedSlowTimer; + slowTimer.Stop(); + slowTimer.Dispose(); + } + private async Task ReloadData() { +#if DEBUG // hack: legge 4 volte i dati x stressare sistema - bool stressTest = false; - if (stressTest) + var singleData = await MMDataService.MseGetAll(); + listMSE = new List(); + for (int i = 0; i < 4; i++) { - var singleData = await MMDataService.MseGetAll(); - ListMSE = singleData.ToList(); - for (int i = 0; i < 3; i++) - { - ListMSE.AddRange(singleData); - } - } - else - { - ListMSE = await MMDataService.MseGetAll(); + listMSE.AddRange(singleData); } +#else + listMSE = await MMDataService.MseGetAll(); +#endif } private async Task setupConf() @@ -220,10 +242,9 @@ namespace MP.Mon.Pages getConfValInt("doAnimate", ref intDoAnim); doAnimate = intDoAnim == 1; getConfValInt("pageRefreshSec", ref slowRefreshSec); - getConfValInt("MSE_cacheDuration", ref fastRefreshSec); getConfVal("sART", ref showArt); - Log.Info($"Effettuato setup parametri | keepAlive: {keepAliveMin} | MaxCol: {maxCol} | doAnimate: {doAnimate} | slowRefreshSec: {slowRefreshSec} | fastRefreshSec: {fastRefreshSec}"); + Log.Info($"setupConf | Effettuato setup parametri | keepAlive: {keepAliveMin} | MaxCol: {maxCol} | doAnimate: {doAnimate} | slowRefreshSec: {slowRefreshSec} | fastRefreshMs: {fastRefreshMs}"); } } diff --git a/MP.Mon/Pages/_Layout.cshtml b/MP.Mon/Pages/_Layout.cshtml index 49d12f15..ad3cb392 100644 --- a/MP.Mon/Pages/_Layout.cshtml +++ b/MP.Mon/Pages/_Layout.cshtml @@ -30,14 +30,6 @@ @*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)*@ - - - - diff --git a/MP.Mon/Properties/PublishProfiles/IIS01.pubxml.user b/MP.Mon/Properties/PublishProfiles/IIS01.pubxml.user index 148b0929..9e79b53d 100644 --- a/MP.Mon/Properties/PublishProfiles/IIS01.pubxml.user +++ b/MP.Mon/Properties/PublishProfiles/IIS01.pubxml.user @@ -7,6 +7,6 @@ by editing this MSBuild file. In order to learn more about this please visit htt AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAA+11nhJeDSkeTlSej+COD3AAAAAACAAAAAAADZgAAwAAAABAAAACFCXZ0UR7Czo59aaRCHU5QAAAAAASAAACgAAAAEAAAACYlKt9E6s77uEikpKwyhdQYAAAAUwae989LovFbsfjRp69HCVpyUQZbqLyYFAAAAMW8mLSAxWmKaOvB4nkDgUpS27/b - True|2022-04-14T07:37:09.1341280Z;True|2022-02-26T18:24:32.0833123+01:00;False|2022-02-26T18:24:15.3994092+01:00;False|2022-02-26T18:23:44.8358586+01:00;True|2021-05-26T19:49:30.0427896+02:00;False|2021-05-26T19:49:14.9065510+02:00;True|2021-05-25T17:48:33.3901785+02:00;True|2021-05-25T17:46:09.2063020+02:00;True|2021-05-25T17:42:47.8167539+02:00;True|2021-05-25T17:22:03.1877438+02:00;True|2021-05-25T17:21:05.1565775+02:00;True|2021-05-25T16:26:34.1426996+02:00;True|2021-05-25T16:14:28.2842402+02:00;True|2021-05-25T15:02:11.7131495+02:00; + True|2022-07-12T14:34:20.2940329Z;True|2022-04-14T09:37:09.1341280+02:00;True|2022-02-26T18:24:32.0833123+01:00;False|2022-02-26T18:24:15.3994092+01:00;False|2022-02-26T18:23:44.8358586+01:00;True|2021-05-26T19:49:30.0427896+02:00;False|2021-05-26T19:49:14.9065510+02:00;True|2021-05-25T17:48:33.3901785+02:00;True|2021-05-25T17:46:09.2063020+02:00;True|2021-05-25T17:42:47.8167539+02:00;True|2021-05-25T17:22:03.1877438+02:00;True|2021-05-25T17:21:05.1565775+02:00;True|2021-05-25T16:26:34.1426996+02:00;True|2021-05-25T16:14:28.2842402+02:00;True|2021-05-25T15:02:11.7131495+02:00; \ No newline at end of file diff --git a/MP.Mon/Resources/ChangeLog.html b/MP.Mon/Resources/ChangeLog.html index 7d69493d..e6795ccf 100644 --- a/MP.Mon/Resources/ChangeLog.html +++ b/MP.Mon/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MON MAPO -

Versione: 6.15.2207.810

+

Versione: 6.15.2207.1217


Note di rilascio: