Skip to content

Commit

Permalink
Finalize Model dashboard; fixes #136
Browse files Browse the repository at this point in the history
  • Loading branch information
justineatrhea committed Aug 2, 2022
1 parent 1be0abb commit 6a52dc0
Show file tree
Hide file tree
Showing 14 changed files with 508 additions and 322 deletions.
14 changes: 14 additions & 0 deletions COMETwebapp.Tests/IterationServiceTest/IterationServiceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class IterationServiceTest
private Iteration iteration;
private IIterationService iterationService = new IterationService();
private List<ParameterValueSet> parameterValueSets;
private List<ParameterValueSetBase> parameterValueSetBase;
private List<ParameterSubscription> parameterSubscriptions;
private List<ElementDefinition> unReferencedElements;
private List<ElementDefinition> unUsedElements;
Expand Down Expand Up @@ -274,6 +275,12 @@ public void SetUp()
parameterValueset_2
};

this.parameterValueSetBase = new List<ParameterValueSetBase>()
{
parameterValueset_1,
parameterValueset_2
};

this.unReferencedElements = new List<ElementDefinition>()
{
elementDefinition_3
Expand Down Expand Up @@ -310,6 +317,13 @@ public void VerifyGetParameterValueSets()
Assert.That(iterationService.GetParameterValueSets(this.iteration), Is.EqualTo(this.parameterValueSets));
}

[Test]
public void VerifyGetParameterValueSetBase()
{
Assert.That(iterationService.GetParameterValueSetBase(this.iteration), Is.Not.Empty);
Assert.That(iterationService.GetParameterValueSetBase(this.iteration), Is.EqualTo(this.parameterValueSetBase));
}

[Test]
public void VerifyGetNestedElements()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ Copyright (c) 2022 RHEA System S.A.
</div>
@if(this.Data != null){
<DxChart Data="@Data" CustomizeSeriesPoint="@PreparePointLabel">
<DxChartFullStackedBarSeries Color="System.Drawing.Color.LightSlateGray" Name="Other Values" Filter="@((ParameterValueSet p) => p.Published.Count(el => !el.Equals("-")) != 0)"
<DxChartFullStackedBarSeries Color="System.Drawing.Color.LightSlateGray" Name="Other Values" Filter="@((ParameterValueSetBase p) => p.Published.Count(el => !el.Equals("-")) != 0)"
ArgumentField="@(p => p.Owner.ShortName)" ValueField="@(p => 1)"
AggregationMethod="Enumerable.Sum">
<DxChartSeriesLabel Position="RelativePosition.Inside"/>
</DxChartFullStackedBarSeries>
<DxChartFullStackedBarSeries Color="System.Drawing.Color.DarkSeaGreen" Name="Published Values as Default" Filter="@((ParameterValueSet p) => p.Published.Count(el => !el.Equals("-")) == 0)"
<DxChartFullStackedBarSeries Color="System.Drawing.Color.DarkSeaGreen" Name="Published Values as Default" Filter="@((ParameterValueSetBase p) => p.Published.Count(el => !el.Equals("-")) == 0)"
ArgumentField="@(p => p.Owner.ShortName)" ValueField="@(p => 1)"
AggregationMethod="Enumerable.Sum">
<DxChartSeriesLabel Position="RelativePosition.Inside" />
Expand Down Expand Up @@ -76,10 +76,10 @@ Copyright (c) 2022 RHEA System S.A.

</div>
</DxChartTooltip>
<DxChartStackedBarSeries Color="System.Drawing.Color.LightSlateGray" Name="Other Values" Filter="@((ParameterValueSet p) => p.Published.Count(el => !el.Equals("-")) != 0)"
<DxChartStackedBarSeries Color="System.Drawing.Color.LightSlateGray" Name="Other Values" Filter="@((ParameterValueSetBase p) => p.Published.Count(el => !el.Equals("-")) != 0)"
ArgumentField="@(p => p.Owner.ShortName)" ValueField="@(p => 1)"
AggregationMethod="Enumerable.Sum" />
<DxChartStackedBarSeries Color="System.Drawing.Color.DarkSeaGreen" Name="Published Values as Default" Filter="@((ParameterValueSet p) => p.Published.Count(el => !el.Equals("-")) == 0)"
<DxChartStackedBarSeries Color="System.Drawing.Color.DarkSeaGreen" Name="Published Values as Default" Filter="@((ParameterValueSetBase p) => p.Published.Count(el => !el.Equals("-")) == 0)"
ArgumentField="@(p => p.Owner.ShortName)" ValueField="@(p => 1)"
AggregationMethod="Enumerable.Sum" />
<DxChartLegend Position="RelativePosition.Outside" HorizontalAlignment="HorizontalAlignment.Center" />
Expand Down Expand Up @@ -110,7 +110,7 @@ Copyright (c) 2022 RHEA System S.A.
/// Data in the graph
/// </summary>
[Parameter]
public List<ParameterValueSet>? Data { get; set; }
public List<ParameterValueSetBase>? Data { get; set; }

/// <summary>
/// Set the point label on the graph
Expand All @@ -125,11 +125,11 @@ Copyright (c) 2022 RHEA System S.A.
}

/// <summary>
/// Get the number of <see cref="ParameterValueSet"> represented in the selected area depending on criteria and domain
/// Get the number of <see cref="ParameterValueSetBase"> represented in the selected area depending on criteria and domain
/// </summary>
/// <param name="criteria">The criteria represented in the selected area</param>
/// <param name="domain">The associated domain of the selected area</param>
/// <returns>The number of <see cref="ParameterValueSet"> represented in the selected area</returns>
/// <returns>The number of <see cref="ParameterValueSetBase"> represented in the selected area</returns>
public int NumberData(string criteria, object domain)
{
if(this.Data != null && criteria.Equals("Published Values as Default"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Copyright (c) 2022 RHEA System S.A.
/// Data in the graph
/// </summary>
[Parameter]
public List<ParameterValueSet>? Data { get; set; }
public List<ParameterValueSetBase>? Data { get; set; }

/// <summary>
/// Set the color appearence for the donut chart
Expand All @@ -70,9 +70,9 @@ Copyright (c) 2022 RHEA System S.A.
/// <summary>
/// Initialize <see cref="DataChart"> list from data to represent in the grpah
/// </summary>
/// <param name="data">List of <see cref="ParameterValueSet"> to represent in the graph </param>
/// <param name="data">List of <see cref="ParameterValueSetBase"> to represent in the graph </param>
/// <returns>List of <see cref="DataChart"> used in the graph</returns>
private List<DataChart> GetChartData(List<ParameterValueSet>? data)
private List<DataChart> GetChartData(List<ParameterValueSetBase>? data)
{
List<DataChart> donutData = new List<DataChart>();
var iteration = this.ISessionAnchor.OpenIteration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Copyright (c) 2022 RHEA System S.A.
{
<div class="container-fluid">
<div class="row align-items-center justify-content-center">
<DonutDashboard Data="Filter(Data)" />
<DonutDashboard Data="Filter(this.Data)" />
</div>
<div class="row m-top-10px">
<div class="col text-align-center">
Expand Down Expand Up @@ -71,7 +71,7 @@ Copyright (c) 2022 RHEA System S.A.
/// <summary>
/// ParameterValueSet represented in graphs
/// </summary>
public List<ParameterValueSet>? Data { get; set; }
public List<ParameterValueSetBase> Data { get; set; } = new List<ParameterValueSetBase>();

/// <summary>
/// Listeners for the components to update it with ISession
Expand All @@ -82,23 +82,24 @@ Copyright (c) 2022 RHEA System S.A.
/// Filter data to show in the graph
/// </summary>
/// <param name="data">List of all data in the project</param>
/// <returns>The list of filtered <see cref="ParameterValueSet"></returns>
public List<ParameterValueSet> Filter(List<ParameterValueSet>? data)
/// <returns>The list of filtered <see cref="ParameterValueSetBase"></returns>
public List<ParameterValueSetBase> Filter(List<ParameterValueSetBase>? data)
{
var result = new List<ParameterValueSet>();
if(data != null)
if(data == null)
{
result.AddRange(data);
return new List<ParameterValueSetBase>();
}

var result = data.ToList();

if (this.FilterOption != null)
{
var nestedParameters = this.IterationService.GetNestedParameters(this.ISessionAnchor.OpenIteration, this.FilterOption);
if (nestedParameters.Count != 0)
{
nestedParameters.ForEach(nestedParameter =>
{
result.RemoveAll(p => nestedParameter.AssociatedParameter.ValueSets.Contains(p));
});
var valueSets = nestedParameters.Select(x => x.ValueSet).ToList();
result = result.Where(x => valueSets.Contains(x)).ToList();

} else
{
result.Clear();
Expand All @@ -125,7 +126,7 @@ Copyright (c) 2022 RHEA System S.A.
/// </summary>
/// <param name="data">List of all data in the iteration</param>
/// <returns>The list of filtered <see cref="ParameterValueSet"></returns>
public List<ParameterValueSet> FilterDomain(List<ParameterValueSet>? data)
public List<ParameterValueSetBase> FilterDomain(List<ParameterValueSetBase>? data)
{
return this.Filter(data?.FindAll(d => d.Owner == this.ISessionAnchor.CurrentDomainOfExpertise));
}
Expand Down Expand Up @@ -170,6 +171,6 @@ Copyright (c) 2022 RHEA System S.A.
/// </summary>
private void InitializeData()
{
this.Data = this.IterationService.GetParameterValueSets(this.ISessionAnchor.OpenIteration);
this.Data = this.IterationService.GetParameterValueSetBase(this.ISessionAnchor.OpenIteration);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ Copyright (c) 2022 RHEA System S.A.
along with this program. If not, see http://www.gnu.org/licenses/.
------------------------------------------------------------------------------->

@inject NavigationManager NavigationManager

<div class="row">
<div class="col">
<div class="row">
<div class="col-9">
<h3 class="text-align-end">Publishable Parameters</h3>
</div>
<div class="col text-align-start p-0">
<Tooltip MarginBottom="bottom-60" Text="Publishable parameter : actual value not equal to published value">
<Tooltip MarginBottom="bottom-60" Text="Publishable parameter : current value not equal to published value">
<button type="button" class="btn btn-secondary btn-tooltip"><span class="oi oi-info"></span></button>
</Tooltip>
</div>
Expand All @@ -54,7 +56,7 @@ Copyright (c) 2022 RHEA System S.A.
<div class="col">
<div class="row">
<div class="col-9">
<h3 class="text-align-end">Actual Values as Default</h3>
<h3 class="text-align-end">Current Values as Default</h3>
</div>
<div class="col text-align-start p-0">
<Tooltip MarginBottom="bottom-15" Text="Default Value = '-'">
Expand All @@ -78,16 +80,18 @@ Copyright (c) 2022 RHEA System S.A.
</BSProgress>
</div>

<ToDoTable ParameterValueSets="@parameterValueSets"/>
<button class="todo-btn" @onclick="@(() => this.NavigationManager.NavigateTo("/ParameterEditor"))">
<ToDoTable ParameterValueSets="@parameterValueSets"/>
</button>
}
</div>
</div>

@code {
/// <summary>
/// <see cref="ParameterValueSet">s owned by the active domain
/// <see cref="ParameterValueSetBase">s owned by the active domain
/// </summary>
[Parameter]
public List<ParameterValueSet>? Data { get; set; }
public List<ParameterValueSetBase>? Data { get; set; }

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ Copyright (c) 2022 RHEA System S.A.
@if(this.Data != null)
{
<DxChart Data="@Data" CustomizeSeriesPoint="@PreparePointLabel">
<DxChartFullStackedBarSeries Color="System.Drawing.Color.LightCoral" Name="Publishable Parameters" Filter="@((ParameterValueSet p) => !p.Published.SequenceEqual(p.ActualValue))"
<DxChartFullStackedBarSeries Color="System.Drawing.Color.LightCoral" Name="Publishable Parameters" Filter="@((ParameterValueSetBase p) => !p.Published.SequenceEqual(p.ActualValue))"
ArgumentField="@(p => p.Owner.ShortName)" ValueField="@(p => 1)"
AggregationMethod="Enumerable.Sum">
<DxChartSeriesLabel Position="RelativePosition.Inside"/>
</DxChartFullStackedBarSeries>
<DxChartFullStackedBarSeries Color="System.Drawing.Color.SteelBlue" Name="Published Parameters" Filter="@((ParameterValueSet p) => p.Published.SequenceEqual(p.ActualValue))"
<DxChartFullStackedBarSeries Color="System.Drawing.Color.SteelBlue" Name="Published Parameters" Filter="@((ParameterValueSetBase p) => p.Published.SequenceEqual(p.ActualValue))"
ArgumentField="@(p => p.Owner.ShortName)" ValueField="@(p => 1)"
AggregationMethod="Enumerable.Sum">
<DxChartSeriesLabel Position="RelativePosition.Inside" />
Expand Down Expand Up @@ -77,10 +77,10 @@ Copyright (c) 2022 RHEA System S.A.

</div>
</DxChartTooltip>
<DxChartStackedBarSeries Color="System.Drawing.Color.LightCoral" Name="Publishable Parameters" Filter="@((ParameterValueSet p) => !p.Published.SequenceEqual(p.ActualValue))"
<DxChartStackedBarSeries Color="System.Drawing.Color.LightCoral" Name="Publishable Parameters" Filter="@((ParameterValueSetBase p) => !p.Published.SequenceEqual(p.ActualValue))"
ArgumentField="@(p => p.Owner.ShortName)" ValueField="@(p => 1)"
AggregationMethod="Enumerable.Sum" />
<DxChartStackedBarSeries Color="System.Drawing.Color.SteelBlue" Name="Published Parameters" Filter="@((ParameterValueSet p) => p.Published.SequenceEqual(p.ActualValue))"
<DxChartStackedBarSeries Color="System.Drawing.Color.SteelBlue" Name="Published Parameters" Filter="@((ParameterValueSetBase p) => p.Published.SequenceEqual(p.ActualValue))"
ArgumentField="@(p => p.Owner.ShortName)" ValueField="@(p => 1)"
AggregationMethod="Enumerable.Sum" />
<DxChartLegend Position="RelativePosition.Outside" HorizontalAlignment="HorizontalAlignment.Center" />
Expand Down Expand Up @@ -108,10 +108,10 @@ Copyright (c) 2022 RHEA System S.A.
public string? FilterParameterType { get; set; }

/// <summary>
/// <see cref="ParameterValueSet"> for the graph
/// <see cref="ParameterValueSetBase"> for the graph
/// </summary>
[Parameter]
public List<ParameterValueSet>? Data { get; set; }
public List<ParameterValueSetBase>? Data { get; set; }

/// <summary>
/// Set the point label on the graph
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Copyright (c) 2022 RHEA System S.A.
<BSTBody>
@foreach(var parameterValueSet in this.ParameterValueSets)
{
var parameter = (Parameter)parameterValueSet.Container;
var element = (ElementDefinition)parameter.Container;
var parameter = (ParameterBase)parameterValueSet.Container;
var element = (ElementBase)parameter.Container;
<BSTR AlignRow="AlignRow.Middle">
<BSTD>@element.Name</BSTD>
<BSTD>@parameter.ParameterType.Name</BSTD>
Expand Down Expand Up @@ -69,8 +69,8 @@ Copyright (c) 2022 RHEA System S.A.

@code {
/// <summary>
/// All <see cref="ParameterValueSet"> to complete
/// All <see cref="ParameterValueSetBase"> to complete
/// </summary>
[Parameter]
public List<ParameterValueSet>? ParameterValueSets { get; set; }
public List<ParameterValueSetBase>? ParameterValueSets { get; set; }
}
11 changes: 10 additions & 1 deletion COMETwebapp/IterationServices/IIterationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ public interface IIterationService
/// <returns>All <see cref="ParameterValueSet"/></returns>
List<ParameterValueSet> GetParameterValueSets(Iteration? iteration);

/// <summary>
/// Get all <see cref="ParameterValueSetBase"/> of the given iteration
/// </summary>
/// <param name="iteration">
/// The <see cref="Iteration"/> for which the <see cref="ParameterValueSetBase"/>s list is created
/// </param>
/// <returns>All <see cref="ParameterValueSetBase"/></returns>
List<ParameterValueSetBase> GetParameterValueSetBase(Iteration? iteration);

/// <summary>
/// Get all <see cref="NestedElement"/> of the given iteration for all options
/// </summary>
Expand Down Expand Up @@ -146,6 +155,6 @@ public interface IIterationService
/// The name of <see cref="ParameterType"/> for which the <see cref="ParameterValueSet"/>s list is created
/// </param>
/// <returns>All <see cref="ParameterValueSet" for the given parameter type/></returns>
List<ParameterValueSet> GetParameterValueSetsByParameterType(Iteration? iteration, string? parameterTypeName);
List<ParameterValueSetBase> GetParameterValueSetsByParameterType(Iteration? iteration, string? parameterTypeName);
}
}
Loading

0 comments on commit 6a52dc0

Please sign in to comment.