From b0dc601584f02a9be3f95790b9c3b54333565a99 Mon Sep 17 00:00:00 2001 From: Joao Rua Date: Mon, 29 Jul 2024 15:03:36 +0100 Subject: [PATCH 1/8] solved issue --- .../ParameterEditor/ParameterTable.razor | 2 +- .../ParameterEditor/ParameterTable.razor.cs | 39 ++++++------------- .../ParameterEditorBodyViewModel.cs | 2 +- 3 files changed, 14 insertions(+), 29 deletions(-) diff --git a/COMETwebapp/Components/ParameterEditor/ParameterTable.razor b/COMETwebapp/Components/ParameterEditor/ParameterTable.razor index 77388896..649a4e8a 100644 --- a/COMETwebapp/Components/ParameterEditor/ParameterTable.razor +++ b/COMETwebapp/Components/ParameterEditor/ParameterTable.razor @@ -66,7 +66,7 @@ -// Copyright (c) 2023-2024 Starion Group S.A. +// +// Copyright (c) 2024 Starion Group S.A. // -// Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Jaime Bernar, Théate Antoine +// 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 Starion 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. // -// The CDP4-COMET WEB Community Edition is free software; you can redistribute it and/or +// 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 CDP4-COMET WEB Community Edition is distributed in the hope that it will be useful, +// 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. @@ -24,18 +24,13 @@ namespace COMETwebapp.Components.ParameterEditor { - using System.Collections.ObjectModel; - - using CDP4Common.EngineeringModelData; - using CDP4Common.SiteDirectoryData; + using COMET.Web.Common.Extensions; using COMETwebapp.Comparer; using COMETwebapp.ViewModels.Components.ParameterEditor; using DevExpress.Blazor; - using DynamicData; - using Microsoft.AspNetCore.Components; using ReactiveUI; @@ -53,12 +48,7 @@ public partial class ParameterTable /// /// The /// - private ParameterBaseRowViewModelComparer comparer = new(); - - /// - /// The sorted collection of - /// - private ReadOnlyObservableCollection sortedCollection; + private readonly ParameterBaseRowViewModelComparer comparer = new(); /// /// Gets or sets the @@ -80,12 +70,7 @@ protected override void OnInitialized() base.OnInitialized(); this.Disposables.Add(this.WhenAnyValue(x => x.ViewModel.IsOnEditMode) - .Subscribe(_ => this.InvokeAsync(this.StateHasChanged))); - - this.Disposables.Add(this.ViewModel.Rows.Connect() - .Sort(this.comparer) - .Bind(out this.sortedCollection) - .Subscribe(_ => this.InvokeAsync(this.StateHasChanged))); + .SubscribeAsync(_ => this.InvokeAsync(this.StateHasChanged))); this.closeEditor = new EventCallbackFactory().Create(this, () => { this.ViewModel.IsOnEditMode = false; }); } @@ -93,7 +78,7 @@ protected override void OnInitialized() /// /// Customizes the table rows /// - /// The + /// The private void OnCustomizeElement(GridCustomizeElementEventArgs e) { if (e.ElementType == GridElementType.DataRow) @@ -109,7 +94,7 @@ private void OnCustomizeElement(GridCustomizeElementEventArgs e) if (e.ElementType == GridElementType.GroupCell) { var elementBaseName = (string)e.Grid.GetRowValue(e.VisibleIndex, nameof(ParameterBaseRowViewModel.ElementBaseName)); - var isPublishableParameterInGroup = this.sortedCollection.Any(x => x.IsPublishable && x.ElementBaseName == elementBaseName); + var isPublishableParameterInGroup = this.ViewModel.Rows.Items.Any(x => x.IsPublishable && x.ElementBaseName == elementBaseName); if (isPublishableParameterInGroup) { diff --git a/COMETwebapp/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModel.cs b/COMETwebapp/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModel.cs index eadc7a09..3316e45d 100644 --- a/COMETwebapp/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModel.cs +++ b/COMETwebapp/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModel.cs @@ -129,7 +129,7 @@ public bool IsOwnedParameters /// A protected override async Task OnSessionRefreshed() { - if (!this.AddedThings.Any() && !this.DeletedThings.Any() && !this.UpdatedThings.Any()) + if (this.AddedThings.Count == 0 && this.DeletedThings.Count == 0 && this.UpdatedThings.Count == 0) { return; } From de4cdfbe46d4277f6b8e879b47a2bea5ed38089a Mon Sep 17 00:00:00 2001 From: Joao Rua Date: Mon, 29 Jul 2024 17:51:01 +0100 Subject: [PATCH 2/8] fixed issue with two different tabs --- .../ParameterEditor/ParameterEditorBody.razor | 4 +-- .../ParameterEditorBodyViewModel.cs | 30 +++++++++---------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/COMETwebapp/Components/ParameterEditor/ParameterEditorBody.razor b/COMETwebapp/Components/ParameterEditor/ParameterEditorBody.razor index 8b6260da..519a4d4f 100644 --- a/COMETwebapp/Components/ParameterEditor/ParameterEditorBody.razor +++ b/COMETwebapp/Components/ParameterEditor/ParameterEditorBody.razor @@ -26,7 +26,7 @@ Copyright (c) 2024 Starion Group S.A. @inherits COMET.Web.Common.Components.Applications.SingleIterationApplicationBase - +
@@ -60,4 +60,4 @@ Copyright (c) 2024 Starion Group S.A.
- \ No newline at end of file + diff --git a/COMETwebapp/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModel.cs b/COMETwebapp/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModel.cs index 3316e45d..76b82d3c 100644 --- a/COMETwebapp/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModel.cs +++ b/COMETwebapp/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModel.cs @@ -172,23 +172,21 @@ protected override async Task OnDomainChanged() protected override async Task OnThingChanged() { await base.OnThingChanged(); - this.IsOwnedParameters = true; - this.ElementSelector.CurrentIteration = this.CurrentThing; - this.OptionSelector.CurrentIteration = this.CurrentThing; - this.ParameterTypeSelector.CurrentIteration = this.CurrentThing; - this.BatchParameterEditorViewModel.CurrentIteration = this.CurrentThing; - await this.InitializeTable(); - } - /// - /// Initialize the - /// - /// A - private async Task InitializeTable() - { - this.IsLoading = true; - await Task.Delay(1); - this.ParameterTableViewModel.InitializeViewModel(this.CurrentThing, this.CurrentDomain, this.OptionSelector.SelectedOption); + if (!this.HasSetInitialValuesOnce) + { + this.IsLoading = true; + + this.IsOwnedParameters = true; + this.ElementSelector.CurrentIteration = this.CurrentThing; + this.OptionSelector.CurrentIteration = this.CurrentThing; + this.ParameterTypeSelector.CurrentIteration = this.CurrentThing; + this.BatchParameterEditorViewModel.CurrentIteration = this.CurrentThing; + this.ParameterTableViewModel.InitializeViewModel(this.CurrentThing, this.CurrentDomain, this.OptionSelector.SelectedOption); + + this.IsLoading = false; + } + this.IsLoading = false; } From 9a97a135b122c032e102d5cf4c581059e2a47f1f Mon Sep 17 00:00:00 2001 From: Joao Rua Date: Mon, 29 Jul 2024 18:25:54 +0100 Subject: [PATCH 3/8] fixed ocasional bugs + unit tests --- .../ParameterEditorTestFixture.cs | 26 +++++++++++++------ .../ParameterEditorBody.razor.cs | 3 ++- .../ParameterEditorBodyViewModel.cs | 15 ++++++----- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/COMETwebapp.Tests/Pages/ParameterEditor/ParameterEditorTestFixture.cs b/COMETwebapp.Tests/Pages/ParameterEditor/ParameterEditorTestFixture.cs index 8c649f7a..1fc9f689 100644 --- a/COMETwebapp.Tests/Pages/ParameterEditor/ParameterEditorTestFixture.cs +++ b/COMETwebapp.Tests/Pages/ParameterEditor/ParameterEditorTestFixture.cs @@ -123,21 +123,31 @@ public void Setup() mockConfigurationService.Setup(x => x.ServerConfiguration).Returns(new ServerConfiguration()); this.messageBus = new CDPMessageBus(); + var parameterTableViewModel = new Mock(); + parameterTableViewModel.Setup(x => x.Rows).Returns(new SourceList()); + + var parameterEditorBodyViewModel = new Mock(); + parameterEditorBodyViewModel.Setup(x => x.OptionSelector).Returns(new Mock().Object); + parameterEditorBodyViewModel.Setup(x => x.BatchParameterEditorViewModel).Returns(new Mock().Object); + parameterEditorBodyViewModel.Setup(x => x.ParameterTypeSelector).Returns(new Mock().Object); + parameterEditorBodyViewModel.Setup(x => x.ElementSelector).Returns(new Mock().Object); + parameterEditorBodyViewModel.Setup(x => x.ParameterTableViewModel).Returns(parameterTableViewModel.Object); + + var configurationService = new Mock(); + configurationService.Setup(x => x.GetText(It.IsAny())).Returns("something"); + this.context.ConfigureDevExpressBlazor(); this.context.Services.AddSingleton(this.viewModel); this.context.Services.AddSingleton(this.sessionService.Object); + this.context.Services.AddSingleton(this.messageBus); + this.context.Services.AddSingleton(mockConfigurationService.Object); + this.context.Services.AddSingleton(parameterEditorBodyViewModel.Object); + this.context.Services.AddSingleton(parameterTableViewModel.Object); + this.context.Services.AddSingleton(configurationService.Object); this.context.Services.AddSingleton(); - this.context.Services.AddSingleton(); this.context.Services.AddSingleton(); this.context.Services.AddSingleton(); - this.context.Services.AddSingleton(); this.context.Services.AddSingleton(); - this.context.Services.AddSingleton(mockConfigurationService.Object); - this.context.Services.AddSingleton(this.messageBus); - - var configurationService = new Mock(); - configurationService.Setup(x => x.GetText(It.IsAny())).Returns("something"); - this.context.Services.AddSingleton(configurationService.Object); } [TearDown] diff --git a/COMETwebapp/Components/ParameterEditor/ParameterEditorBody.razor.cs b/COMETwebapp/Components/ParameterEditor/ParameterEditorBody.razor.cs index 493d74ca..da2925a3 100644 --- a/COMETwebapp/Components/ParameterEditor/ParameterEditorBody.razor.cs +++ b/COMETwebapp/Components/ParameterEditor/ParameterEditorBody.razor.cs @@ -46,7 +46,8 @@ protected override void OnViewModelAssigned() { base.OnViewModelAssigned(); - this.Disposables.Add(this.WhenAnyValue(x => x.ViewModel.OptionSelector.SelectedOption, + this.Disposables.Add(this.WhenAnyValue( + x => x.ViewModel.OptionSelector.SelectedOption, x => x.ViewModel.ParameterTypeSelector.SelectedParameterType, x => x.ViewModel.ElementSelector.SelectedElementBase, x => x.ViewModel.IsOwnedParameters) diff --git a/COMETwebapp/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModel.cs b/COMETwebapp/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModel.cs index 76b82d3c..c052926f 100644 --- a/COMETwebapp/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModel.cs +++ b/COMETwebapp/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModel.cs @@ -75,10 +75,12 @@ public ParameterEditorBodyViewModel(ISessionService sessionService, ISubscriptio this.ParameterTableViewModel = parameterTableView; this.BatchParameterEditorViewModel = batchParameterEditorViewModel; - this.Disposables.Add(this.WhenAnyValue(x => x.ElementSelector.SelectedElementBase, + this.Disposables.Add(this.WhenAnyValue( + x => x.ElementSelector.SelectedElementBase, x => x.OptionSelector.SelectedOption, x => x.ParameterTypeSelector.SelectedParameterType, - x => x.IsOwnedParameters).SubscribeAsync(_ => this.ApplyFilters())); + x => x.IsOwnedParameters) + .SubscribeAsync(_ => this.ApplyFilters())); this.InitializeSubscriptions(ObjectChangedTypesOfInterest); this.RegisterViewModelsWithReusableRows([this.ParameterTableViewModel]); @@ -173,20 +175,19 @@ protected override async Task OnThingChanged() { await base.OnThingChanged(); + this.IsLoading = true; + if (!this.HasSetInitialValuesOnce) { - this.IsLoading = true; - this.IsOwnedParameters = true; this.ElementSelector.CurrentIteration = this.CurrentThing; this.OptionSelector.CurrentIteration = this.CurrentThing; this.ParameterTypeSelector.CurrentIteration = this.CurrentThing; this.BatchParameterEditorViewModel.CurrentIteration = this.CurrentThing; - this.ParameterTableViewModel.InitializeViewModel(this.CurrentThing, this.CurrentDomain, this.OptionSelector.SelectedOption); - - this.IsLoading = false; } + this.ParameterTableViewModel.InitializeViewModel(this.CurrentThing, this.CurrentDomain, this.OptionSelector.SelectedOption); + await this.ApplyFilters(); this.IsLoading = false; } From 35267fa0900076a5dcaf8df239d5815c0f0ddbc0 Mon Sep 17 00:00:00 2001 From: Joao Rua Date: Mon, 29 Jul 2024 18:35:30 +0100 Subject: [PATCH 4/8] small improvs and test fixing #2 --- .../Pages/ParameterEditor/ParameterEditorTestFixture.cs | 2 +- .../ParameterEditor/ParameterEditorBodyViewModelTestFixture.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/COMETwebapp.Tests/Pages/ParameterEditor/ParameterEditorTestFixture.cs b/COMETwebapp.Tests/Pages/ParameterEditor/ParameterEditorTestFixture.cs index 1fc9f689..039df8d3 100644 --- a/COMETwebapp.Tests/Pages/ParameterEditor/ParameterEditorTestFixture.cs +++ b/COMETwebapp.Tests/Pages/ParameterEditor/ParameterEditorTestFixture.cs @@ -73,7 +73,7 @@ public class ParameterEditorTestFixture private Mock session; private Iteration firstIteration; private Iteration secondIteration; - private ICDPMessageBus messageBus; + private CDPMessageBus messageBus; [SetUp] public void Setup() diff --git a/COMETwebapp.Tests/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModelTestFixture.cs b/COMETwebapp.Tests/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModelTestFixture.cs index 6d0e1aba..a8a96009 100644 --- a/COMETwebapp.Tests/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModelTestFixture.cs +++ b/COMETwebapp.Tests/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModelTestFixture.cs @@ -244,7 +244,7 @@ public async Task VerifyApplyFilters() this.viewModel.ElementSelector.SelectedElementBase = this.viewModel.ElementSelector.AvailableElements.First(); await TaskHelper.WaitWhileAsync(() => this.viewModel.IsLoading); - this.tableViewModel.Verify(x => x.ApplyFilters(this.iteration.DefaultOption, this.viewModel.ElementSelector.SelectedElementBase, null, true), Times.Once); + this.tableViewModel.Verify(x => x.ApplyFilters(this.iteration.DefaultOption, this.viewModel.ElementSelector.SelectedElementBase, null, true), Times.AtLeastOnce); this.viewModel.ElementSelector.SelectedElementBase = null; await TaskHelper.WaitWhileAsync(() => this.viewModel.IsLoading); From 2987f53204eefd6e1a257bc1af972f3ea1c6802b Mon Sep 17 00:00:00 2001 From: Joao Rua Date: Mon, 29 Jul 2024 18:40:05 +0100 Subject: [PATCH 5/8] fixing wrong update --- .../Pages/ParameterEditor/ParameterEditorTestFixture.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/COMETwebapp.Tests/Pages/ParameterEditor/ParameterEditorTestFixture.cs b/COMETwebapp.Tests/Pages/ParameterEditor/ParameterEditorTestFixture.cs index 039df8d3..e01a4656 100644 --- a/COMETwebapp.Tests/Pages/ParameterEditor/ParameterEditorTestFixture.cs +++ b/COMETwebapp.Tests/Pages/ParameterEditor/ParameterEditorTestFixture.cs @@ -139,11 +139,11 @@ public void Setup() this.context.ConfigureDevExpressBlazor(); this.context.Services.AddSingleton(this.viewModel); this.context.Services.AddSingleton(this.sessionService.Object); - this.context.Services.AddSingleton(this.messageBus); this.context.Services.AddSingleton(mockConfigurationService.Object); this.context.Services.AddSingleton(parameterEditorBodyViewModel.Object); this.context.Services.AddSingleton(parameterTableViewModel.Object); this.context.Services.AddSingleton(configurationService.Object); + this.context.Services.AddSingleton(this.messageBus); this.context.Services.AddSingleton(); this.context.Services.AddSingleton(); this.context.Services.AddSingleton(); From e061a80c557d2c4e0efa810e612d2b0246725b3c Mon Sep 17 00:00:00 2001 From: Joao Rua Date: Tue, 30 Jul 2024 09:34:39 +0100 Subject: [PATCH 6/8] update to include sortedcollection attribute --- .../ParameterEditor/ParameterTable.razor | 2 +- .../ParameterEditor/ParameterTable.razor.cs | 48 +++++++++++++++++-- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/COMETwebapp/Components/ParameterEditor/ParameterTable.razor b/COMETwebapp/Components/ParameterEditor/ParameterTable.razor index 649a4e8a..0005ed75 100644 --- a/COMETwebapp/Components/ParameterEditor/ParameterTable.razor +++ b/COMETwebapp/Components/ParameterEditor/ParameterTable.razor @@ -66,7 +66,7 @@ public partial class ParameterTable { + /// + /// The + /// + private readonly ParameterBaseRowViewModelComparer comparer = new(); + /// /// to close the popup editor /// private EventCallback closeEditor; /// - /// The + /// The sorted collection of /// - private readonly ParameterBaseRowViewModelComparer comparer = new(); + private ReadOnlyObservableCollection sortedCollection; /// /// Gets or sets the @@ -56,6 +65,11 @@ public partial class ParameterTable [Parameter] public IParameterTableViewModel ViewModel { get; set; } + /// + /// Gets the current view model hash code to compare with new ones + /// + public int ViewModelHashCode { get; set; } + /// /// Gets or sets the grid control that is being customized. /// @@ -75,6 +89,34 @@ protected override void OnInitialized() this.closeEditor = new EventCallbackFactory().Create(this, () => { this.ViewModel.IsOnEditMode = false; }); } + /// + /// Method invoked when the component has received parameters from its parent in + /// the render tree, and the incoming values have been assigned to properties. + /// + protected override void OnParametersSet() + { + base.OnParametersSet(); + + if (this.ViewModel.GetHashCode() == this.ViewModelHashCode) + { + return; + } + + if (this.ViewModelHashCode != 0) + { + var latestViewModelRowsSubscription = this.Disposables.Last(); + latestViewModelRowsSubscription.Dispose(); + this.Disposables.Remove(latestViewModelRowsSubscription); + } + + this.Disposables.Add(this.ViewModel.Rows.Connect() + .Sort(this.comparer) + .Bind(out this.sortedCollection) + .Subscribe(_ => this.InvokeAsync(this.StateHasChanged))); + + this.ViewModelHashCode = this.ViewModel.GetHashCode(); + } + /// /// Customizes the table rows /// @@ -94,7 +136,7 @@ private void OnCustomizeElement(GridCustomizeElementEventArgs e) if (e.ElementType == GridElementType.GroupCell) { var elementBaseName = (string)e.Grid.GetRowValue(e.VisibleIndex, nameof(ParameterBaseRowViewModel.ElementBaseName)); - var isPublishableParameterInGroup = this.ViewModel.Rows.Items.Any(x => x.IsPublishable && x.ElementBaseName == elementBaseName); + var isPublishableParameterInGroup = this.sortedCollection.Any(x => x.IsPublishable && x.ElementBaseName == elementBaseName); if (isPublishableParameterInGroup) { From 8dc1816e9a668a572e352123862b8d14b13d20a8 Mon Sep 17 00:00:00 2001 From: Joao Rua Date: Tue, 30 Jul 2024 14:50:11 +0100 Subject: [PATCH 7/8] changes to solve two tabs from same panel bug TODO - Investigate viewmodel not reacting in side panel --- .../Applications/DynamicApplicationBase.razor | 2 +- .../DynamicApplicationBase.razor.cs | 6 ++++ .../ParameterEditor/ParameterTable.razor.cs | 31 ++----------------- .../Components/Tabs/TabsPanelComponent.razor | 3 +- .../Model/TabbedApplicationInformation.cs | 6 ++++ 5 files changed, 17 insertions(+), 31 deletions(-) diff --git a/COMET.Web.Common/Components/Applications/DynamicApplicationBase.razor b/COMET.Web.Common/Components/Applications/DynamicApplicationBase.razor index aac0d088..e72d4595 100644 --- a/COMET.Web.Common/Components/Applications/DynamicApplicationBase.razor +++ b/COMET.Web.Common/Components/Applications/DynamicApplicationBase.razor @@ -20,5 +20,5 @@ // limitations under the License. -------------------------------------------------------------------------------> - + diff --git a/COMET.Web.Common/Components/Applications/DynamicApplicationBase.razor.cs b/COMET.Web.Common/Components/Applications/DynamicApplicationBase.razor.cs index 6a4a5aa6..66b8d4c5 100644 --- a/COMET.Web.Common/Components/Applications/DynamicApplicationBase.razor.cs +++ b/COMET.Web.Common/Components/Applications/DynamicApplicationBase.razor.cs @@ -59,6 +59,12 @@ public partial class DynamicApplicationBase [Parameter] public Thing CurrentThing { get; set; } + /// + /// Gets or sets the component's id + /// + [Parameter] + public object Id { get; set; } + /// /// Gets the of parameters that have to be passed to the /// diff --git a/COMETwebapp/Components/ParameterEditor/ParameterTable.razor.cs b/COMETwebapp/Components/ParameterEditor/ParameterTable.razor.cs index 5936b05e..ec7597ba 100644 --- a/COMETwebapp/Components/ParameterEditor/ParameterTable.razor.cs +++ b/COMETwebapp/Components/ParameterEditor/ParameterTable.razor.cs @@ -65,11 +65,6 @@ public partial class ParameterTable [Parameter] public IParameterTableViewModel ViewModel { get; set; } - /// - /// Gets the current view model hash code to compare with new ones - /// - public int ViewModelHashCode { get; set; } - /// /// Gets or sets the grid control that is being customized. /// @@ -86,35 +81,13 @@ protected override void OnInitialized() this.Disposables.Add(this.WhenAnyValue(x => x.ViewModel.IsOnEditMode) .SubscribeAsync(_ => this.InvokeAsync(this.StateHasChanged))); - this.closeEditor = new EventCallbackFactory().Create(this, () => { this.ViewModel.IsOnEditMode = false; }); - } - - /// - /// Method invoked when the component has received parameters from its parent in - /// the render tree, and the incoming values have been assigned to properties. - /// - protected override void OnParametersSet() - { - base.OnParametersSet(); - - if (this.ViewModel.GetHashCode() == this.ViewModelHashCode) - { - return; - } - - if (this.ViewModelHashCode != 0) - { - var latestViewModelRowsSubscription = this.Disposables.Last(); - latestViewModelRowsSubscription.Dispose(); - this.Disposables.Remove(latestViewModelRowsSubscription); - } - this.Disposables.Add(this.ViewModel.Rows.Connect() + .AutoRefresh() .Sort(this.comparer) .Bind(out this.sortedCollection) .Subscribe(_ => this.InvokeAsync(this.StateHasChanged))); - this.ViewModelHashCode = this.ViewModel.GetHashCode(); + this.closeEditor = new EventCallbackFactory().Create(this, () => { this.ViewModel.IsOnEditMode = false; }); } /// diff --git a/COMETwebapp/Components/Tabs/TabsPanelComponent.razor b/COMETwebapp/Components/Tabs/TabsPanelComponent.razor index c80771de..c9ffc4a0 100644 --- a/COMETwebapp/Components/Tabs/TabsPanelComponent.razor +++ b/COMETwebapp/Components/Tabs/TabsPanelComponent.razor @@ -70,7 +70,8 @@
+ CurrentThing="this.Panel.CurrentTab.ObjectOfInterest as Thing" + Id="@(this.Panel.CurrentTab.Id)"/>
}
diff --git a/COMETwebapp/Model/TabbedApplicationInformation.cs b/COMETwebapp/Model/TabbedApplicationInformation.cs index c80f172d..0179bec0 100644 --- a/COMETwebapp/Model/TabbedApplicationInformation.cs +++ b/COMETwebapp/Model/TabbedApplicationInformation.cs @@ -42,6 +42,7 @@ public TabbedApplicationInformation(IApplicationBaseViewModel applicationBaseVie this.ApplicationBaseViewModel = applicationBaseViewModel; this.ComponentType = componentType; this.ObjectOfInterest = objectOfInterest; + this.Id = Guid.NewGuid(); } /// @@ -58,5 +59,10 @@ public TabbedApplicationInformation(IApplicationBaseViewModel applicationBaseVie /// Gets the object of interest /// public object ObjectOfInterest { get; } + + /// + /// Gets the tab's id + /// + public Guid Id { get; } } } From b6f19a4d21e4c479d96c5f5023bec3bead2b3a06 Mon Sep 17 00:00:00 2001 From: Joao Rua Date: Tue, 30 Jul 2024 19:56:28 +0100 Subject: [PATCH 8/8] updates to fix wrong behavior when in side panel --- ...ParameterEditorBodyViewModelTestFixture.cs | 26 +-------- .../ModelDashboard/ModelDashboardBody.razor | 2 +- .../ModelDashboardBody.razor.cs | 1 + .../ParameterEditorBody.razor.cs | 1 + .../SubscriptionDashboardBody.razor.cs | 1 + .../SystemRepresentationBody.razor.cs | 1 + .../Components/Viewer/ViewerBody.razor.cs | 1 + .../IModelDashboardBodyViewModel.cs | 5 ++ .../ModelDashboardBodyViewModel.cs | 55 ++++++++----------- .../IParameterEditorBodyViewModel.cs | 17 ++++-- .../ParameterEditorBodyViewModel.cs | 42 +++++--------- .../ISubscriptionDashboardBodyViewModel.cs | 6 ++ .../SubscriptionDashboardBodyViewModel.cs | 46 ++++++++-------- 13 files changed, 92 insertions(+), 112 deletions(-) diff --git a/COMETwebapp.Tests/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModelTestFixture.cs b/COMETwebapp.Tests/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModelTestFixture.cs index a8a96009..6cca26c6 100644 --- a/COMETwebapp.Tests/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModelTestFixture.cs +++ b/COMETwebapp.Tests/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModelTestFixture.cs @@ -242,33 +242,13 @@ public async Task VerifyApplyFilters() await TaskHelper.WaitWhileAsync(() => this.viewModel.IsLoading); this.viewModel.ElementSelector.SelectedElementBase = this.viewModel.ElementSelector.AvailableElements.First(); - await TaskHelper.WaitWhileAsync(() => this.viewModel.IsLoading); - - this.tableViewModel.Verify(x => x.ApplyFilters(this.iteration.DefaultOption, this.viewModel.ElementSelector.SelectedElementBase, null, true), Times.AtLeastOnce); - - this.viewModel.ElementSelector.SelectedElementBase = null; - await TaskHelper.WaitWhileAsync(() => this.viewModel.IsLoading); - this.viewModel.ParameterTypeSelector.SelectedParameterType = this.viewModel.ParameterTypeSelector.AvailableParameterTypes.First(); - await TaskHelper.WaitWhileAsync(() => this.viewModel.IsLoading); - - this.tableViewModel.Verify(x => x.ApplyFilters(this.iteration.DefaultOption, - null, this.viewModel.ParameterTypeSelector.SelectedParameterType, true), Times.Once); - - this.viewModel.ParameterTypeSelector.SelectedParameterType = null; - await TaskHelper.WaitWhileAsync(() => this.viewModel.IsLoading); - this.viewModel.OptionSelector.SelectedOption = this.viewModel.CurrentThing.Option.Last(); - await TaskHelper.WaitWhileAsync(() => this.viewModel.IsLoading); - - this.tableViewModel.Verify(x => x.ApplyFilters(this.iteration.Option.Last(), - null, null, true), Times.Once); - this.viewModel.IsOwnedParameters = false; - await TaskHelper.WaitWhileAsync(() => this.viewModel.IsLoading); - this.tableViewModel.Verify(x => x.ApplyFilters(this.iteration.Option.Last(), - null, null, false), Times.Once); + this.viewModel.ApplyFilters(); + + this.tableViewModel.Verify(x => x.ApplyFilters(It.IsAny
\ No newline at end of file +
diff --git a/COMETwebapp/Components/ModelDashboard/ModelDashboardBody.razor.cs b/COMETwebapp/Components/ModelDashboard/ModelDashboardBody.razor.cs index 8ec5e201..942b37c5 100644 --- a/COMETwebapp/Components/ModelDashboard/ModelDashboardBody.razor.cs +++ b/COMETwebapp/Components/ModelDashboard/ModelDashboardBody.razor.cs @@ -97,6 +97,7 @@ private void UpdateUrl(string pageName = WebAppConstantValues.ModelDashboardPage additionalParameters[QueryKeys.ParameterKey] = this.ViewModel.ParameterTypeSelector.SelectedParameterType.Iid.ToShortGuid(); } + this.ViewModel.UpdateDashboards(); this.UpdateUrlWithParameters(additionalParameters, pageName); } diff --git a/COMETwebapp/Components/ParameterEditor/ParameterEditorBody.razor.cs b/COMETwebapp/Components/ParameterEditor/ParameterEditorBody.razor.cs index da2925a3..c5063fdc 100644 --- a/COMETwebapp/Components/ParameterEditor/ParameterEditorBody.razor.cs +++ b/COMETwebapp/Components/ParameterEditor/ParameterEditorBody.razor.cs @@ -100,6 +100,7 @@ private void UpdateUrl() additionalParameters["owned"] = this.ViewModel.IsOwnedParameters.ToString(); } + this.ViewModel.ApplyFilters(); this.UpdateUrlWithParameters(additionalParameters, WebAppConstantValues.ParameterEditorPage); } } diff --git a/COMETwebapp/Components/SubscriptionDashboard/SubscriptionDashboardBody.razor.cs b/COMETwebapp/Components/SubscriptionDashboard/SubscriptionDashboardBody.razor.cs index e9eea248..43047ae8 100644 --- a/COMETwebapp/Components/SubscriptionDashboard/SubscriptionDashboardBody.razor.cs +++ b/COMETwebapp/Components/SubscriptionDashboard/SubscriptionDashboardBody.razor.cs @@ -98,6 +98,7 @@ private void UpdateUrl() additionalParameters[QueryKeys.ParameterKey] = this.ViewModel.ParameterTypeSelector.SelectedParameterType.Iid.ToShortGuid(); } + this.ViewModel.UpdateTables(); this.UpdateUrlWithParameters(additionalParameters, WebAppConstantValues.SubscriptionDashboardPage); } diff --git a/COMETwebapp/Components/SystemRepresentation/SystemRepresentationBody.razor.cs b/COMETwebapp/Components/SystemRepresentation/SystemRepresentationBody.razor.cs index be0e6d28..8ad765ca 100644 --- a/COMETwebapp/Components/SystemRepresentation/SystemRepresentationBody.razor.cs +++ b/COMETwebapp/Components/SystemRepresentation/SystemRepresentationBody.razor.cs @@ -77,6 +77,7 @@ private void UpdateUrl() additionalParameters[QueryKeys.OptionKey] = this.ViewModel.OptionSelector.SelectedOption.Iid.ToShortGuid(); } + this.ViewModel.ApplyFilters(); this.UpdateUrlWithParameters(additionalParameters, WebAppConstantValues.SystemRepresentationPage); } } diff --git a/COMETwebapp/Components/Viewer/ViewerBody.razor.cs b/COMETwebapp/Components/Viewer/ViewerBody.razor.cs index febceb2a..b48b6a50 100644 --- a/COMETwebapp/Components/Viewer/ViewerBody.razor.cs +++ b/COMETwebapp/Components/Viewer/ViewerBody.razor.cs @@ -138,6 +138,7 @@ private void UpdateUrl() additionalParameters["option"] = this.ViewModel.OptionSelector.SelectedOption.Iid.ToShortGuid(); } + this.ViewModel.InitializeViewModel(); this.UpdateUrlWithParameters(additionalParameters, WebAppConstantValues.ViewerPage); } } diff --git a/COMETwebapp/ViewModels/Components/ModelDashboard/IModelDashboardBodyViewModel.cs b/COMETwebapp/ViewModels/Components/ModelDashboard/IModelDashboardBodyViewModel.cs index a5eafafc..4cfeca92 100644 --- a/COMETwebapp/ViewModels/Components/ModelDashboard/IModelDashboardBodyViewModel.cs +++ b/COMETwebapp/ViewModels/Components/ModelDashboard/IModelDashboardBodyViewModel.cs @@ -59,5 +59,10 @@ public interface IModelDashboardBodyViewModel : ISingleIterationApplicationBaseV /// Gets the ///
IElementDashboardViewModel ElementDashboard { get; } + + /// + /// Update the dashboard view models properties + /// + void UpdateDashboards(); } } diff --git a/COMETwebapp/ViewModels/Components/ModelDashboard/ModelDashboardBodyViewModel.cs b/COMETwebapp/ViewModels/Components/ModelDashboard/ModelDashboardBodyViewModel.cs index 809782d4..54a1c44f 100644 --- a/COMETwebapp/ViewModels/Components/ModelDashboard/ModelDashboardBodyViewModel.cs +++ b/COMETwebapp/ViewModels/Components/ModelDashboard/ModelDashboardBodyViewModel.cs @@ -1,18 +1,18 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2023-2024 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 Starion 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. // -// The CDP4-COMET WEB Community Edition is free software; you can redistribute it and/or +// 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 CDP4-COMET WEB Community Edition is distributed in the hope that it will be useful, +// 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. @@ -28,7 +28,6 @@ namespace COMETwebapp.ViewModels.Components.ModelDashboard using CDP4Dal; - using COMET.Web.Common.Extensions; using COMET.Web.Common.Services.SessionManagement; using COMET.Web.Common.ViewModels.Components.Applications; using COMET.Web.Common.ViewModels.Components.Selectors; @@ -52,11 +51,6 @@ public class ModelDashboardBodyViewModel : SingleIterationApplicationBaseViewMod public ModelDashboardBodyViewModel(ISessionService sessionService, IParameterDashboardViewModel parameterDashboard, ICDPMessageBus messageBus) : base(sessionService, messageBus) { this.ParameterDashboard = parameterDashboard; - - this.Disposables.Add(this.WhenAnyValue(x => x.FiniteStateSelector.SelectedActualFiniteState, - x => x.OptionSelector.SelectedOption, - x => x.ParameterTypeSelector.SelectedParameterType) - .SubscribeAsync(_ => this.UpdateDashboards())); } /// @@ -89,6 +83,22 @@ public ModelDashboardBodyViewModel(ISessionService sessionService, IParameterDas /// public IParameterTypeSelectorViewModel ParameterTypeSelector { get; private set; } = new ParameterTypeSelectorViewModel(); + /// + /// Update the dashboard view models properties + /// + public void UpdateDashboards() + { + this.IsLoading = true; + + this.ParameterDashboard.UpdateProperties(this.CurrentThing, this.OptionSelector.SelectedOption, + this.FiniteStateSelector.SelectedActualFiniteState, this.ParameterTypeSelector.SelectedParameterType, + this.CurrentDomain, this.AvailableDomains); + + this.ElementDashboard.UpdateProperties(this.CurrentThing, this.CurrentDomain); + + this.IsLoading = false; + } + /// /// Handles the refresh of the current /// @@ -105,7 +115,7 @@ protected override Task OnSessionRefreshed() protected override async Task OnDomainChanged() { await base.OnDomainChanged(); - await this.UpdateDashboards(); + this.UpdateDashboards(); } /// @@ -124,24 +134,7 @@ protected override async Task OnThingChanged() : this.SessionService.GetModelDomains((EngineeringModelSetup)this.CurrentThing.IterationSetup.Container); this.CurrentDomain = this.CurrentThing == null ? null : this.SessionService.GetDomainOfExpertise(this.CurrentThing); - await this.UpdateDashboards(); - } - - /// - /// Update the dashboard view models properties - /// - /// A - private async Task UpdateDashboards() - { - this.IsLoading = true; - await Task.Delay(1); - - this.ParameterDashboard.UpdateProperties(this.CurrentThing, this.OptionSelector.SelectedOption, - this.FiniteStateSelector.SelectedActualFiniteState, this.ParameterTypeSelector.SelectedParameterType, - this.CurrentDomain, this.AvailableDomains); - - this.ElementDashboard.UpdateProperties(this.CurrentThing, this.CurrentDomain); - this.IsLoading = false; + this.UpdateDashboards(); } } } diff --git a/COMETwebapp/ViewModels/Components/ParameterEditor/IParameterEditorBodyViewModel.cs b/COMETwebapp/ViewModels/Components/ParameterEditor/IParameterEditorBodyViewModel.cs index 523bd2ed..6baa3241 100644 --- a/COMETwebapp/ViewModels/Components/ParameterEditor/IParameterEditorBodyViewModel.cs +++ b/COMETwebapp/ViewModels/Components/ParameterEditor/IParameterEditorBodyViewModel.cs @@ -1,18 +1,18 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2023-2024 Starion Group S.A. +// Copyright (c) 2024 Starion Group S.A. // -// Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Jaime Bernar, Théate Antoine +// 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 Starion 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. // -// The CDP4-COMET WEB Community Edition is free software; you can redistribute it and/or +// 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 CDP4-COMET WEB Community Edition is distributed in the hope that it will be useful, +// 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. @@ -69,5 +69,10 @@ public interface IParameterEditorBodyViewModel : ISingleIterationApplicationBase /// Gets or sets the /// IBatchParameterEditorViewModel BatchParameterEditorViewModel { get; set; } + + /// + /// Apply all the filters on the + /// + void ApplyFilters(); } } diff --git a/COMETwebapp/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModel.cs b/COMETwebapp/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModel.cs index c052926f..fe65e062 100644 --- a/COMETwebapp/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModel.cs +++ b/COMETwebapp/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModel.cs @@ -30,7 +30,6 @@ namespace COMETwebapp.ViewModels.Components.ParameterEditor using CDP4Dal; using CDP4Dal.Events; - using COMET.Web.Common.Extensions; using COMET.Web.Common.Services.SessionManagement; using COMET.Web.Common.ViewModels.Components.Applications; using COMET.Web.Common.ViewModels.Components.Selectors; @@ -75,13 +74,6 @@ public ParameterEditorBodyViewModel(ISessionService sessionService, ISubscriptio this.ParameterTableViewModel = parameterTableView; this.BatchParameterEditorViewModel = batchParameterEditorViewModel; - this.Disposables.Add(this.WhenAnyValue( - x => x.ElementSelector.SelectedElementBase, - x => x.OptionSelector.SelectedOption, - x => x.ParameterTypeSelector.SelectedParameterType, - x => x.IsOwnedParameters) - .SubscribeAsync(_ => this.ApplyFilters())); - this.InitializeSubscriptions(ObjectChangedTypesOfInterest); this.RegisterViewModelsWithReusableRows([this.ParameterTableViewModel]); } @@ -125,6 +117,18 @@ public bool IsOwnedParameters /// public IBatchParameterEditorViewModel BatchParameterEditorViewModel { get; set; } + /// + /// Apply all the filters on the + /// + public void ApplyFilters() + { + if (this.CurrentThing != null) + { + this.ParameterTableViewModel.ApplyFilters(this.OptionSelector.SelectedOption, this.ElementSelector.SelectedElementBase, + this.ParameterTypeSelector.SelectedParameterType, this.IsOwnedParameters); + } + } + /// /// Handles the refresh of the current /// @@ -160,7 +164,7 @@ protected override async Task OnDomainChanged() if (this.IsOwnedParameters) { - await this.ApplyFilters(); + this.ApplyFilters(); } this.IsLoading = false; @@ -187,26 +191,8 @@ protected override async Task OnThingChanged() } this.ParameterTableViewModel.InitializeViewModel(this.CurrentThing, this.CurrentDomain, this.OptionSelector.SelectedOption); - await this.ApplyFilters(); + this.ApplyFilters(); this.IsLoading = false; } - - /// - /// Apply all the filters on the - /// - /// A - private async Task ApplyFilters() - { - if (this.CurrentThing != null) - { - this.IsLoading = true; - await Task.Delay(1); - - this.ParameterTableViewModel.ApplyFilters(this.OptionSelector.SelectedOption, this.ElementSelector.SelectedElementBase, - this.ParameterTypeSelector.SelectedParameterType, this.IsOwnedParameters); - - this.IsLoading = false; - } - } } } diff --git a/COMETwebapp/ViewModels/Components/SubscriptionDashboard/ISubscriptionDashboardBodyViewModel.cs b/COMETwebapp/ViewModels/Components/SubscriptionDashboard/ISubscriptionDashboardBodyViewModel.cs index 1a1b6292..51bec14c 100644 --- a/COMETwebapp/ViewModels/Components/SubscriptionDashboard/ISubscriptionDashboardBodyViewModel.cs +++ b/COMETwebapp/ViewModels/Components/SubscriptionDashboard/ISubscriptionDashboardBodyViewModel.cs @@ -51,5 +51,11 @@ public interface ISubscriptionDashboardBodyViewModel : ISingleIterationApplicati /// Gets the /// IParameterTypeSelectorViewModel ParameterTypeSelector { get; } + + /// + /// Updates the and + /// + /// A + void UpdateTables(); } } diff --git a/COMETwebapp/ViewModels/Components/SubscriptionDashboard/SubscriptionDashboardBodyViewModel.cs b/COMETwebapp/ViewModels/Components/SubscriptionDashboard/SubscriptionDashboardBodyViewModel.cs index 45fd5033..64062df6 100644 --- a/COMETwebapp/ViewModels/Components/SubscriptionDashboard/SubscriptionDashboardBodyViewModel.cs +++ b/COMETwebapp/ViewModels/Components/SubscriptionDashboard/SubscriptionDashboardBodyViewModel.cs @@ -1,18 +1,18 @@ // -------------------------------------------------------------------------------------------------------------------- // -// Copyright (c) 2023-2024 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 Starion 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. // -// The CDP4-COMET WEB Community Edition is free software; you can redistribute it and/or +// 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 CDP4-COMET WEB Community Edition is distributed in the hope that it will be useful, +// 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. @@ -46,14 +46,14 @@ public class SubscriptionDashboardBodyViewModel : SingleIterationApplicationBase /// /// The /// The - /// The + /// The public SubscriptionDashboardBodyViewModel(ISessionService sessionService, ISubscribedTableViewModel subscribedTable, ICDPMessageBus messageBus) : base(sessionService, messageBus) { this.SubscribedTable = subscribedTable; this.Disposables.Add(this.WhenAnyValue(x => x.OptionSelector.SelectedOption, x => x.ParameterTypeSelector.SelectedParameterType) - .SubscribeAsync(_ => this.UpdateTables())); + .Subscribe(_ => this.UpdateTables())); } /// @@ -76,6 +76,20 @@ public SubscriptionDashboardBodyViewModel(ISessionService sessionService, ISubsc /// public IParameterTypeSelectorViewModel ParameterTypeSelector { get; } = new ParameterTypeSelectorViewModel(); + /// + /// Updates the and + /// + /// A + public void UpdateTables() + { + this.IsLoading = true; + + this.SubscribedTable.ApplyFilters(this.OptionSelector.SelectedOption, this.ParameterTypeSelector.SelectedParameterType); + this.DomainOfExpertiseSubscriptionTable.ApplyFilters(this.OptionSelector.SelectedOption, this.ParameterTypeSelector.SelectedParameterType); + + this.IsLoading = false; + } + /// /// Update this view model properties when the has changed /// @@ -112,7 +126,7 @@ protected override async Task OnThingChanged() protected override async Task OnSessionRefreshed() { await this.OnThingChanged(); - await this.UpdateTables(); + this.UpdateTables(); } /// @@ -124,19 +138,5 @@ protected override Task OnDomainChanged() base.OnDomainChanged(); return this.OnThingChanged(); } - - /// - /// Updates the and - /// - /// A - private async Task UpdateTables() - { - this.IsLoading = true; - await Task.Delay(1); - - this.SubscribedTable.ApplyFilters(this.OptionSelector.SelectedOption, this.ParameterTypeSelector.SelectedParameterType); - this.DomainOfExpertiseSubscriptionTable.ApplyFilters(this.OptionSelector.SelectedOption, this.ParameterTypeSelector.SelectedParameterType); - this.IsLoading = false; - } } }