This commit is contained in:
Annamaria Sassi
2025-08-07 14:45:07 +02:00
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"
}
}
+26 -19
View File
@@ -1,22 +1,29 @@
<div class="card text-center">
<div class="card-header" style="background-color: #d5f1f2;">
<ul class="nav nav-tabs card-header-tabs">
<li class="nav-item">
File
</li>
</ul>
</div>
<div class="card-body">
<div class="alert alert-light text-center display-4">
<div class="container">
<div class="row">
<div class="mb-3" >
<input type="text" style="height: 30rem" class="form-control" id="exampleFormControlInput1" @bind="@text">
<div class="row">
<div class="col-6">
<div class="card text-center" style="min-height: 50rem">
<div class="card-header" style="background-color: #d5f1f2;">
<ul class="nav nav-tabs card-header-tabs">
<li class="nav-item">
File BTL
</li>
</ul>
</div>
<div class="card-body">
<div class="alert alert-light text-center display-4">
<div class="container">
<div class="row">
<div class="mb-3">
<input type="text" style="height: 30rem" class="form-control" id="exampleFormControlInput1" @bind="@m_FilePath">
<button class="btn btn-lg btn-primary btn-sm" @onclick="DoSave">Save</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-6">
@outSvg
</div>
</div>
@@ -10,13 +10,46 @@ namespace WebAedificaConfigurator
{
public partial class WebAedificaMaker
{
string text = "";
string m_FilePath = "";
string m_sSvg = "";
[Parameter]
public EventCallback<string> EC_OnSave { get; set; }
public EventCallback<Dictionary<string,string>> EC_OnSave { get; set; }
[Parameter]
public string CssSvg { get; set; } = "responsive-svg";
[Parameter]
public string LiveSVG
{
get => m_sSvg;
set => m_sSvg = value;
}
protected async Task DoSave()
{
await EC_OnSave.InvokeAsync(text);
Dictionary<string,string> Args = new Dictionary<string,string>();
Args.Add("FilePath", m_FilePath);
Args.Add("Mode", 1.ToString());
await EC_OnSave.InvokeAsync(Args);
}
/// <summary>
/// Componente SVG da mostrare
/// </summary>
protected MarkupString outSvg
{
get
{
// aggiunta gestione classe svg per posizionamento con costraints
var newSvg = LiveSVG.Replace("<svg", $"<svg class=\"{CssSvg}\"");
return (MarkupString)newSvg;
}
}
private string mainCss
{
get => "col-6";
}
}
}