Lettura BTL e rappresentazione svg per Aedifica

This commit is contained in:
Emmanuele Sassi
2025-08-07 14:35:19 +02:00
parent 74b4264539
commit 08c94fddcb
8 changed files with 166 additions and 46 deletions
+4 -2
View File
@@ -3,8 +3,10 @@
<PageTitle>Aedifica</PageTitle>
<WebAedificaMaker EC_OnSave="SaveText">
<WebAedificaMaker
EC_OnSave="SaveText"
LiveSVG="@currSvg">
</WebAedificaMaker>
<p>@currText</p>
@* <p>@currText</p> *@
+81 -6
View File
@@ -1,12 +1,87 @@
namespace Test.UI.Components.Pages
using EgwCoreLib.Lux.Core;
using EgwCoreLib.Lux.Core.RestPayload;
using EgwCoreLib.Lux.Data.Services;
using Microsoft.AspNetCore.Components;
using Newtonsoft.Json;
namespace Test.UI.Components.Pages
{
public partial class Aedifica
public partial class Aedifica : IDisposable
{
protected string currText = "...";
private async Task SaveText(string newText)
private string subChannel = "";
private string CalcUid = "Pizza";
private string currSvg = "";
private string apiUrl = "";
private string calcTag = "";
private string GenericBasePath = "";
[Inject]
protected IConfiguration Config { get; set; } = null!;
[Inject]
protected DataLayerServices DLService { get; set; } = null!;
[Inject]
protected ImageCacheService ICService { get; set; } = null!;
public void Dispose()
{
currText = newText;
await Task.Delay(100);
DLService.CalcDonePipe.EA_NewMessage -= CalcDonePipe_EA_NewMessage;
}
protected MarkupString JsonSer
{
get => (MarkupString)currSvg.Replace(Environment.NewLine, "<br/>").Replace(" ", "&nbsp;");
}
protected Dictionary<string, string> m_CurrArgs = new Dictionary<string, string>();
protected override async Task OnInitializedAsync()
{
ConfInit();
DLService.CalcDonePipe.EA_NewMessage += CalcDonePipe_EA_NewMessage;
//await ReloadData();
await Task.Delay(1);
}
private void ConfInit()
{
apiUrl = Config.GetValue<string>("ServerConf:Prog.ApiUrl") ?? "";
GenericBasePath = Config.GetValue<string>("ServerConf:GenericBaseUrl") ?? "";
//imgTag = Config.GetValue<string>("ServerConf:ImageFileTag") ?? "";
calcTag = Config.GetValue<string>("ServerConf:CalcTag") ?? "";
subChannel = Config.GetValue<string>("ServerConf:SvgChannel") ?? "";
}
private async Task SaveText(Dictionary<string, string> CurrArgs)
{
m_CurrArgs = CurrArgs;
// chiamo la chiamata POST alla API, che manda la richiesta via REDIS
if (m_CurrArgs != null)
{
CalcRequestDTO calcRequestDTO = new CalcRequestDTO();
calcRequestDTO.EnvType = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.BEAM;
calcRequestDTO.DictExec = m_CurrArgs;
await ICService.CallRestPost($"{apiUrl}/{GenericBasePath}", $"{calcTag}/{CalcUid}", calcRequestDTO);
}
}
private async void CalcDonePipe_EA_NewMessage(object? sender, EventArgs e)
{
// aggiorno visualizzazione
PubSubEventArgs currArgs = (PubSubEventArgs)e;
// conversione on-the-fly SVG da mostrare
if (!string.IsNullOrEmpty(currArgs.newMessage))
{
if (currArgs.msgUid.Equals($"{subChannel}:{CalcUid}"))
{
currSvg = currArgs.newMessage;
}
await InvokeAsync(StateHasChanged);
}
await Task.Delay(1);
}
}
}
+3 -2
View File
@@ -140,7 +140,8 @@ namespace Test.UI.Components.Pages
// calcolo URL immagini... DTO interno da rivedere?
foreach (var item in rawList)
{
item.ImageUrl = ICService.ImageUrl(imgBasePath, false, item.SVGFileName);
item.ImageUrl = ICService.ImageUrl($"{apiUrl}/{imgBasePath}", false, item.SVGFileName);
//item.ImageUrl = ICService.ImageUrl(imgBasePath, false, item.SVGFileName);
AvailTemplateList.Add(item);
}
}
@@ -152,7 +153,7 @@ namespace Test.UI.Components.Pages
// chiamo la chiamata POST alla API, che manda la richiesta via REDIS
if (currSel != null)
{
await ICService.CallRestPost(apiUrl, $"{calcTag}/{windowUid}", currJwd);
await ICService.CallRestPost($"{apiUrl}/{imgBasePath}", $"{calcTag}/{windowUid}", currJwd);
}
}
@@ -140,7 +140,7 @@ namespace Test.UI.Components.Pages
// calcolo URL immagini... DTO interno da rivedere?
foreach (var item in rawList)
{
item.ImageUrl = ICService.ImageUrl(imgBasePath, false, item.SVGFileName);
item.ImageUrl = ICService.ImageUrl($"{apiUrl}/{imgBasePath}", false, item.SVGFileName);
AvailTemplateList.Add(item);
}
}
@@ -152,7 +152,7 @@ namespace Test.UI.Components.Pages
// chiamo la chiamata POST alla API, che manda la richiesta via REDIS
if (currSel != null)
{
await ICService.CallRestPost(apiUrl, $"{calcTag}/{windowUid}", currJwd);
await ICService.CallRestPost($"{apiUrl}/{imgBasePath}", $"{calcTag}/{windowUid}", currJwd);
}
}
+2 -2
View File
@@ -28,8 +28,8 @@
<ProjectReference Include="..\Test.UI.Client\Test.UI.Client.csproj" />
<ProjectReference Include="..\WebAedificaConfigurator\WebAedificaConfigurator.csproj" />
<ProjectReference Include="..\WebWindowConfigurator\WebWindowConfigurator.csproj" />
<PackageReference Include="EgwCoreLib.Lux.Core" Version="0.9.2508.615" />
<PackageReference Include="EgwCoreLib.Lux.Data" Version="0.9.2508.615" />
<PackageReference Include="EgwCoreLib.Lux.Core" Version="0.9.2508.712" />
<PackageReference Include="EgwCoreLib.Lux.Data" Version="0.9.2508.712" />
<PackageReference Include="EgwCoreLib.Razor" Version="1.5.2507.1815" />
<PackageReference Include="EgwCoreLib.Utils" Version="1.5.2507.1815" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.17" />
+12 -10
View File
@@ -9,14 +9,16 @@
"ConnectionStrings": {
"Redis": "redis.ufficio:26379, serviceName=devel, DefaultDatabase=6, keepAlive=180, connectTimeout=15000, syncTimeout=15000, asyncTimeout=15000, abortConnect=false, ssl=false, allowAdmin=true"
},
"ServerConf": {
"PubChannel": "EgwEngineInput",
"SubChannel": "EgwEngineOutput",
"SvgChannel": "svg:img",
"Prog.ApiUrl": "https://iis01.egalware.com/lux/srv/api/window",
"ImageBaseUrl": "https://iis01.egalware.com/lux/srv/api/window",
"ImageLiveTag": "svg",
"ImageFileTag": "svgfile",
"ImageCalcTag": "svg-preview"
}
"ServerConf": {
"PubChannel": "EgwEngineInput",
"SubChannel": "EgwEngineOutput",
"SvgChannel": "svg:img",
"Prog.ApiUrl": "https://iis01.egalware.com/lux/srv/api",
"ImageBaseUrl": "window",
"GenericBaseUrl": "generic",
"ImageLiveTag": "svg",
"ImageFileTag": "svgfile",
"ImageCalcTag": "svg-preview",
"CalcTag": "calc"
}
}