From a428c72b058b7d82617fc2b6186c99fd0c3c7f85 Mon Sep 17 00:00:00 2001 From: Alexander van Delft Date: Thu, 5 Dec 2024 16:00:17 +0100 Subject: [PATCH] Show complete group hierarchy path instead of only main group --- .../ParameterTableViewModelTestFixture.cs | 14 +++++++++--- .../ParameterEditor/ParameterTable.razor | 2 +- .../ParameterBaseRowViewModel.cs | 22 +++++++++++++++---- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/COMETwebapp.Tests/ViewModels/Components/ParameterEditor/ParameterTableViewModelTestFixture.cs b/COMETwebapp.Tests/ViewModels/Components/ParameterEditor/ParameterTableViewModelTestFixture.cs index 92ad0bb9..d01f2122 100644 --- a/COMETwebapp.Tests/ViewModels/Components/ParameterEditor/ParameterTableViewModelTestFixture.cs +++ b/COMETwebapp.Tests/ViewModels/Components/ParameterEditor/ParameterTableViewModelTestFixture.cs @@ -51,6 +51,7 @@ public class ParameterTableViewModelTestFixture private Option option; private CDPMessageBus messageBus; private ParameterGroup parameterGroup; + private ParameterGroup parameterGroup2; [SetUp] public void Setup() @@ -93,6 +94,13 @@ public void Setup() Name = "ParameterGroup 1" }; + this.parameterGroup2 = new ParameterGroup() + { + Iid = Guid.NewGuid(), + Name = "ParameterGroup 2", + ContainingGroup = this.parameterGroup + }; + var parameter1 = new Parameter() { Iid = Guid.NewGuid(), @@ -139,7 +147,7 @@ public void Setup() ParameterType = parameterType, Scale = scale, Owner = this.domain, - Group = this.parameterGroup, + Group = this.parameterGroup2, ValueSet = { new ParameterValueSet() @@ -177,7 +185,7 @@ public void Setup() Iid = Guid.NewGuid(), Name = "Container", Parameter = { parameter3 }, - ParameterGroup = { this.parameterGroup } + ParameterGroup = { this.parameterGroup, this.parameterGroup2 } }; var elementDefinition = new ElementDefinition() @@ -239,7 +247,7 @@ public void VerifyParameterRowProperties() Assert.That(parameterRow.ParameterName, Is.EqualTo("mass")); Assert.That(parameterRow.Option, Is.Empty); Assert.That(parameterRow.State, Is.Empty); - Assert.That(parameterRow.ParameterGroupName, Is.EqualTo(this.parameterGroup.Name)); + Assert.That(parameterRow.ParameterGroupPath, Is.EqualTo($"{this.parameterGroup.Name} => {this.parameterGroup2.Name}")); }); } diff --git a/COMETwebapp/Components/ParameterEditor/ParameterTable.razor b/COMETwebapp/Components/ParameterEditor/ParameterTable.razor index 1cdec954..57dbf694 100644 --- a/COMETwebapp/Components/ParameterEditor/ParameterTable.razor +++ b/COMETwebapp/Components/ParameterEditor/ParameterTable.razor @@ -109,7 +109,7 @@ - + diff --git a/COMETwebapp/ViewModels/Components/ParameterEditor/ParameterBaseRowViewModel.cs b/COMETwebapp/ViewModels/Components/ParameterEditor/ParameterBaseRowViewModel.cs index 269f549c..a2f435e6 100644 --- a/COMETwebapp/ViewModels/Components/ParameterEditor/ParameterBaseRowViewModel.cs +++ b/COMETwebapp/ViewModels/Components/ParameterEditor/ParameterBaseRowViewModel.cs @@ -120,14 +120,28 @@ private void InitializesProperties(bool isReadOnly) /// private void CalculateParameterGroupData() { - var parameterGroupName = string.Empty; + var parameterGroupPath = string.Empty; if (this.Parameter.Group != null) { - parameterGroupName = this.Parameter.Group.Name; + var group = this.Parameter.Group; + parameterGroupPath = this.Parameter.Group.Name; + + while (true) + { + if (group.ContainingGroup != null) + { + parameterGroupPath = $"{group.ContainingGroup.Name} => {parameterGroupPath}"; + group = group.ContainingGroup; + } + else + { + break; + } + } } - this.ParameterGroupName = parameterGroupName; + this.ParameterGroupPath = parameterGroupPath; } /// @@ -187,7 +201,7 @@ public bool IsPublishable /// /// Gets the name /// - public string ParameterGroupName { get; private set; } + public string ParameterGroupPath { get; private set; } /// /// Gets the switch for the published value