diff --git a/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Design/TransportImport.razor b/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Design/TransportImport.razor index 2c24a379..8e875109 100644 --- a/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Design/TransportImport.razor +++ b/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Design/TransportImport.razor @@ -206,6 +206,8 @@ var hasBlockers = _preview.Items.Any(i => i.Kind == ConflictKind.Blocker);
Review each artifact in the bundle and choose how it should be applied to this environment. Identical items are skipped automatically; new @@ -245,11 +247,22 @@ @if (item.Kind == ConflictKind.Modified && !string.IsNullOrEmpty(item.FieldDiffJson)) { + var lineDiff = TryExtractLineDiff(item.FieldDiffJson);
@item.FieldDiffJson
+ @if (lineDiff is not null)
+ {
+ @item.FieldDiffJson
+ }
| Source identifier | +Source name | +Map to target | +
|---|---|---|
@rsm.SourceSiteIdentifier |
+ @rsm.SourceSiteName | ++ + | +
@grp.Key
+ @if (string.IsNullOrEmpty(siteTarget))
+ {
+ new site
+ }
+ | Source connection | +Map to target | +
|---|---|
| @rcm.SourceConnectionName | ++ + | +
fallback is NOT used for code-field diffs.
+ Assert.DoesNotContain("\"lineDiff\"", cut.Find("[data-testid='code-line-diff']").InnerHtml);
+ // No truncation marker for a complete diff.
+ Assert.Empty(cut.FindAll("[data-testid='line-diff-truncated']"));
+ }
+
+ // ─────────────────────────────────────────────────────────────────────
+ // Test 11 (M8 E2): truncation marker shows when the lineDiff is truncated.
+ // ─────────────────────────────────────────────────────────────────────
+ [Fact]
+ public async Task Modified_row_with_truncated_lineDiff_shows_truncation_marker()
+ {
+ const string fieldDiffJson = """
+ {
+ "changes": [
+ {
+ "field": "Code",
+ "oldValue": "x",
+ "newValue": "y",
+ "lineDiff": {
+ "hunks": [
+ { "op": "remove", "text": "x", "oldLineNo": 1 },
+ { "op": "add", "text": "y", "newLineNo": 1 }
+ ],
+ "truncated": true,
+ "addedCount": 12,
+ "removedCount": 8
+ }
+ }
+ ]
+ }
+ """;
+
+ var session = BuildEncryptedSession(sourceEnv: "prod-cluster");
+ var preview = new ImportPreview(session.SessionId, new List
+ {
+ new("Template", "Pump", 1, 2, ConflictKind.Modified, fieldDiffJson, null),
+ });
+ _importer.PreviewAsync(session.SessionId, Arg.Any()).Returns(preview);
+
+ var cut = Render();
+ await cut.InvokeAsync(() => SetField(cut.Instance, "_session", session));
+ await cut.InvokeAsync(async () =>
+ await InvokeAsyncMethod(cut.Instance, "LoadPreviewAndAdvanceAsync"));
+ cut.Render();
+
+ var marker = cut.Find("[data-testid='line-diff-truncated']");
+ Assert.Contains("truncated", marker.TextContent);
+ Assert.Contains("+12", marker.TextContent);
+ Assert.Contains("-8", marker.TextContent);
+ }
+
// ─────────────────────────────────────────────────────────────────────
// Reflection helpers — the wizard's per-instance state is private (the
// razor partial pattern). We poke at it via reflection rather than
diff --git a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Pages/QueryStringDrillInTests.cs b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Pages/QueryStringDrillInTests.cs
index 24cc2cf0..8ddb6f2a 100644
--- a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Pages/QueryStringDrillInTests.cs
+++ b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.Tests/Pages/QueryStringDrillInTests.cs
@@ -222,6 +222,8 @@ public sealed class QueryStringDrillInTests
var importer = Substitute.For();
Services.AddSingleton(importer);
Services.AddSingleton(Substitute.For());
+ // M8 E2: TransportImport's Map step injects ISiteRepository.
+ Services.AddSingleton(Substitute.For());
Services.AddSingleton>(
Microsoft.Extensions.Options.Options.Create(new TransportOptions
{