From 90a3d685b45b10fe477f45daa4ae6b6321bf4614 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 21 Oct 2024 17:41:02 +0200 Subject: [PATCH] Update LAND x invio zip a LiMan --- MP-LAND.sln | 7 ++++ MP.Land/Data/SyncService.cs | 39 ++++++++++++++--------- MP.Land/MP.Land.csproj | 3 +- MP.Land/Pages/UpdateManager.razor.cs | 11 +++++++ MP.Land/Program.cs | 2 +- MP.Land/Properties/launchSettings.json | 2 +- MP.Land/Resources/ChangeLog.html | 2 +- MP.Land/Resources/VersNum.txt | 2 +- MP.Land/Resources/manifest.xml | 2 +- MP.Land/appsettings.Development.json | 16 +++++----- MP.Land/appsettings.json | 6 ++-- MP.Prog/Components/ArchiveStatus.razor | 2 +- MP.Prog/Components/ArchiveStatus.razor.cs | 4 ++- MP.Prog/Components/CmpTop.razor | 8 +---- MP.Prog/Components/CmpTop.razor.cs | 14 ++++++++ MP.Prog/MP.Prog.csproj | 2 +- MP.Prog/Resources/ChangeLog.html | 2 +- MP.Prog/Resources/VersNum.txt | 2 +- MP.Prog/Resources/manifest.xml | 2 +- 19 files changed, 84 insertions(+), 44 deletions(-) diff --git a/MP-LAND.sln b/MP-LAND.sln index 85cb3e47..7c54065e 100644 --- a/MP-LAND.sln +++ b/MP-LAND.sln @@ -11,18 +11,25 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Egw.Core", "Egw.Core\Egw.Co EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug_LiManDebug|Any CPU = Debug_LiManDebug|Any CPU Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D949AB45-9B65-4594-A97E-182BC3831707}.Debug_LiManDebug|Any CPU.ActiveCfg = Debug_LiManDebug|Any CPU + {D949AB45-9B65-4594-A97E-182BC3831707}.Debug_LiManDebug|Any CPU.Build.0 = Debug_LiManDebug|Any CPU {D949AB45-9B65-4594-A97E-182BC3831707}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D949AB45-9B65-4594-A97E-182BC3831707}.Debug|Any CPU.Build.0 = Debug|Any CPU {D949AB45-9B65-4594-A97E-182BC3831707}.Release|Any CPU.ActiveCfg = Release|Any CPU {D949AB45-9B65-4594-A97E-182BC3831707}.Release|Any CPU.Build.0 = Release|Any CPU + {E8B1E617-87BC-4638-A8B6-04EEBA3B8F47}.Debug_LiManDebug|Any CPU.ActiveCfg = Debug|Any CPU + {E8B1E617-87BC-4638-A8B6-04EEBA3B8F47}.Debug_LiManDebug|Any CPU.Build.0 = Debug|Any CPU {E8B1E617-87BC-4638-A8B6-04EEBA3B8F47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E8B1E617-87BC-4638-A8B6-04EEBA3B8F47}.Debug|Any CPU.Build.0 = Debug|Any CPU {E8B1E617-87BC-4638-A8B6-04EEBA3B8F47}.Release|Any CPU.ActiveCfg = Release|Any CPU {E8B1E617-87BC-4638-A8B6-04EEBA3B8F47}.Release|Any CPU.Build.0 = Release|Any CPU + {D3D348EF-1313-43DF-94FB-28CD38B68212}.Debug_LiManDebug|Any CPU.ActiveCfg = Debug|Any CPU + {D3D348EF-1313-43DF-94FB-28CD38B68212}.Debug_LiManDebug|Any CPU.Build.0 = Debug|Any CPU {D3D348EF-1313-43DF-94FB-28CD38B68212}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D3D348EF-1313-43DF-94FB-28CD38B68212}.Debug|Any CPU.Build.0 = Debug|Any CPU {D3D348EF-1313-43DF-94FB-28CD38B68212}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/MP.Land/Data/SyncService.cs b/MP.Land/Data/SyncService.cs index a8417301..a51aa105 100644 --- a/MP.Land/Data/SyncService.cs +++ b/MP.Land/Data/SyncService.cs @@ -29,6 +29,17 @@ namespace MP.Land.Data public SyncService(IConfiguration configuration) { _configuration = configuration; + + // sistemo conf secondo Target compilazione + + +#if DEBUG_LIMANDEBUG + apiUrl = "https://localhost:5003/"; +#else + apiUrl = "https://liman.egalware.com/ELM.API/"; +#endif + // fix opzioni base del RestClient + restOptStd = new RestClientOptions { Timeout = TimeSpan.FromSeconds(60), BaseUrl = new Uri(apiUrl) }; } #endregion Public Constructors @@ -164,10 +175,12 @@ namespace MP.Land.Data bool answ = false; try { + string apiUrl = "/api/filesave/zipbackup"; + Log.Info($"Inizio chiamata REST | URL: {restOptStd.BaseUrl} | api: {apiUrl}"); // client chiamate rest var client = new RestClient(restOptStd); // Chiamo il metodo! - var actReq = new RestRequest($"/api/filesave/zipbackup", Method.Post); + var actReq = new RestRequest(apiUrl, Method.Post); actReq.AddParameter("CodApp", $"{CodApp}"); actReq.AddParameter("CodInst", $"{CodInst}"); actReq.AddParameter("DoUnzip", $"{DoUnzip}"); @@ -176,20 +189,20 @@ namespace MP.Land.Data actReq.AddHeader("Content-Type", "multipart/form-data"); // effettuo vera chiamata var currResp = await client.ExecuteAsync(actReq); - if (currResp.StatusCode == System.Net.HttpStatusCode.OK && currResp.Content != null) + if ((currResp.StatusCode == System.Net.HttpStatusCode.OK || currResp.StatusCode == System.Net.HttpStatusCode.Created) && currResp.Content != null) { // mi restituisce esito upload - var currList = JsonConvert.DeserializeObject>(currResp.Content); + var currList = JsonConvert.DeserializeObject(currResp.Content); if (currList != null) { - // se contiene anche la richiesta è ok... - var recUpd = currList.FirstOrDefault(x => x.FileName == ZipFile.Name); - if (recUpd != null) - { - answ = recUpd.Uploaded; - } + answ = currList.Uploaded; + Log.Info($"Invio file | ZipName: {ZipFile.Name} | uploaded: {answ}"); } } + else + { + Log.Error($"Errore in invio | StatusCode: {currResp.StatusCode}{Environment.NewLine}{currResp.Content}"); + } } catch (Exception exc) { @@ -231,11 +244,7 @@ namespace MP.Land.Data /// /// URL dell'API x chiamate gestione licenze /// -#if DEBUG - private static string apiUrl = "https://localhost:5003/"; -#else - private static string apiUrl = "https://liman.egalware.com/ELM.API/"; -#endif + private string apiUrl { get; set; } = "https://localhost:5003/"; /// /// Classe logger @@ -247,7 +256,7 @@ namespace MP.Land.Data /// - base URI al sito /// - timeout 1 min /// - private static RestClientOptions restOptStd = new RestClientOptions { Timeout = TimeSpan.FromSeconds(60), BaseUrl = new Uri(apiUrl) }; + private RestClientOptions restOptStd { get; set; } = new RestClientOptions(); #endregion Private Fields } diff --git a/MP.Land/MP.Land.csproj b/MP.Land/MP.Land.csproj index 81a5305d..cf9b8710 100644 --- a/MP.Land/MP.Land.csproj +++ b/MP.Land/MP.Land.csproj @@ -3,7 +3,8 @@ net6.0 MP.Land - 6.16.2410.2111 + 6.16.2410.2117 + Debug;Release;Debug_LiManDebug diff --git a/MP.Land/Pages/UpdateManager.razor.cs b/MP.Land/Pages/UpdateManager.razor.cs index b3bfcd24..d4c74aaf 100644 --- a/MP.Land/Pages/UpdateManager.razor.cs +++ b/MP.Land/Pages/UpdateManager.razor.cs @@ -182,10 +182,12 @@ namespace MP.Land.Pages /// protected async Task UploadBackupConfig() { + Log.Info("Inizio procedura UploadBackupConfig"); // init progress... showProgress = true; showUpdate = true; outMessages = $"Inizio preparazione per upload configurazioni di {numSteps} packages"; + Log.Info(outMessages); await InvokeAsync(StateHasChanged); percLoading = 0; TotalMb = 0; @@ -206,6 +208,8 @@ namespace MP.Land.Pages authList.Add(item); } } + Log.Info($"Verifica App: {authList.Count} autorizzate"); + // recupero conf files foreach (var item in authList) @@ -215,20 +219,26 @@ namespace MP.Land.Pages await Task.Delay(1); await InvokeAsync(StateHasChanged); } + Log.Info($"Recuperato conf Applicazioni"); // recupero i file IOB RecuperaIobConf(); + Log.Info($"Recuperato conf IOB"); // salvo Tab Db come json await SaveDbConfAsJson(); + Log.Info($"Salvato conf DB come json"); // ora creo il file zip PrepareZip(); + Log.Info($"Preparato file ZIP"); // effettuo upload await UploadZip(); + Log.Info($"Completato upload ZIP"); // concludo! stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; outMessages = $"Effettuato Upload backup configurazioni | NumApp: {numApp} | NumTab: {numTab} | NumIob: {numIOB} | {CalcSize(TotalMb)} | {ts.TotalSeconds:N2} s"; + Log.Info(outMessages); await InvokeAsync(StateHasChanged); await Task.Delay(1000); showProgress = false; @@ -492,6 +502,7 @@ namespace MP.Land.Pages // chiamo SendZipFile di SyncService... FileInfo zFileInfo = new FileInfo(zFileName); var fatto = await SyncServ.SendZipFile(LicServ.Applicazione, LicServ.Installazione, true, false, zFileInfo); + Log.Info($"Richiesto invio file | Applicazione: {LicServ.Applicazione} | Installazione: {LicServ.Installazione}"); return fatto; } diff --git a/MP.Land/Program.cs b/MP.Land/Program.cs index 6adef8ec..b0b6a72e 100644 --- a/MP.Land/Program.cs +++ b/MP.Land/Program.cs @@ -26,7 +26,7 @@ namespace MP.Land logging.ClearProviders(); logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace); }) - .UseNLog(); + .UseNLog(new NLogAspNetCoreOptions() { RemoveLoggerFactoryFilter = false }); public static void Main(string[] args) { diff --git a/MP.Land/Properties/launchSettings.json b/MP.Land/Properties/launchSettings.json index 7f84d546..120cd9cd 100644 --- a/MP.Land/Properties/launchSettings.json +++ b/MP.Land/Properties/launchSettings.json @@ -19,7 +19,7 @@ "commandName": "Project", "dotnetRunMessages": "true", "launchBrowser": true, - "applicationUrl": "https://localhost:5001;http://localhost:5000", + "applicationUrl": "https://localhost:5021;http://localhost:5020", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/MP.Land/Resources/ChangeLog.html b/MP.Land/Resources/ChangeLog.html index 006ec204..dc03b505 100644 --- a/MP.Land/Resources/ChangeLog.html +++ b/MP.Land/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo Tablet MAPO - DotNet6 -

Versione: 6.16.2410.2111

+

Versione: 6.16.2410.2117


Note di rilascio:
    diff --git a/MP.Land/Resources/VersNum.txt b/MP.Land/Resources/VersNum.txt index dcd31ace..e706b43e 100644 --- a/MP.Land/Resources/VersNum.txt +++ b/MP.Land/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2410.2111 +6.16.2410.2117 diff --git a/MP.Land/Resources/manifest.xml b/MP.Land/Resources/manifest.xml index f261d8a7..e04e9e48 100644 --- a/MP.Land/Resources/manifest.xml +++ b/MP.Land/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2410.2111 + 6.16.2410.2117 https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html false diff --git a/MP.Land/appsettings.Development.json b/MP.Land/appsettings.Development.json index 5b3b5de7..95f2b1fa 100644 --- a/MP.Land/appsettings.Development.json +++ b/MP.Land/appsettings.Development.json @@ -1,11 +1,11 @@ { - "DetailedErrors": true, - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - }, + //"DetailedErrors": true, + //"Logging": { + // "LogLevel": { + // "Default": "Information", + // "Microsoft": "Warning", + // "Microsoft.Hosting.Lifetime": "Information" + // } + //}, "Environment": "Steam DEV" } \ No newline at end of file diff --git a/MP.Land/appsettings.json b/MP.Land/appsettings.json index 4dcddcfe..0e1f948a 100644 --- a/MP.Land/appsettings.json +++ b/MP.Land/appsettings.json @@ -1,7 +1,9 @@ { + "DetailedErrors": true, "Logging": { "LogLevel": { - "Default": "Information", + "Default": "Trace", + "System": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } @@ -29,7 +31,7 @@ "archiveAboveSize": "1024000", "archiveDateFormat": "HH", "maxArchiveFiles": "60", - "maxArchiveDays": "30" + "maxArchiveDays": "30" }, "logconsole": { "type": "ColoredConsole", diff --git a/MP.Prog/Components/ArchiveStatus.razor b/MP.Prog/Components/ArchiveStatus.razor index 3a994d32..ec156edd 100644 --- a/MP.Prog/Components/ArchiveStatus.razor +++ b/MP.Prog/Components/ArchiveStatus.razor @@ -6,7 +6,7 @@ else {
    -
    diff --git a/MP.Prog/Components/ArchiveStatus.razor.cs b/MP.Prog/Components/ArchiveStatus.razor.cs index 34826bae..301b9255 100644 --- a/MP.Prog/Components/ArchiveStatus.razor.cs +++ b/MP.Prog/Components/ArchiveStatus.razor.cs @@ -92,6 +92,7 @@ namespace MP.Prog.Components protected async Task ForceCheck(int maxHour) { setupMessages.Add("Inizio Analisi Archivio..."); + await InvokeAsync(StateHasChanged); ListRecords = null; await Task.Delay(1); await ArchiveCheck(maxHour); @@ -101,7 +102,8 @@ namespace MP.Prog.Components protected async Task ForceCheckMacchina(string idxMacchina) { - setupMessages.Add("Inizio Analisi Archivio..."); + setupMessages.Add($"Inizio Analisi Archivio | Archivio {idxMacchina}"); + await InvokeAsync(StateHasChanged); ListRecords = null; await Task.Delay(1); await ArchiveSingleCheck(idxMacchina, 0); diff --git a/MP.Prog/Components/CmpTop.razor b/MP.Prog/Components/CmpTop.razor index 1f0cbbad..232870dc 100644 --- a/MP.Prog/Components/CmpTop.razor +++ b/MP.Prog/Components/CmpTop.razor @@ -1,10 +1,4 @@ -@using MP.Prog.Components -@using System.Security.Claims -@*@using Microsoft.AspNetCore.Components.Authorization*@ -@using MP.Prog.Data - -@inject MessageService AppMessages -@*@inject AuthenticationStateProvider AuthenticationStateProvider*@ +
    diff --git a/MP.Prog/Components/CmpTop.razor.cs b/MP.Prog/Components/CmpTop.razor.cs index f16753f0..454a0a5b 100644 --- a/MP.Prog/Components/CmpTop.razor.cs +++ b/MP.Prog/Components/CmpTop.razor.cs @@ -1,5 +1,10 @@ using Microsoft.AspNetCore.Components; using System.Threading.Tasks; +//using MP.Prog.Components; +//using System.Security.Claims; + +//using Microsoft.AspNetCore.Components.Authorization; +using MP.Prog.Data; namespace MP.Prog.Components { @@ -12,6 +17,8 @@ namespace MP.Prog.Components AppMessages.EA_PageUpdated -= OnPageUpdate; } + //[Inject] + //protected AuthenticationStateProvider AuthenticationStateProvider { get; set; } public void OnPageUpdate() { PageName = AppMessages.PageName; @@ -24,6 +31,13 @@ namespace MP.Prog.Components #endregion Public Methods + #region Protected Properties + + [Inject] + protected MessageService AppMessages { get; set; } + + #endregion Protected Properties + #region Protected Methods protected override void OnInitialized() diff --git a/MP.Prog/MP.Prog.csproj b/MP.Prog/MP.Prog.csproj index cefd3356..2c515213 100644 --- a/MP.Prog/MP.Prog.csproj +++ b/MP.Prog/MP.Prog.csproj @@ -3,7 +3,7 @@ net6.0 MP.Prog - 6.16.2410.2115 + 6.16.2410.2116 diff --git a/MP.Prog/Resources/ChangeLog.html b/MP.Prog/Resources/ChangeLog.html index 44f56e3a..dc5c645b 100644 --- a/MP.Prog/Resources/ChangeLog.html +++ b/MP.Prog/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo gestione Programmi MAPO -

    Versione: 6.16.2410.2115

    +

    Versione: 6.16.2410.2116


    Note di rilascio:
      diff --git a/MP.Prog/Resources/VersNum.txt b/MP.Prog/Resources/VersNum.txt index eeaf1961..7c94c9f8 100644 --- a/MP.Prog/Resources/VersNum.txt +++ b/MP.Prog/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2410.2115 +6.16.2410.2116 diff --git a/MP.Prog/Resources/manifest.xml b/MP.Prog/Resources/manifest.xml index 05e61c2a..b774c00c 100644 --- a/MP.Prog/Resources/manifest.xml +++ b/MP.Prog/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2410.2115 + 6.16.2410.2116 https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/MP.Prog.zip https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/ChangeLog.html false