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; }