Fix metodi ImageCache x minro fix
This commit is contained in:
@@ -32,6 +32,13 @@ namespace EgwCoreLib.Lux.Data.Services
|
||||
_config = Configuration;
|
||||
_redisConn = RedisConn;
|
||||
_redisDb = _redisConn.GetDatabase();
|
||||
// configuro la base key x la cache Redis, con verifica contenga Cache finale
|
||||
_redisBaseKey = _config.GetValue<string>("ServerConf:RedisBaseKey") ?? "Lux:Cache";
|
||||
// aggiungo cache se non finisse per ":cache"
|
||||
if (!_redisBaseKey.EndsWith(":Cache"))
|
||||
{
|
||||
_redisBaseKey += ":Cache";
|
||||
}
|
||||
// setup tracing
|
||||
// Verifica conf trace...
|
||||
_traceEnabled = _config.GetValue<bool>("Otel:EnableTracing", false);
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace EgwCoreLib.Lux.Data.Services.General
|
||||
// imposto
|
||||
_serviceProvider = serviceProvider;
|
||||
_db = redisConn.GetDatabase();
|
||||
_base = rBaseKey.TrimEnd(':');
|
||||
_redisBaseKey = rBaseKey.TrimEnd(':');
|
||||
_retention = TimeSpan.FromDays(dayTTL);
|
||||
_archivePeriod = TimeSpan.FromDays(archTTL);
|
||||
Log.Info($"CalcRuidService | Started");
|
||||
@@ -917,7 +917,7 @@ namespace EgwCoreLib.Lux.Data.Services.General
|
||||
|
||||
private readonly TimeSpan _archivePeriod;
|
||||
|
||||
private readonly string _base;
|
||||
private readonly string _redisBaseKey;
|
||||
|
||||
private readonly IDatabase _db;
|
||||
|
||||
@@ -990,7 +990,7 @@ namespace EgwCoreLib.Lux.Data.Services.General
|
||||
|
||||
private RedisKey GetUidSetKey(string uid) => Key($"uid:{uid}:requests");
|
||||
|
||||
private RedisKey Key(string suffix) => (RedisKey)($"{_base}:RUID:{suffix}");
|
||||
private RedisKey Key(string suffix) => (RedisKey)($"{_redisBaseKey}:RUID:{suffix}");
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
|
||||
@@ -109,15 +109,6 @@ namespace EgwCoreLib.Lux.Data.Services.General
|
||||
/// <returns>True se pubblicato con successo</returns>
|
||||
Task<bool> PublishUpdateAsync(string uid, Constants.EXECENVIRONMENTS env);
|
||||
|
||||
/// <summary>
|
||||
/// Calcola URL immagine per richiesta di update SVG
|
||||
/// </summary>
|
||||
/// <param name="baseUrl">Base url IMG server</param>
|
||||
/// <param name="imgUID">UID elemento/immagine</param>
|
||||
/// <param name="serJwd">JWD serializzato per calcolo</param>
|
||||
/// <returns>URL per richiesta update</returns>
|
||||
string ReqUpdateSvg(string baseUrl, string imgUID, string serJwd);
|
||||
|
||||
/// <summary>
|
||||
/// Salva e invia su channel BOM redis il doc richiesto
|
||||
/// </summary>
|
||||
|
||||
@@ -198,29 +198,15 @@ namespace EgwCoreLib.Lux.Data.Services.General
|
||||
if (imgUID.EndsWith(".svg"))
|
||||
{
|
||||
fType = "svg";
|
||||
imgUID.Replace(".svg", "");
|
||||
imgUID = Path.GetFileNameWithoutExtension(imgUID);
|
||||
}
|
||||
else if (imgUID.EndsWith(".png"))
|
||||
{
|
||||
fType = "png";
|
||||
imgUID.Replace(".png", "");
|
||||
imgUID = Path.GetFileNameWithoutExtension(imgUID);
|
||||
}
|
||||
switch (envir)
|
||||
{
|
||||
case Constants.EXECENVIRONMENTS.NULL:
|
||||
break;
|
||||
|
||||
case Constants.EXECENVIRONMENTS.WINDOW:
|
||||
fType = "svg";
|
||||
break;
|
||||
|
||||
case Constants.EXECENVIRONMENTS.BEAM:
|
||||
case Constants.EXECENVIRONMENTS.WALL:
|
||||
case Constants.EXECENVIRONMENTS.CABINET:
|
||||
default:
|
||||
fType = "png";
|
||||
break;
|
||||
}
|
||||
fType = GetImageExtension(envir);
|
||||
|
||||
string rndImg = $"{DateTime.Now:HHmmssfff}";
|
||||
string fullUrl = $"{baseUrl}/{tag}/{imgUID}-{rndImg}.{fType}?env={envir}".Replace("////", "//");
|
||||
@@ -310,25 +296,6 @@ namespace EgwCoreLib.Lux.Data.Services.General
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calcola URL immagine dato
|
||||
/// </summary>
|
||||
/// <param name="baseUrl">Base url IMG server (da config)</param>
|
||||
/// <param name="imgUID">UID elemento/immagine</param>
|
||||
/// <param name="serJwd">JWD serializzato di cui si richiede l'immagine aggiornata</param>
|
||||
/// <returns></returns>
|
||||
public string ReqUpdateSvg(string baseUrl, string imgUID, string serJwd)
|
||||
{
|
||||
string answ = "";
|
||||
if (imgUID.EndsWith(".svg"))
|
||||
{
|
||||
imgUID.Replace(".svg", "");
|
||||
}
|
||||
string fullUrl = $"{baseUrl}/svg-preview/{imgUID}".Replace("////", "//");
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salva e invia su channel BOM redis il doc richiesto
|
||||
/// </summary>
|
||||
@@ -640,5 +607,23 @@ namespace EgwCoreLib.Lux.Data.Services.General
|
||||
private RestClientOptions restOptStd { get; set; } = new RestClientOptions();
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Switch estensione immagine secondo ambiente: windows SVG; altri casi png
|
||||
/// </summary>
|
||||
/// <param name="envir"></param>
|
||||
/// <returns></returns>
|
||||
private string GetImageExtension(Constants.EXECENVIRONMENTS envir)
|
||||
{
|
||||
return envir switch
|
||||
{
|
||||
Constants.EXECENVIRONMENTS.WINDOW => "svg",
|
||||
_ => "png"
|
||||
};
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>1.1.2603.2407</Version>
|
||||
<Version>1.1.2603.2408</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>aspnet-Lux.UI-a758c101-a2f4-4e38-977d-1c4887dbbd50</UserSecretsId>
|
||||
<Version>1.1.2603.2407</Version>
|
||||
<Version>1.1.2603.2408</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>LUX - Web Windows MES</i>
|
||||
<h4>Versione: 1.1.2603.2407</h4>
|
||||
<h4>Versione: 1.1.2603.2408</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.1.2603.2407
|
||||
1.1.2603.2408
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>1.1.2603.2407</version>
|
||||
<version>1.1.2603.2408</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip</url>
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user