65ed2bb93a
- 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
152 lines
7.3 KiB
Plaintext
152 lines
7.3 KiB
Plaintext
@* 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">
|
|
<i class="fas fa-save"></i> Salva Configurazione Corrente
|
|
</h6>
|
|
</div>
|
|
<div class="card-body">
|
|
@if (!ShowSaveForm)
|
|
{
|
|
<button type="button" class="btn btn-success" @onclick="ShowSaveDialog" disabled="@(!CanSave)">
|
|
<i class="fas fa-plus"></i> Salva come Nuovo Profilo
|
|
</button>
|
|
@if (!CanSave)
|
|
{
|
|
<small class="text-muted d-block mt-1">
|
|
<i class="fas fa-info-circle"></i>
|
|
Configura fonte e destinazione per abilitare il salvataggio
|
|
</small>
|
|
}
|
|
}
|
|
else
|
|
{
|
|
<EditForm Model="ProfileData" OnValidSubmit="SaveProfile">
|
|
<DataAnnotationsValidator />
|
|
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="mb-3">
|
|
<label class="form-label">Nome Profilo <span class="text-danger">*</span></label>
|
|
<InputText @bind-Value="ProfileData.Name" class="form-control"
|
|
placeholder="Es: Export Clienti a CRM" />
|
|
<ValidationMessage For="@(() => ProfileData.Name)" />
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="mb-3">
|
|
<label class="form-label">Descrizione</label>
|
|
<InputText @bind-Value="ProfileData.Description" class="form-control"
|
|
placeholder="Descrizione opzionale del profilo" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@if (!string.IsNullOrEmpty(SaveMessage))
|
|
{
|
|
<div class="alert alert-@(SaveMessageType) mb-3">
|
|
<i class="fas fa-@(SaveMessageType == "success" ? "check-circle" : "exclamation-triangle")"></i>
|
|
@SaveMessage
|
|
</div>
|
|
}
|
|
|
|
<!-- Anteprima Configurazione -->
|
|
<div class="mb-3">
|
|
<label class="form-label">Configurazione da salvare:</label>
|
|
<div class="bg-light p-3 rounded small">
|
|
<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 />
|
|
}
|
|
@if (!string.IsNullOrEmpty(SourceTable))
|
|
{
|
|
<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 />
|
|
}
|
|
@if (!string.IsNullOrEmpty(DestinationTable))
|
|
{
|
|
<span class="text-muted">Tabella: @DestinationTable</span>
|
|
}
|
|
@if (!string.IsNullOrEmpty(DestinationEndpoint))
|
|
{
|
|
<span class="text-muted">Endpoint: @DestinationEndpoint</span>
|
|
}
|
|
</div>
|
|
</div>
|
|
@if (FieldMappings != null && FieldMappings.Any())
|
|
{
|
|
<hr class="my-2" />
|
|
<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>
|
|
|
|
<div class="text-end">
|
|
<button type="button" class="btn btn-secondary me-2" @onclick="CancelSave">
|
|
<i class="fas fa-times"></i> Annulla
|
|
</button>
|
|
<button type="submit" class="btn btn-success" disabled="@IsSaving">
|
|
@if (IsSaving)
|
|
{
|
|
<span class="spinner-border spinner-border-sm" role="status"></span>
|
|
}
|
|
else
|
|
{
|
|
<i class="fas fa-save"></i>
|
|
}
|
|
Salva Profilo
|
|
</button>
|
|
</div>
|
|
</EditForm>
|
|
}
|
|
</div>
|
|
</div>
|