Skip to content

Commit

Permalink
Feat #436 [Parameter Editor] It would be nice to be able to change pa…
Browse files Browse the repository at this point in the history
…rameter values in "sudo-batch-style" (#588)
  • Loading branch information
joao4all authored Apr 30, 2024
1 parent 06405f2 commit 3e5e66e
Show file tree
Hide file tree
Showing 26 changed files with 1,263 additions and 233 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CodeQuality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
dotnet tool install --global dotnet-sonarscanner
dotnet sonarscanner begin /k:"RHEAGROUP_COMET-WEB-Community-Edition" /o:"rheagroup" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="./CoverageResults/coverage.opencover.xml"
dotnet sonarscanner begin /k:"STARIONGROUP_COMET-WEB-Community-Edition" /o:"stariongroup" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="./CoverageResults/coverage.opencover.xml"
- name: Build
run: dotnet build --no-restore /p:ContinuousIntegrationBuild=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ namespace COMET.Web.Common.Components.ParameterTypeEditors
using CDP4Common.EngineeringModelData;
using CDP4Common.SiteDirectoryData;

using COMET.Web.Common.Extensions;
using COMET.Web.Common.ViewModels.Components.ParameterEditors;

using DevExpress.Blazor;
Expand Down Expand Up @@ -70,7 +71,7 @@ protected override void OnParametersSet()

this.Disposables.Add(this.WhenAnyValue(x => x.ViewModel.IsReadOnly,
x => x.ViewModel.ValueArray)
.Subscribe(_ => this.StateHasChanged()));
.SubscribeAsync(_ => this.InvokeAsync(this.StateHasChanged)));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,25 @@
}
else
{
<div class="parameter-row-text">
<Tooltip MarginBottom="text-align-center"
Text="@this.ViewModel.ValueArray[this.ViewModel.ValueArrayIndex]"
CssClass="position-absolute">
<DxTextBox Text="@this.ViewModel.ValueArray[this.ViewModel.ValueArrayIndex]"
InputCssClass="text-prameter-editor"
CssClass="parameter-input"
ReadOnly="true">
<Buttons>
<DxEditorButton IconCssClass="icon icon-edit"
Tooltip="Open Multiline editor"
Click="this.OpenMemoPopup" />
</Buttons>
</DxTextBox>
</Tooltip>
@if (this.ViewModel.Parameter?.Scale != null)
{
<span class="content-scale">[@this.ViewModel.Parameter.Scale.ShortName]</span>
}
</div>
<Tooltip MarginBottom="text-align-center"
Text="@this.ViewModel.ValueArray[this.ViewModel.ValueArrayIndex]">
<DxTextBox Text="@this.ViewModel.ValueArray[this.ViewModel.ValueArrayIndex]"
InputCssClass="text-prameter-editor"
CssClass="parameter-input"
ReadOnly="true">
<Buttons>
<DxEditorButton IconCssClass="icon icon-edit"
Tooltip="Open Multiline editor"
Click="this.OpenMemoPopup" />
</Buttons>
</DxTextBox>
</Tooltip>

@if (this.ViewModel.Parameter?.Scale != null)
{
<span class="content-scale">[@this.ViewModel.Parameter.Scale.ShortName]</span>
}

<DxPopup @bind-Visible="@this.IsOnEditMode" HeaderText="@this.ViewModel.ParameterType.Name" Shown="OnShown" Width="auto" CloseOnOutsideClick="true" MaxHeight="1000" MaxWidth="900" MinWidth="400">
<DxMemo @ref="this.multiLineEditor"
BindValueMode="@this.BindValueMode"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

@if (this.ViewModel.CurrentIteration != null)
{
<h6>Filter on Parameter Type:</h6>
<h6>@(this.DisplayText)</h6>
<DxComboBox Data="@this.ViewModel.AvailableParameterTypes"
AllowUserInput="true"
@bind-Value="@this.ViewModel.SelectedParameterType"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ParameterTypeSelector.razor.cs" company="Starion Group S.A.">
// Copyright (c) 2024 Starion Group S.A.
//
// Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Jaime Bernar, Théate Antoine, João Rua
//
// This file is part of COMET WEB Community Edition
// The COMET WEB Community Edition is the Starion Group Web Application implementation of ECSS-E-TM-10-25 Annex A and Annex C.
//
// The COMET WEB Community Edition is free software; you can redistribute it and/or
// modify it under the terms of the GNU Affero General Public
// License as published by the Free Software Foundation; either
// version 3 of the License, or (at your option) any later version.
//
// The COMET WEB Community Edition is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace COMET.Web.Common.Components.Selectors
{
using CDP4Common.SiteDirectoryData;

using Microsoft.AspNetCore.Components;

/// <summary>
/// Component used to select a <see cref="ParameterType" />
/// </summary>
public partial class ParameterTypeSelector
{
/// <summary>
/// Text to be displayed when the selector is shown
/// </summary>
[Parameter]
public string DisplayText { get; set; } = "Filter on Parameter Type:";
}
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IParameterTypeEditorSelectorViewModel.cs" company="RHEA System S.A.">
// Copyright (c) 2023-2024 RHEA System S.A.
// <copyright file="IParameterTypeEditorSelectorViewModel.cs" company="Starion Group S.A.">
// Copyright (c) 2024 Starion Group S.A.
//
// Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Jaime Bernar, Théate Antoine, Nabil Abbar
// Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Jaime Bernar, Théate Antoine, João Rua
//
// This file is part of CDP4-COMET WEB Community Edition
// The CDP4-COMET WEB Community Edition is the RHEA Web Application implementation of ECSS-E-TM-10-25
// Annex A and Annex C.
// This file is part of COMET WEB Community Edition
// The COMET WEB Community Edition is the Starion Group Web Application implementation of ECSS-E-TM-10-25 Annex A and Annex C.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// The COMET WEB Community Edition is free software; you can redistribute it and/or
// modify it under the terms of the GNU Affero General Public
// License as published by the Free Software Foundation; either
// version 3 of the License, or (at your option) any later version.
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// The COMET WEB Community Edition is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -47,10 +46,15 @@ public interface IParameterTypeEditorSelectorViewModel
EventCallback<(IValueSet, int)> ParameterValueChanged { get; set; }

/// <summary>
/// Gets the <see cref="MeasurementScale"/> to use
/// Gets the <see cref="MeasurementScale" /> to use
/// </summary>
MeasurementScale Scale { get; set; }

/// <summary>
/// Gets the value set of this <see cref="ParameterType" />
/// </summary>
IValueSet ValueSet { get; }

/// <summary>
/// Creates a view model for the corresponding editor
/// </summary>
Expand All @@ -65,7 +69,7 @@ public interface IParameterTypeEditorSelectorViewModel
void UpdateSwitchKind(ParameterSwitchKind switchValue);

/// <summary>
/// Updates the associated <see cref="IParameterEditorBaseViewModel{T}"/> properties
/// Updates the associated <see cref="IParameterEditorBaseViewModel{T}" /> properties
/// </summary>
/// <param name="readOnly">The readonly state</param>
void UpdateProperties(bool readOnly);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ParameterTypeEditorSelectorViewModel.cs" company="RHEA System S.A.">
// Copyright (c) 2023-2024 RHEA System S.A.
// <copyright file="ParameterTypeEditorSelectorViewModel.cs" company="Starion Group S.A.">
// Copyright (c) 2024 Starion Group S.A.
//
// Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Jaime Bernar, Théate Antoine, Nabil Abbar
// Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Jaime Bernar, Théate Antoine, João Rua
//
// This file is part of CDP4-COMET WEB Community Edition
// The CDP4-COMET WEB Community Edition is the RHEA Web Application implementation of ECSS-E-TM-10-25
// Annex A and Annex C.
// This file is part of COMET WEB Community Edition
// The COMET WEB Community Edition is the Starion Group Web Application implementation of ECSS-E-TM-10-25 Annex A and Annex C.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// The COMET WEB Community Edition is free software; you can redistribute it and/or
// modify it under the terms of the GNU Affero General Public
// License as published by the Free Software Foundation; either
// version 3 of the License, or (at your option) any later version.
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// The COMET WEB Community Edition is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -92,7 +91,7 @@ public ParameterTypeEditorSelectorViewModel(ParameterType parameterType, IValueS
/// <summary>
/// Gets the index of the value changed in the value sets
/// </summary>
public int ValueArrayIndex { get; }
public int ValueArrayIndex { get; private set; }

/// <summary>
/// Gets or sets the value set of this <see cref="ParameterType" />
Expand Down Expand Up @@ -136,7 +135,7 @@ public IParameterEditorBaseViewModel<T> CreateParameterEditorViewModel<T>() wher
};

var parameterViewModel = (this.haveValueSetViewModel as IParameterEditorBaseViewModel<T>)!;
parameterViewModel.ParameterValueChanged = this.ParameterValueChanged;
parameterViewModel.ParameterValueChanged = new EventCallbackFactory().Create<(IValueSet, int)>(this, this.OnParameterValueChange);

if (this.preSetSwitchKind.HasValue)
{
Expand Down Expand Up @@ -175,5 +174,18 @@ private void InitializesProperties(bool readOnly)
{
this.isReadOnly = readOnly;
}

/// <summary>
/// Method executed when the parameter value has changed
/// </summary>
/// <param name="callbackValues">The callback event values</param>
/// <returns>A <see cref="Task" /></returns>
private async Task OnParameterValueChange((IValueSet, int) callbackValues)
{
this.ValueSet = callbackValues.Item1;
this.ValueArrayIndex = callbackValues.Item2;

await this.ParameterValueChanged.InvokeAsync(callbackValues);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ namespace COMET.Web.Common.ViewModels.Components.Selectors
{
using CDP4Common.SiteDirectoryData;

using COMET.Web.Common.Extensions;

using ReactiveUI;

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions COMET.Web.Common/wwwroot/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@

.tooltip-wrapper {
position: relative;
display: inline-block;
display: inline;
cursor: help;
}

Expand Down Expand Up @@ -492,7 +492,7 @@
#sfpt-table{
max-height: 750px;
max-width: 1000px;
overflow: auto;
overflow: unset;
display: block;
}

Expand Down
Loading

0 comments on commit 3e5e66e

Please sign in to comment.