Skip to content

Commit

Permalink
Add ParameterGroupName to ParameterEditor
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander van Delft committed Dec 5, 2024
1 parent 369d136 commit a4905a8
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public class ParameterTableViewModelTestFixture
private Iteration iteration;
private Option option;
private CDPMessageBus messageBus;
private ParameterGroup parameterGroup;

[SetUp]
public void Setup()
Expand Down Expand Up @@ -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()
Expand All @@ -111,6 +119,7 @@ public void Setup()
Owner = this.domain,
ParameterType = parameterType,
Scale = scale,
Group = this.parameterGroup,
ValueSet =
{
new ParameterValueSet()
Expand All @@ -130,6 +139,7 @@ public void Setup()
ParameterType = parameterType,
Scale = scale,
Owner = this.domain,
Group = this.parameterGroup,
ValueSet =
{
new ParameterValueSet()
Expand Down Expand Up @@ -166,7 +176,8 @@ public void Setup()
{
Iid = Guid.NewGuid(),
Name = "Container",
Parameter = { parameter3 }
Parameter = { parameter3 },
ParameterGroup = { this.parameterGroup }
};

var elementDefinition = new ElementDefinition()
Expand Down Expand Up @@ -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));
});
}

Expand Down
4 changes: 4 additions & 0 deletions COMETwebapp/COMETwebapp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,8 @@
</Content>
</ItemGroup>

<ItemGroup>
<Folder Include="logs\" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
</DxGridDataColumn>
<DxGridDataColumn FieldName="@nameof(ParameterBaseRowViewModel.ModelCode)" Caption="@("Model Code")" AllowGroup="false" AllowSort="true" />
<DxGridDataColumn FieldName="@nameof(ParameterBaseRowViewModel.OwnerName)" Caption="@("Owner")" AllowGroup="false" AllowSort="true" />
<DxGridDataColumn FieldName="@nameof(ParameterBaseRowViewModel.ParameterGroupName)" Caption="@("Parameter Group")" AllowGroup="false" AllowSort="true" />
</Columns>
</DxGrid>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/// <summary>
/// Calculate and set the values of <see cref="ParameterGroup"/> parameters
/// </summary>
private void CalculateParameterGroupData()
{
var parameterGroupName = string.Empty;

if (this.Parameter.Group != null)
{
parameterGroupName = this.Parameter.Group.Name;
}

this.ParameterGroupName = parameterGroupName;
}

/// <summary>
Expand Down Expand Up @@ -168,6 +184,11 @@ public bool IsPublishable
/// </summary>
public string OwnerName { get; private set; }

/// <summary>
/// Gets the <see cref="ParameterGroup" /> name
/// </summary>
public string ParameterGroupName { get; private set; }

/// <summary>
/// Gets the switch for the published value
/// </summary>
Expand Down

0 comments on commit a4905a8

Please sign in to comment.