Update x gestione configurazione aprametri di traduzione nome da tipo file report

This commit is contained in:
Samuele Locatelli
2026-04-24 15:57:49 +02:00
parent fabfeb7a08
commit e416f5c3d4
25 changed files with 298 additions and 28 deletions
+27
View File
@@ -0,0 +1,27 @@
namespace EgwCoreLib.Lux.Core.Dto
{
public class ParamConfigDto
{
/// <summary>
/// Nome parametro
/// </summary>
public string Name { get; set; } = "fix";
/// <summary>
/// Tipo parametro:
/// - fix (fisso)
/// - url (prende da URL QueryString)
/// </summary>
public string Type { get; set; } = "fix";
/// <summary>
/// Per recuperare da ingresso (es URL)
/// </summary>
public string vIN { get; set; } = "";
/// <summary>
/// Valore out (da passare come apram x report)
/// </summary>
public string vOUT { get; set; } = "";
}
}
@@ -0,0 +1,70 @@
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace EgwCoreLib.Lux.Data.DbModel.Report
{
/// <summary>
/// Classe dei report gestiti
/// </summary>
[Table("report_list")]
public class ReportModel
{
/// <summary>
/// ID del record
/// </summary>
[Key]
public int ReportID { get; set; }
/// <summary>
/// Denominazione
/// </summary>
public string Name { get; set; } = "";
/// <summary>
/// Descrizione
/// </summary>
public string Description { get; set; } = "";
/// <summary>
/// Valore completo Json per recupero dati, con segnaposto con [[param_01]]
/// </summary>
public string JsonDSN { get; set; } = "";
/// <summary>
/// Nome del report Active tra quelli nella folder
/// </summary>
public string ActRepFileName { get; set; } = "";
/// <summary>
/// Conf dei parametri per il report
/// </summary>
public string ParamConfigRaw { get; set; } = "";
/// <summary>
/// Conf relative ai file report
/// </summary>
public string FileConfDataRaw { get; set; } = "";
/// <summary>
/// Elenco dei parametri da gestire x il ReportTemplate
/// </summary>
[NotMapped]
public List<ParamConfigDto> ParamConfig
{
get
{
List<ParamConfigDto> answ = new();
if (!string.IsNullOrEmpty(ParamConfigRaw) && ParamConfigRaw.Length > 2)
{
answ = JsonConvert.DeserializeObject<List<ParamConfigDto>>(ParamConfigRaw) ?? new();
}
return answ;
}
set
{
string rawVal = JsonConvert.SerializeObject(value);
ParamConfigRaw = rawVal;
}
}
}
}
+2 -1
View File
@@ -1,4 +1,5 @@
global using EgwCoreLib.Lux.Core.RestPayload;
global using EgwCoreLib.Lux.Core.Dto;
global using EgwCoreLib.Lux.Core.RestPayload;
global using EgwCoreLib.Lux.Data.Data.DbModel.Admin;
global using EgwCoreLib.Lux.Data.DbModel.Catalog;
global using EgwCoreLib.Lux.Data.DbModel.Config;
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>1.1.2604.2413</Version>
<Version>1.1.2604.2414</Version>
</PropertyGroup>
<ItemGroup>
+5 -5
View File
@@ -1,11 +1,6 @@
using Lux.Report.Data.DTO;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Lux.Report.Data.DbModel
{
@@ -46,6 +41,11 @@ namespace Lux.Report.Data.DbModel
/// </summary>
public string ParamConfigRaw { get; set; } = "";
/// <summary>
/// Conf relative ai file report
/// </summary>
public string FileConfDataRaw { get; set; } = "";
/// <summary>
/// Elenco dei parametri da gestire x il ReportTemplate
/// </summary>
@@ -0,0 +1,66 @@
// <auto-generated />
using Lux.Report.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Lux.Report.Data.Migrations
{
[DbContext(typeof(ReportContext))]
[Migration("20260424130010_AddReportFileConf")]
partial class AddReportFileConf
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.23")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
modelBuilder.Entity("Lux.Report.Data.DbModel.ReportModel", b =>
{
b.Property<int>("ReportID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ReportID"));
b.Property<string>("ActRepFileName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("FileConfDataRaw")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("JsonDSN")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("ParamConfigRaw")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("ReportID");
b.ToTable("report_list");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Lux.Report.Data.Migrations
{
/// <inheritdoc />
public partial class AddReportFileConf : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "FileConfDataRaw",
table: "report_list",
type: "longtext",
nullable: false)
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "FileConfDataRaw",
table: "report_list");
}
}
}
@@ -37,6 +37,10 @@ namespace Lux.Report.Data.Migrations
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("FileConfDataRaw")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("JsonDSN")
.IsRequired()
.HasColumnType("longtext");
+1
View File
@@ -11,6 +11,7 @@
<link rel="stylesheet" href="app.css" />
<link rel="stylesheet" href="Lux.Report.Manager.styles.css" />
<link rel="icon" type="image/png" href="favicon.png" />
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico" />
@* <HeadOutlet /> *@
<HeadOutlet @rendermode="@(new InteractiveServerRenderMode(prerender: false))" />
</head>
@@ -8,12 +8,12 @@
<div class="px-0">
@if (AddEnabled)
{
<button class="btn btn-success" title="Add New" @onclick="DoAddNew"><i class="fa-solid fa-file-circle-plus"></i></button>
<button class="btn btn-success" title="Add New" @onclick="DoAddNew"><i class="fa-solid fa-file-circle-plus"></i></button>
}
else
else
{
<button class="btn btn-secondary disabled" title="Template missing"><i class="fa-solid fa-file-circle-plus"></i></button>
<button class="btn btn-secondary disabled" title="Template missing"><i class="fa-solid fa-file-circle-plus"></i></button>
}
</div>
</div>
@@ -23,18 +23,33 @@
<tbody>
@foreach (var item in ListReports)
{
<tr>
<td class="">
<tr class="row px-2">
<td class="col-2">
<button class="btn btn-primary" @onclick="() => ReqEdit(item)">
<div class="px-0"><i class="fa-solid fa-up-right-from-square"></i></div>
</button>
</td>
<td class="text-start align-middle">
<td class="col-8 text-start align-middle">
<div class="d-flex justify-content-between ">
<div class="px-0">@FileName(item)</div>
</div>
@if (!string.IsNullOrEmpty(aliasKey) && FileName(item) == aliasKey)
{
<div class="input-group input-group-sm">
<button class="btn btn-outline-primary" @onclick="SaveEditAlias"><i class="fa-solid fa-pen"></i></button>
<input type="text" class="form-control" @bind="@aliasVal">
<button class="btn btn-outline-warning" @onclick="() => CancelEditAlias(item)"><i class="fa-solid fa-ban"></i></button>
</div>
}
else
{
<div class="input-group input-group-sm small">
<button class="btn btn-outline-primary" @onclick="() => SetEditAlias(item)"><i class="fa-solid fa-pen"></i></button>
<div class="form-control">@GetAlias(FileName(item))</div>
</div>
}
</td>
<td class=" text-end">
<td class="col-2 text-end">
<button class="btn btn-danger" @onclick="() => DoDelete(item)">
<i class="fa-solid fa-trash"></i>
</button>
@@ -2,6 +2,7 @@ using Lux.Report.Data.DbModel;
using Lux.Report.Data.Services;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using Newtonsoft.Json;
namespace Lux.Report.Manager.Components.Compo
{
@@ -17,6 +18,8 @@ namespace Lux.Report.Manager.Components.Compo
[Parameter]
public EventCallback<bool> EC_ReqUpdate { get; set; }
[Parameter]
public EventCallback<Dictionary<string, string>> EC_SaveDict { get; set; }
#endregion Public Properties
@@ -31,6 +34,7 @@ namespace Lux.Report.Manager.Components.Compo
#region Private Fields
private Dictionary<string, string> DictAlias = new();
private List<string> ListReports = new List<string>();
#endregion Private Fields
@@ -96,12 +100,56 @@ namespace Lux.Report.Manager.Components.Compo
return Path.GetFileName(fullName);
}
private void SetEditAlias(string fullName)
{
aliasKey = Path.GetFileName(fullName);
aliasVal = GetAlias(aliasKey);
}
private void CancelEditAlias(string fullName)
{
aliasKey = "";
}
private string aliasKey = "";
private string aliasVal = "";
private async Task SaveEditAlias()
{
if (!string.IsNullOrEmpty(aliasKey))
{
if (DictAlias.ContainsKey(aliasKey))
{
DictAlias[aliasKey] = aliasVal;
}
else
{
DictAlias.Add(aliasKey, aliasVal);
}
await EC_SaveDict.InvokeAsync(DictAlias);
}
}
private string GetAlias(string alias)
{
// cerco nel dizionario...
if (DictAlias.ContainsKey(alias))
{
alias = DictAlias[alias];
}
return alias;
}
private void ReloadData()
{
//base.OnParametersSet();
string repPath = Path.Combine("reports", CurrReport.Name);
// elenco file esclusi quelli nascosti (template)
ListReports = FService.ListFile(repPath, "*.repx", true);
// fix alias disponibili
if (!string.IsNullOrEmpty(CurrReport.FileConfDataRaw))
{
DictAlias = JsonConvert.DeserializeObject<Dictionary<string, string>>(CurrReport.FileConfDataRaw) ?? new();
}
}
private async Task ReqEdit(string fullPath)
@@ -1,8 +0,0 @@
@page "/Home"
<PageTitle>ReportManager</PageTitle>
<h1>Lux Report Manager</h1>
Lux Report Manager Landing Page
@@ -1,4 +1,5 @@
@page "/"
@page "/Home"
@page "/report-man"
@@ -1,6 +1,7 @@
using Lux.Report.Data.DbModel;
using Lux.Report.Data.Services;
using Microsoft.AspNetCore.Components;
using Newtonsoft.Json;
namespace Lux.Report.Manager.Components.Pages
{
@@ -158,5 +159,19 @@ namespace Lux.Report.Manager.Components.Pages
}
#endregion Private Methods
private async Task DoSaveDict(Dictionary<string, string> currDict)
{
if (SelRecord != null)
{
// serializzo nel record corrente
string rawDict = JsonConvert.SerializeObject(currDict);
SelRecord.FileConfDataRaw = rawDict;
// salvo!
await RepService.UpsertAsync(SelRecord);
}
await ReloadDataAsync();
UpdateTable();
}
}
}
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>1.1.2604.2316</Version>
<Version>1.1.2604.2415</Version>
</PropertyGroup>
<ItemGroup>
Binary file not shown.

After

Width:  |  Height:  |  Size: 746 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 13 KiB

+1
View File
@@ -11,6 +11,7 @@
<link rel="stylesheet" href="app.css" />
<link rel="stylesheet" href="Lux.Report.Server.styles.css" />
<link rel="icon" type="image/png" href="favicon.png" />
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico" />
@* <HeadOutlet /> *@
<HeadOutlet @rendermode="@(new InteractiveServerRenderMode(prerender: false))" />
</head>
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>1.1.2604.2409</Version>
<Version>1.1.2604.2415</Version>
</PropertyGroup>
<ItemGroup>
Binary file not shown.

After

Width:  |  Height:  |  Size: 750 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-Lux.UI-a758c101-a2f4-4e38-977d-1c4887dbbd50</UserSecretsId>
<Version>1.1.2604.2413</Version>
<Version>1.1.2604.2414</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>LUX - Web Windows MES</i>
<h4>Versione: 1.1.2604.2413</h4>
<h4>Versione: 1.1.2604.2415</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.1.2604.2413
1.1.2604.2415
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.1.2604.2413</version>
<version>1.1.2604.2415</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>