feat(uns): equipment CSV import folded into the tree toolbar

This commit is contained in:
Joseph Doherty
2026-06-08 13:56:01 -04:00
parent c0346f14ce
commit 7db9a24403
5 changed files with 515 additions and 1 deletions
@@ -21,7 +21,7 @@
@bind="_filter" @bind:event="oninput" />
<button type="button" class="btn btn-outline-secondary btn-sm" @onclick="ExpandAll">Expand all</button>
<button type="button" class="btn btn-outline-secondary btn-sm" @onclick="CollapseAll">Collapse all</button>
<button type="button" class="btn btn-outline-primary btn-sm" disabled>Import equipment CSV</button>
<button type="button" class="btn btn-outline-primary btn-sm" @onclick="OpenImportModal">Import equipment CSV</button>
</div>
</div>
@@ -89,6 +89,10 @@
OnSaved="OnEquipmentChildModalSavedAsync"
OnCancel="CloseModals" />
<ImportEquipmentModal Visible="_importModalVisible"
OnImported="OnImportedAsync"
OnCancel="CloseModals" />
@if (_confirmNode is not null)
{
<div class="modal-backdrop fade show" style="display:block"></div>
@@ -158,6 +162,9 @@
private VirtualTagEditDto? _vtagModalExisting;
private IReadOnlyList<(string Id, string Display)> _vtagModalScriptOptions = Array.Empty<(string, string)>();
// --- Import-equipment-CSV modal state ---
private bool _importModalVisible;
// --- Owning equipment to refresh in place after a tag/virtual-tag mutation ---
private string? _childRefreshEquipmentId;
@@ -357,6 +364,24 @@
}
}
/// <summary>Opens the bulk equipment-CSV import modal.</summary>
private void OpenImportModal()
{
CloseModals();
_importModalVisible = true;
}
/// <summary>
/// Handles the import modal's close after a run. A bulk import can add equipment across many
/// lines and clusters, so the whole structural tree is reloaded rather than refreshed in place.
/// </summary>
private async Task OnImportedAsync()
{
_roots = await Svc.LoadStructureAsync();
CloseModals();
StateHasChanged();
}
/// <summary>Opens the delete-confirm modal for a node, stashing it as the pending target.</summary>
private void HandleDelete(UnsNode node)
{
@@ -549,6 +574,7 @@
_vtagModalExisting = null;
_vtagModalEquipmentId = null;
_vtagModalScriptOptions = Array.Empty<(string, string)>();
_importModalVisible = false;
_childRefreshEquipmentId = null;
_confirmNode = null;
_confirmError = null;