Implementato sistema robusto di salvataggio/caricamento profili Data Coupler

- Aggiunto metodo GetCredentialIdByNameAsync in CredentialService per recuperare ID credenziali per nome
- Implementata gestione robusta dei profili duplicati con riattivazione, sovrascrittura e auto-rinomina
- Migliorata logica di caricamento profili con simulazione workflow utente e logging dettagliato
- Fixata gestione errori UNIQUE constraint nel salvataggio profili
- Aggiunto supporto per salvataggio ID credenziali reali invece di placeholder
- Implementato metodo GetProfileByNameIncludingInactiveAsync per gestire profili inattivi
- Aggiunto logging esteso per debug e troubleshooting
- Integrato componente ProfileSaver nella UI principale
- Risolti errori di compilazione e validazione build completa
- Migliorata gestione errori con feedback utente per credenziali/entità mancanti
This commit is contained in:
Alessio Dal Santo
2025-07-03 16:30:57 +02:00
parent d837339f7e
commit 65ed2bb93a
19 changed files with 967 additions and 115 deletions
+40 -4
View File
@@ -1,4 +1,6 @@
@* Componente per salvare la configurazione corrente come profilo *@
@using System.IO
<div class="card mb-3">
<div class="card-header bg-success text-white">
<h6 class="mb-0">
@@ -57,6 +59,10 @@
<div class="row">
<div class="col-md-6">
<strong>Fonte:</strong> @GetSourceSummary()<br />
@if (!string.IsNullOrEmpty(SourceCredentialName))
{
<span class="text-muted">Credenziali: @SourceCredentialName</span><br />
}
@if (!string.IsNullOrEmpty(SourceSchema))
{
<span class="text-muted">Schema: @SourceSchema</span><br />
@@ -65,9 +71,17 @@
{
<span class="text-muted">Tabella: @SourceTable</span>
}
@if (!string.IsNullOrEmpty(SourceFilePath))
{
<span class="text-muted">File: @Path.GetFileName(SourceFilePath)</span>
}
</div>
<div class="col-md-6">
<strong>Destinazione:</strong> @GetDestinationSummary()<br />
@if (!string.IsNullOrEmpty(DestinationCredentialName))
{
<span class="text-muted">Credenziali: @DestinationCredentialName</span><br />
}
@if (!string.IsNullOrEmpty(DestinationSchema))
{
<span class="text-muted">Schema: @DestinationSchema</span><br />
@@ -85,10 +99,32 @@
@if (FieldMappings != null && FieldMappings.Any())
{
<hr class="my-2" />
<small class="text-muted">
<i class="fas fa-exchange-alt"></i>
@FieldMappings.Count mapping dei campi configurati
</small>
<div class="row">
<div class="col-md-6">
<small class="text-muted">
<i class="fas fa-exchange-alt"></i>
@FieldMappings.Count mapping dei campi configurati
</small>
</div>
<div class="col-md-6">
@if (UseRecordAssociations)
{
<small class="text-info">
<i class="fas fa-sync-alt"></i> Smart Update attivo
@if (!string.IsNullOrEmpty(SourceKeyField))
{
<span> (Chiave: @SourceKeyField)</span>
}
</small>
}
else
{
<small class="text-warning">
<i class="fas fa-plus"></i> Solo inserimenti
</small>
}
</div>
</div>
}
</div>
</div>
+9 -1
View File
@@ -9,15 +9,19 @@ public partial class ProfileSaver
[Parameter] public bool CanSave { get; set; }
[Parameter] public string SourceType { get; set; } = "";
[Parameter] public int? SourceCredentialId { get; set; }
[Parameter] public string? SourceCredentialName { get; set; }
[Parameter] public string? SourceSchema { get; set; }
[Parameter] public string? SourceTable { get; set; }
[Parameter] public string? SourceFilePath { get; set; }
[Parameter] public string DestinationType { get; set; } = "";
[Parameter] public int? DestinationCredentialId { get; set; }
[Parameter] public string? DestinationCredentialName { get; set; }
[Parameter] public string? DestinationSchema { get; set; }
[Parameter] public string? DestinationTable { get; set; }
[Parameter] public string? DestinationEndpoint { get; set; }
[Parameter] public List<FieldMappingDto>? FieldMappings { get; set; }
[Parameter] public string? SourceKeyField { get; set; }
[Parameter] public bool UseRecordAssociations { get; set; }
[Parameter] public EventCallback<DataCouplerProfileDto> OnProfileSaved { get; set; }
private bool ShowSaveForm { get; set; } = false;
@@ -53,15 +57,19 @@ public partial class ProfileSaver
Description = ProfileData.Description,
SourceType = SourceType,
SourceCredentialId = SourceCredentialId,
SourceCredentialName = SourceCredentialName,
SourceSchema = SourceSchema,
SourceTable = SourceTable,
SourceFilePath = SourceFilePath,
DestinationType = DestinationType,
DestinationCredentialId = DestinationCredentialId,
DestinationCredentialName = DestinationCredentialName,
DestinationSchema = DestinationSchema,
DestinationTable = DestinationTable,
DestinationEndpoint = DestinationEndpoint,
FieldMappings = FieldMappings
FieldMappings = FieldMappings,
SourceKeyField = SourceKeyField,
UseRecordAssociations = UseRecordAssociations
};
await OnProfileSaved.InvokeAsync(profileDto);