Update LAND x invio zip a LiMan

This commit is contained in:
Samuele Locatelli
2024-10-21 17:41:02 +02:00
parent be16c2ec56
commit 90a3d685b4
19 changed files with 84 additions and 44 deletions
+7
View File
@@ -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
+24 -15
View File
@@ -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<List<UploadResult>>(currResp.Content);
var currList = JsonConvert.DeserializeObject<UploadResult>(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
/// <summary>
/// URL dell'API x chiamate gestione licenze
/// </summary>
#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/";
/// <summary>
/// Classe logger
@@ -247,7 +256,7 @@ namespace MP.Land.Data
/// - base URI al sito
/// - timeout 1 min
/// </summary>
private static RestClientOptions restOptStd = new RestClientOptions { Timeout = TimeSpan.FromSeconds(60), BaseUrl = new Uri(apiUrl) };
private RestClientOptions restOptStd { get; set; } = new RestClientOptions();
#endregion Private Fields
}
+2 -1
View File
@@ -3,7 +3,8 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>MP.Land</RootNamespace>
<Version>6.16.2410.2111</Version>
<Version>6.16.2410.2117</Version>
<Configurations>Debug;Release;Debug_LiManDebug</Configurations>
</PropertyGroup>
<ItemGroup>
+11
View File
@@ -182,10 +182,12 @@ namespace MP.Land.Pages
/// </summary>
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;
}
+1 -1
View File
@@ -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)
{
+1 -1
View File
@@ -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"
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo Tablet MAPO - DotNet6</i>
<h4>Versione: 6.16.2410.2111</h4>
<h4>Versione: 6.16.2410.2117</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
6.16.2410.2111
6.16.2410.2117
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2410.2111</version>
<version>6.16.2410.2117</version>
<url>https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+8 -8
View File
@@ -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"
}
+4 -2
View File
@@ -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",
+1 -1
View File
@@ -6,7 +6,7 @@
else
{
<div class="col-4">
<button id="btnForceCheck" class="btn btn-success btn-sm w-100" @onclick="AddNew" title="Forza verifica archivio (totale)">
<button id="btnForceCheck" class="btn btn-success btn-sm w-100" @onclick="AddNew" title="Aggiunta nuova Directory da monitorare">
<i class="fas fa-folder-plus"></i> Aggiunta Folder <i class="fas fa-folder-plus"></i>
</button>
</div>
+3 -1
View File
@@ -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);
+1 -7
View File
@@ -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*@
<div class="d-flex justify-content-between pt-3">
<div class="px-2 d-none d-lg-block text-center h4 text-truncate">
+14
View File
@@ -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()
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>MP.Prog</RootNamespace>
<Version>6.16.2410.2115</Version>
<Version>6.16.2410.2116</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo gestione Programmi MAPO</i>
<h4>Versione: 6.16.2410.2115</h4>
<h4>Versione: 6.16.2410.2116</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
6.16.2410.2115
6.16.2410.2116
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2410.2115</version>
<version>6.16.2410.2116</version>
<url>https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/MP.Prog.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>