diff --git a/COMETwebapp.Tests/ViewModels/Components/ParameterEditor/ParameterTableViewModelTestFixture.cs b/COMETwebapp.Tests/ViewModels/Components/ParameterEditor/ParameterTableViewModelTestFixture.cs index 6e5d12ca..92ad0bb9 100644 --- a/COMETwebapp.Tests/ViewModels/Components/ParameterEditor/ParameterTableViewModelTestFixture.cs +++ b/COMETwebapp.Tests/ViewModels/Components/ParameterEditor/ParameterTableViewModelTestFixture.cs @@ -50,6 +50,7 @@ public class ParameterTableViewModelTestFixture private Iteration iteration; private Option option; private CDPMessageBus messageBus; + private ParameterGroup parameterGroup; [SetUp] public void Setup() @@ -86,12 +87,19 @@ public void Setup() ShortName = "kg" }; + this.parameterGroup = new ParameterGroup() + { + Iid = Guid.NewGuid(), + Name = "ParameterGroup 1" + }; + var parameter1 = new Parameter() { Iid = Guid.NewGuid(), Owner = this.domain, ParameterType = parameterType, Scale = scale, + Group = this.parameterGroup, ValueSet = { new ParameterValueSet() @@ -111,6 +119,7 @@ public void Setup() Owner = this.domain, ParameterType = parameterType, Scale = scale, + Group = this.parameterGroup, ValueSet = { new ParameterValueSet() @@ -130,6 +139,7 @@ public void Setup() ParameterType = parameterType, Scale = scale, Owner = this.domain, + Group = this.parameterGroup, ValueSet = { new ParameterValueSet() @@ -166,7 +176,8 @@ public void Setup() { Iid = Guid.NewGuid(), Name = "Container", - Parameter = { parameter3 } + Parameter = { parameter3 }, + ParameterGroup = { this.parameterGroup } }; var elementDefinition = new ElementDefinition() @@ -228,6 +239,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)); }); } diff --git a/COMETwebapp/COMETwebapp.csproj b/COMETwebapp/COMETwebapp.csproj index 389eb9ac..2aa81597 100644 --- a/COMETwebapp/COMETwebapp.csproj +++ b/COMETwebapp/COMETwebapp.csproj @@ -38,4 +38,8 @@ + + + + diff --git a/COMETwebapp/Components/ParameterEditor/ParameterTable.razor b/COMETwebapp/Components/ParameterEditor/ParameterTable.razor index a53f0250..1cdec954 100644 --- a/COMETwebapp/Components/ParameterEditor/ParameterTable.razor +++ b/COMETwebapp/Components/ParameterEditor/ParameterTable.razor @@ -109,6 +109,7 @@ + diff --git a/COMETwebapp/ViewModels/Components/ParameterEditor/ParameterBaseRowViewModel.cs b/COMETwebapp/ViewModels/Components/ParameterEditor/ParameterBaseRowViewModel.cs index 52acc332..269f549c 100644 --- a/COMETwebapp/ViewModels/Components/ParameterEditor/ParameterBaseRowViewModel.cs +++ b/COMETwebapp/ViewModels/Components/ParameterEditor/ParameterBaseRowViewModel.cs @@ -112,6 +112,22 @@ private void InitializesProperties(bool isReadOnly) this.Option = this.ValueSet.ActualOption is not null ? this.ValueSet.ActualOption?.Name : string.Empty; this.State = this.ValueSet.ActualState is not null ? this.ValueSet.ActualState.Name : string.Empty; this.Switch = this.ValueSet.ValueSwitch; + this.CalculateParameterGroupData(); + } + + /// + /// Calculate and set the values of parameters + /// + private void CalculateParameterGroupData() + { + var parameterGroupName = string.Empty; + + if (this.Parameter.Group != null) + { + parameterGroupName = this.Parameter.Group.Name; + } + + this.ParameterGroupName = parameterGroupName; } /// @@ -168,6 +184,11 @@ public bool IsPublishable /// public string OwnerName { get; private set; } + /// + /// Gets the name + /// + public string ParameterGroupName { get; private set; } + /// /// Gets the switch for the published value ///