diff --git a/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Shared/Uns/ImportEquipmentModal.razor b/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Shared/Uns/ImportEquipmentModal.razor index 5de472e7..e6cf2cf4 100644 --- a/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Shared/Uns/ImportEquipmentModal.razor +++ b/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Shared/Uns/ImportEquipmentModal.razor @@ -30,6 +30,7 @@ +
Simple comma-separated values only — fields containing commas are not supported.
@if (!string.IsNullOrWhiteSpace(_parseError)) { @@ -91,16 +92,18 @@ private bool _busy; private string? _parseError; private EquipmentImportResult? _result; + private bool _wasVisible; protected override void OnParametersSet() { - // Reset the working state each time the host (re)opens the modal. - if (!Visible) + // Reset only on the false→true transition so that re-renders while open don't wipe state. + if (Visible && !_wasVisible) { _csv = ""; _parseError = null; _result = null; } + _wasVisible = Visible; } private async Task ImportAsync() @@ -154,6 +157,7 @@ var rows = new List(); for (var lineIdx = 1; lineIdx < lines.Length; lineIdx++) { + // NOTE: simple comma split — no RFC4180 quoting; values with commas are not supported. var parts = lines[lineIdx].Split(',').Select(c => c.Trim()).ToArray(); if (parts.Length < RequiredColumns.Length) { diff --git a/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Uns/UnsTreeService.cs b/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Uns/UnsTreeService.cs index f6975a48..0a2a4864 100644 --- a/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Uns/UnsTreeService.cs +++ b/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Uns/UnsTreeService.cs @@ -575,7 +575,8 @@ public sealed class UnsTreeService(IDbContextFactory dbF inserted++; } - await db.SaveChangesAsync(ct); + if (inserted > 0) + await db.SaveChangesAsync(ct); return new EquipmentImportResult(inserted, skipped, errors); }