Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions Models/IedBrowserPresentation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@
string? iedName = null,
LiveIedModelDiscoveryDocument? sclModel = null)
{
const int childDepth = 1;

Check warning on line 375 in Models/IedBrowserPresentation.cs

View workflow job for this annotation

GitHub Actions / Build, test, validate and package Windows application

The variable 'childDepth' is assigned but its value is never used

Check warning on line 375 in Models/IedBrowserPresentation.cs

View workflow job for this annotation

GitHub Actions / Build, test, validate and package Windows application

The variable 'childDepth' is assigned but its value is never used

Check warning on line 375 in Models/IedBrowserPresentation.cs

View workflow job for this annotation

GitHub Actions / Build, test, validate and package Windows application

The variable 'childDepth' is assigned but its value is never used

Check warning on line 375 in Models/IedBrowserPresentation.cs

View workflow job for this annotation

GitHub Actions / Build, test, validate and package Windows application

The variable 'childDepth' is assigned but its value is never used

Check warning on line 375 in Models/IedBrowserPresentation.cs

View workflow job for this annotation

GitHub Actions / Build, test, validate and package Windows application

The variable 'childDepth' is assigned but its value is never used

Check warning on line 375 in Models/IedBrowserPresentation.cs

View workflow job for this annotation

GitHub Actions / Build, test, validate and package Windows application

The variable 'childDepth' is assigned but its value is never used
// Keep domain/object keys untouched; only presentation labels are short.
var labelIed = !string.IsNullOrWhiteSpace(model?.IedName)
? model.IedName : iedName;
Expand All @@ -380,16 +380,12 @@
Func<IReadOnlyList<IedBrowserTreeRow>> children)
=> new("category/" + key, name, "Category", 0, loadChildren: children);

// ARSAS navigation order is a presentation choice, not a wire/model contract.
// Stable category keys and lazy children preserve existing selected paths and
// avoid any additional MMS discovery, control or report requests.
var categories = new List<IedBrowserTreeRow>
{
Category("GOOSE", "goose", () => BlockGroups(
IedBrowserGooseDirectory.Resolve(model, sclModel), "GoCB", labelIed)),
Category("Reports", "reports", () => ReportGroups(rcbs, labelIed)),
Category("Setting Groups", "settings", () => BlockGroups(model?.SettingGroupControls, "SGCB", labelIed)),
// Files inventory belongs exclusively in the right-side
// virtualized grid. Nested file nodes duplicate content and
// inflate the compact engineering navigation.
new("category/files", "Files", "Category", 0),
Category("DataSets", "datasets", () => DataSetGroups(model?.DataSets, labelIed)),
Category("Data Model", "model", () =>
model?.LogicalDevices.Select(ld =>
Expand All @@ -405,7 +401,14 @@
new IedBrowserTreeRow("model/da/" + attr.MmsReference + "/" + ordinal,
attr.AttributePath, "DA", 4, attr)).ToArray()))
.ToArray())).ToArray())).ToArray()
?? Array.Empty<IedBrowserTreeRow>())
?? Array.Empty<IedBrowserTreeRow>()),
// Files inventory belongs exclusively in the right-side
// virtualized grid. Nested file nodes duplicate content and
// inflate the compact engineering navigation.
new("category/files", "Files", "Category", 0),
Category("GOOSE", "goose", () => BlockGroups(
IedBrowserGooseDirectory.Resolve(model, sclModel), "GoCB", labelIed)),
Category("Setting Groups", "settings", () => BlockGroups(model?.SettingGroupControls, "SGCB", labelIed))
};
return categories; // ARSAS IED Explorer already owns device selection; never duplicate it.
}
Expand Down
12 changes: 11 additions & 1 deletion tests/ARSAS.Tests/IedBrowserPresentationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,19 @@ public void CategoriesFollowEngineeringNavigationOrder_WithoutMmsCalls()
var projection = new IedBrowserTreeProjection();
projection.Reset(roots);
Assert.Equal(
["GOOSE", "Reports", "Setting Groups", "Files", "DataSets", "Data Model"],
["Reports", "DataSets", "Data Model", "Files", "GOOSE", "Setting Groups"],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Update the other category-order assertion

With this new order, P0BrowserRcbEnabledTruthTests.VirtualTreeStartsWithExactlySixCollapsedCategories still asserts GOOSE, Reports, Setting Groups, Files, DataSets, Data Model at lines 126–127. Because that test is included by the default test-project glob, every full ARSAS.Tests run now deterministically fails its Assert.Equal; update that existing assertion to the same order as this test.

AGENTS.md reference: AGENTS.md:L215-L219

Useful? React with 👍 / 👎.

projection.Rows.Select(x => x.Title).ToArray());
Assert.Equal(
["category/reports", "category/datasets", "category/model",
"category/files", "category/goose", "category/settings"],
projection.Rows.Select(x => x.Key).ToArray());
Assert.All(projection.Rows, x => Assert.Equal(0, x.Depth));

// A disconnected or SCL-only session retains the same category routes;
// reordering must not depend on live MMS or create placeholder children.
var withoutLiveModel = IedBrowserPresentation.Roots(null, Array.Empty<RcbExportRow>());
Assert.Equal(projection.Rows.Select(x => x.Key).ToArray(),
withoutLiveModel.Select(x => x.Key).ToArray());
}

[Fact]
Expand Down
4 changes: 2 additions & 2 deletions tests/ARSAS.Tests/P0BrowserRcbEnabledTruthTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ public void VirtualTreeStartsWithExactlySixCollapsedCategories()
var rows = IedBrowserPresentation.Roots(null, [Rcb()]);
var tree = new IedBrowserTreeProjection();
tree.Reset(rows);
Assert.Equal(new[] { "GOOSE", "Reports", "Setting Groups", "Files",
"DataSets", "Data Model" }, tree.Rows.Select(x => x.Title));
Assert.Equal(new[] { "Reports", "DataSets", "Data Model", "Files",
"GOOSE", "Setting Groups" }, tree.Rows.Select(x => x.Title));
Assert.All(tree.Rows, x => Assert.False(x.IsExpanded));

var reports = Assert.Single(tree.Rows.Where(x => x.Key == "category/reports"));
Expand Down
Loading