From 4e6d69cc899d5f86861372a63c418e20e6ac047a Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 21 Jan 2025 15:42:06 +0100 Subject: [PATCH] Aggiunta metodi x invio richiesta update apps --- Core/Enum.cs | 7 +- LiMan.Api/Controllers/ReleaseController.cs | 58 ++------ LiMan.UI/Components/InstAppPareto.razor | 2 +- LiMan.UI/Components/InstAppPareto.razor.cs | 128 +++++++++++------- LiMan.UI/Components/InstallInfoStats.razor.cs | 4 +- LiMan.UI/Components/ListAppShort.razor | 10 +- LiMan.UI/Components/ListAppShort.razor.cs | 22 +++ LiMan.UI/LiMan.UI.csproj | 2 +- LiMan.UI/Resources/ChangeLog.html | 2 +- LiMan.UI/Resources/VersNum.txt | 2 +- LiMan.UI/Resources/manifest.xml | 2 +- 11 files changed, 139 insertions(+), 100 deletions(-) diff --git a/Core/Enum.cs b/Core/Enum.cs index 291abae..0d9aae5 100644 --- a/Core/Enum.cs +++ b/Core/Enum.cs @@ -142,7 +142,12 @@ namespace Core /// /// Upsert valori TargetList (gestiti in remoto) /// - TargetListUpsert + TargetListUpsert, + + /// + /// Aggiorno di un applicazione richiamato da remoto + /// + TargetAppUpdate } } } \ No newline at end of file diff --git a/LiMan.Api/Controllers/ReleaseController.cs b/LiMan.Api/Controllers/ReleaseController.cs index 8362fd1..6ed74d5 100644 --- a/LiMan.Api/Controllers/ReleaseController.cs +++ b/LiMan.Api/Controllers/ReleaseController.cs @@ -96,6 +96,8 @@ namespace LiMan.APi.Controllers if (CheckReqKeys(CurrRequest)) { result = await dataService.ReleaseGetByApp(CurrRequest.CodApp); + // invio notifica x app... + dataService.TaskMessPipe.sendMessage(CurrRequest.CodImp); await dataService.recordCall(CurrRequest.CodApp, CurrRequest.CodApp, $"POST:api/release/getall/ | {CurrRequest.MastKey} | {CurrRequest.CodImp} | {CurrRequest.CodApp}"); } return result; @@ -114,6 +116,8 @@ namespace LiMan.APi.Controllers if (CheckReqKeys(CurrRequest)) { result = await dataService.ReleaseGetCritical(); + // invio notifica x app... + dataService.TaskMessPipe.sendMessage(CurrRequest.CodImp); await dataService.recordCall(CurrRequest.CodApp, CurrRequest.CodApp, $"POST:api/release/getcritical/ | {CurrRequest.MastKey} | {CurrRequest.CodImp} | {CurrRequest.CodApp}"); } return result; @@ -145,6 +149,8 @@ namespace LiMan.APi.Controllers dataService.InstallRelUpsert(checkRec); // chiamata x effettuare eventuale snapshot sulle installazioni attive await dataService.InstallRelHistSnapshot(false); + // invio notifica x app... + dataService.TaskMessPipe.sendMessage(CurrRequest.CodImp); // registro infine chiamata await dataService.recordCall(CurrRequest.CodApp, CurrRequest.CodApp, $"POST:api/release/getfilt/ | {CurrRequest.MastKey} | {CurrRequest.CodImp} | {CurrRequest.CodApp}"); } @@ -163,6 +169,8 @@ namespace LiMan.APi.Controllers if (CheckReqKeys(CurrRequest)) { result = await dataService.ReleaseGetByAppVersLimit(CurrRequest.CodApp, CurrRequest.VersMin, CurrRequest.VersMax); + // invio notifica x app... + dataService.TaskMessPipe.sendMessage(CurrRequest.CodImp); await dataService.recordCall(CurrRequest.CodApp, CurrRequest.CodApp, $"POST:api/release/getlimit/ | {CurrRequest.MastKey} | {CurrRequest.CodImp} | {CurrRequest.CodApp}"); } return result; @@ -279,52 +287,13 @@ namespace LiMan.APi.Controllers if (CheckReqKeys(ManagedApp)) { result = dataService.InstallRelClean(ManagedApp.CodImp, ManagedApp.AppKey, ManagedApp.ListCodApp); + // invio notifica x app... + dataService.TaskMessPipe.sendMessage(ManagedApp.CodImp); } await Task.Delay(1); return result; } -#if false - /// - /// Richiede un eventuale elenco di task da eseguire x il device richiedente - /// - /// Obj AuthDataDTO con chiavi (master o app) - [HttpPost("task-pending")] - public async Task> Task2ExeRequest([FromBody] AuthDataDTO CurrRequest) - { - Dictionary result = new Dictionary(); - // verifica validità richiesta... - if (CheckReqKeys(CurrRequest)) - { - // FixMe ToDo !!! - // recupera da REDIS i task da eseguire se presenti... - - // registro infine chiamata - await dataService.recordCall(CurrRequest.CodImp, CurrRequest.CodImp, $"POST:api/release/task2exe/ | {CurrRequest.MastKey} | {CurrRequest.CodImp}"); - } - return result; - } - /// - /// Registra esecuzoine task richiesti - /// - /// Obj AuthDataDTO con chiavi (master o app) - [HttpPost("task-done")] - public async Task Task2ExeResult([FromBody] TaskResultDTO CurrRequest) - { - string result = "NA"; - // verifica validità richiesta... - if (CheckReqKeys(CurrRequest)) - { - // FixMe ToDo !!! - // salva in redis e toglie dai task da eseguire la richiesta relativa... - - // registro infine chiamata - await dataService.recordCall(CurrRequest.CodImp, CurrRequest.CodImp, $"POST:api/release/save-info/ | {CurrRequest.MastKey} | {CurrRequest.CodImp}"); - } - return result; - } -#endif - #endregion Public Methods #region Protected Properties @@ -397,6 +366,9 @@ namespace LiMan.APi.Controllers } return answ; } + + #endregion Private Methods + #if false /// /// Verifica validità richiesta @@ -413,9 +385,7 @@ namespace LiMan.APi.Controllers // verifica validità chiavi... TBD!!! } return answ; - } + } #endif - - #endregion Private Methods } } \ No newline at end of file diff --git a/LiMan.UI/Components/InstAppPareto.razor b/LiMan.UI/Components/InstAppPareto.razor index b7b3487..ae4485f 100644 --- a/LiMan.UI/Components/InstAppPareto.razor +++ b/LiMan.UI/Components/InstAppPareto.razor @@ -61,7 +61,7 @@
- +
diff --git a/LiMan.UI/Components/InstAppPareto.razor.cs b/LiMan.UI/Components/InstAppPareto.razor.cs index 3cf30b2..5948662 100644 --- a/LiMan.UI/Components/InstAppPareto.razor.cs +++ b/LiMan.UI/Components/InstAppPareto.razor.cs @@ -3,6 +3,7 @@ using LiMan.DB; using LiMan.DB.DTO; using LiMan.UI.Data; using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; using Newtonsoft.Json; using Org.BouncyCastle.Ocsp; using System; @@ -49,6 +50,29 @@ namespace LiMan.UI.Components #endregion Protected Properties + /// + /// Registrazione richiesta update app remota + /// + /// + /// + private async Task ProcReqUpdate(AppRelStatusDTO selRec) + { + + if (!await JSRuntime.InvokeAsync("confirm", $"Sicuro di voler forzare update applicativo {selRec.CodApp} sul Device? Eventuali configurazioni presenti saranno ripristinate, altrimenti andrà verificato manualmente l'esito dell'operazione.")) + return; + + // invio task update applicazione + LMDService.TaskReqAdd(CodImpSel, EgwAccTask.TargetAppUpdate, selRec.CodApp); + ReloadTaskStatus(); + ReloadTaskResults(); + // invio notifica update... + LMDService.TaskMessPipe.sendMessage(selRec.CodApp); + } + + [Inject] + protected IJSRuntime JSRuntime { get; set; } = null!; + + #region Protected Methods protected override void OnInitialized() @@ -56,29 +80,6 @@ namespace LiMan.UI.Components LMDService.TaskMessPipe.EA_NewMessage += async (sender, e) => await TaskMessPipe_EA_NewMessage(sender, e); } - /// - /// Evento refresh legato a ricezione evento da MessagePipe - /// - /// - /// - private async Task TaskMessPipe_EA_NewMessage(object sender, EventArgs e) - { - PubSubEventArgs currArgs = (PubSubEventArgs)e; - // qualsiasi messaggio fa scattare reload data - if (!string.IsNullOrEmpty(currArgs.newMessage)) - { - // verifico se sia il cod impianto selezionato, nel faso forzo refreesh... - if (!string.IsNullOrEmpty(CodImpSel) && CodImpSel.Equals(currArgs.newMessage)) - { - isLoading = true; - ReloadTaskStatus(); - ReloadTaskResults(); - isLoading = false; - await InvokeAsync(StateHasChanged); - } - } - } - protected override void OnParametersSet() { ReloadData(); @@ -237,33 +238,46 @@ namespace LiMan.UI.Components #region Private Fields private List AppInstList = new List(); + private List ChartColor = new List(); + private double[] ChartData = new double[1]; + private string[] ChartLabels = new string[1]; + private string CodImpSel = ""; + private string CodInstSel = ""; + private int currPage = 1; - private bool HasFlitCli = false; + + private Dictionary DevInfo = new Dictionary(); + private bool HasFiltImp = false; + + private bool HasFlitCli = false; + private bool isLoading = false; + + private Dictionary LicInfo = new Dictionary(); + private int numRecord = 10; + + private Dictionary RunStats = new Dictionary(); + + private bool showDetail = false; + private string sKey = "InstAppPareto"; + /// /// Elenco task eseguiti /// private Dictionary TaskDone = new Dictionary(); + private int totalCount = 0; #endregion Private Fields - - private bool showDetail = false; - - private Dictionary DevInfo = new Dictionary(); - private Dictionary RunStats = new Dictionary(); - private Dictionary LicInfo = new Dictionary(); - - #region Private Properties private string CssDivDetail @@ -480,18 +494,6 @@ namespace LiMan.UI.Components .ToList(); } - /// - /// Esegue update stato task - /// - private void ReloadTaskStatus() - { - TaskDone = new Dictionary(); - if (!string.IsNullOrEmpty(CodImpSel)) - { - TaskDone = LMDService.TaskDoneGet(CodImpSel); - } - } - /// /// Rilegge risultato task come obj specifici in area DONE... /// @@ -510,7 +512,6 @@ namespace LiMan.UI.Components string rawData = TaskDone[devInfoKey]; if (!string.IsNullOrEmpty(rawData) && rawData.Count() > 2) { - DevInfo = JsonConvert.DeserializeObject>(rawData); } } @@ -521,7 +522,6 @@ namespace LiMan.UI.Components string rawData = TaskDone["RunStats"]; if (!string.IsNullOrEmpty(rawData) && rawData.Count() > 2) { - RunStats = JsonConvert.DeserializeObject>(rawData); } } @@ -531,13 +531,47 @@ namespace LiMan.UI.Components string rawData = TaskDone["LicInfo"]; if (!string.IsNullOrEmpty(rawData) && rawData.Count() > 2) { - LicInfo = JsonConvert.DeserializeObject>(rawData); } } } } + /// + /// Esegue update stato task + /// + private void ReloadTaskStatus() + { + TaskDone = new Dictionary(); + if (!string.IsNullOrEmpty(CodImpSel)) + { + TaskDone = LMDService.TaskDoneGet(CodImpSel); + } + } + + /// + /// Evento refresh legato a ricezione evento da MessagePipe + /// + /// + /// + private async Task TaskMessPipe_EA_NewMessage(object sender, EventArgs e) + { + PubSubEventArgs currArgs = (PubSubEventArgs)e; + // qualsiasi messaggio fa scattare reload data + if (!string.IsNullOrEmpty(currArgs.newMessage)) + { + // verifico se sia il cod impianto selezionato, nel faso forzo refreesh... + if (!string.IsNullOrEmpty(CodImpSel) && CodImpSel.Equals(currArgs.newMessage)) + { + isLoading = true; + ReloadTaskStatus(); + ReloadTaskResults(); + isLoading = false; + await InvokeAsync(StateHasChanged); + } + } + } + #endregion Private Methods } } \ No newline at end of file diff --git a/LiMan.UI/Components/InstallInfoStats.razor.cs b/LiMan.UI/Components/InstallInfoStats.razor.cs index 86f930a..d764674 100644 --- a/LiMan.UI/Components/InstallInfoStats.razor.cs +++ b/LiMan.UI/Components/InstallInfoStats.razor.cs @@ -217,7 +217,7 @@ namespace LiMan.UI.Components } [Inject] - protected IJSRuntime JSRuntime { get; set; } + protected IJSRuntime JSRuntime { get; set; } = null!; /// /// Force reboot applicazione EgwACC @@ -225,7 +225,7 @@ namespace LiMan.UI.Components /// private async Task SendReboot() { - if (!await JSRuntime.InvokeAsync("confirm", "Sicuro di voler forzare il riavvio di EgwAppControlCenter sul Deivice? In caso di update disponibile questo sarà applicato in modo automatico senza conferma utente.")) + if (!await JSRuntime.InvokeAsync("confirm", "Sicuro di voler forzare il riavvio di EgwAppControlCenter sul Device? In caso di update disponibile questo sarà applicato in modo automatico senza conferma utente.")) return; SendTask(Core.Enum.EgwAccTask.ForceUpdate); diff --git a/LiMan.UI/Components/ListAppShort.razor b/LiMan.UI/Components/ListAppShort.razor index 3d58c30..59fcde1 100644 --- a/LiMan.UI/Components/ListAppShort.razor +++ b/LiMan.UI/Components/ListAppShort.razor @@ -21,7 +21,15 @@ { @item.CodApp - @item.VersNumInstall + + @if (item.UpToDateStatus < 4 && item.CodApp.StartsWith("IOB-")) + { + + } + @item.VersNumInstall + } diff --git a/LiMan.UI/Components/ListAppShort.razor.cs b/LiMan.UI/Components/ListAppShort.razor.cs index cb790f5..f2b524f 100644 --- a/LiMan.UI/Components/ListAppShort.razor.cs +++ b/LiMan.UI/Components/ListAppShort.razor.cs @@ -1,8 +1,11 @@ using LiMan.DB.DTO; using LiMan.UI.Data; using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; using System.Collections.Generic; using System.Linq; +using static Core.Enum; +using System.Threading.Tasks; using static EgwCoreLib.Razor.Sorter; namespace LiMan.UI.Components @@ -14,8 +17,27 @@ namespace LiMan.UI.Components [Parameter] public List AppList { get; set; } = new List(); + [Parameter] + public EventCallback EC_ReqUpdateApp { get; set; } + #endregion Public Properties + /// + /// Registrazione richiesta update app remota + /// + /// + /// + private async Task RequestUpdate(AppRelStatusDTO selRec) + { + await EC_ReqUpdateApp.InvokeAsync(selRec); + } + + [Inject] + protected IJSRuntime JSRuntime { get; set; } = null!; + + [Inject] + protected LiManDataService LMDService { get; set; } = null!; + #region Protected Properties [Inject] diff --git a/LiMan.UI/LiMan.UI.csproj b/LiMan.UI/LiMan.UI.csproj index 35dcff4..962f31b 100644 --- a/LiMan.UI/LiMan.UI.csproj +++ b/LiMan.UI/LiMan.UI.csproj @@ -2,7 +2,7 @@ net6.0 - 2.1.2501.2112 + 2.1.2501.2115 LiMan.UI LiMan.UI diff --git a/LiMan.UI/Resources/ChangeLog.html b/LiMan.UI/Resources/ChangeLog.html index 094951c..d9abbe0 100644 --- a/LiMan.UI/Resources/ChangeLog.html +++ b/LiMan.UI/Resources/ChangeLog.html @@ -1,6 +1,6 @@ License Manager -

Versione: 2.1.2501.2112

+

Versione: 2.1.2501.2115


Note di rilascio:
  • diff --git a/LiMan.UI/Resources/VersNum.txt b/LiMan.UI/Resources/VersNum.txt index a1eac60..5da319e 100644 --- a/LiMan.UI/Resources/VersNum.txt +++ b/LiMan.UI/Resources/VersNum.txt @@ -1 +1 @@ -2.1.2501.2112 +2.1.2501.2115 diff --git a/LiMan.UI/Resources/manifest.xml b/LiMan.UI/Resources/manifest.xml index 32a96b1..46336e5 100644 --- a/LiMan.UI/Resources/manifest.xml +++ b/LiMan.UI/Resources/manifest.xml @@ -1,6 +1,6 @@ - 2.1.2501.2112 + 2.1.2501.2115 https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/LiMan.UI.zip https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/ChangeLog.html false