From 5eba6a88fb6ed27e456074aedb5302bb9e8925be Mon Sep 17 00:00:00 2001 From: MariusVuscanNx <96233009+MariusVuscanNx@users.noreply.github.com> Date: Thu, 12 Dec 2024 18:11:35 +0200 Subject: [PATCH] Fixed display of log persistance type input (#338) Co-authored-by: Sipke Schoorstra --- .../Properties/Sections/Settings/Settings.razor | 11 ++++++----- .../Properties/Sections/Settings/Settings.razor.cs | 13 +++++-------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/modules/Elsa.Studio.Workflows/Components/WorkflowDefinitionEditor/Components/WorkflowProperties/Tabs/Properties/Sections/Settings/Settings.razor b/src/modules/Elsa.Studio.Workflows/Components/WorkflowDefinitionEditor/Components/WorkflowProperties/Tabs/Properties/Sections/Settings/Settings.razor index 3ff0e0fa..50a63f89 100644 --- a/src/modules/Elsa.Studio.Workflows/Components/WorkflowDefinitionEditor/Components/WorkflowProperties/Tabs/Properties/Sections/Settings/Settings.razor +++ b/src/modules/Elsa.Studio.Workflows/Components/WorkflowDefinitionEditor/Components/WorkflowProperties/Tabs/Properties/Sections/Settings/Settings.razor @@ -28,7 +28,7 @@ } - @foreach (var strategy in _logPersistenceStrategyDescriptors) { - @(strategy.DisplayName) + @(strategy.DisplayName ?? "Inherit") } diff --git a/src/modules/Elsa.Studio.Workflows/Components/WorkflowDefinitionEditor/Components/WorkflowProperties/Tabs/Properties/Sections/Settings/Settings.razor.cs b/src/modules/Elsa.Studio.Workflows/Components/WorkflowDefinitionEditor/Components/WorkflowProperties/Tabs/Properties/Sections/Settings/Settings.razor.cs index b66d1436..6443e790 100644 --- a/src/modules/Elsa.Studio.Workflows/Components/WorkflowDefinitionEditor/Components/WorkflowProperties/Tabs/Properties/Sections/Settings/Settings.razor.cs +++ b/src/modules/Elsa.Studio.Workflows/Components/WorkflowDefinitionEditor/Components/WorkflowProperties/Tabs/Properties/Sections/Settings/Settings.razor.cs @@ -46,6 +46,7 @@ public partial class Settings private ICollection _logPersistenceStrategyDescriptors = new List(); private WorkflowActivationStrategyDescriptor? _selectedActivationStrategy; private IncidentStrategyDescriptor? _selectedIncidentStrategy; + private LogPersistenceStrategyDescriptor? _selectedLogPersistenceStrategy; private LogPersistenceConfiguration? _logPersistenceConfiguration; /// @@ -55,15 +56,10 @@ protected override async Task OnInitializedAsync() var incidentStrategies = (await IncidentStrategiesProvider.GetIncidentStrategiesAsync()).ToList(); _incidentStrategies = new IncidentStrategyDescriptor?[] { default }.Concat(incidentStrategies).ToList(); _logPersistenceStrategyDescriptors = (await LogPersistenceStrategyService.GetLogPersistenceStrategiesAsync()).ToList(); - _selectedActivationStrategy = _activationStrategies.FirstOrDefault(x => x.TypeName == WorkflowDefinition!.Options.ActivationStrategyType) ?? _activationStrategies.FirstOrDefault(); _selectedIncidentStrategy = _incidentStrategies.FirstOrDefault(x => x?.TypeName == WorkflowDefinition!.Options.IncidentStrategyType) ?? _incidentStrategies.FirstOrDefault(); - } - - protected override Task OnParametersSetAsync() - { _logPersistenceConfiguration = GetLogPersistenceConfiguration(); - return base.OnParametersSetAsync(); + _selectedLogPersistenceStrategy = _logPersistenceStrategyDescriptors.FirstOrDefault(x => x.TypeName == _logPersistenceConfiguration?.StrategyType) ?? _logPersistenceStrategyDescriptors.FirstOrDefault(); } private LogPersistenceMode? GetLegacyGetLogPersistenceMode() @@ -134,13 +130,14 @@ private async Task OnIncidentStrategyChanged(IncidentStrategyDescriptor? value) await RaiseWorkflowUpdatedAsync(); } - private async Task OnLogPersistenceStrategyChanged(string? value) + private async Task OnLogPersistenceStrategyChanged(LogPersistenceStrategyDescriptor? value) { + _selectedLogPersistenceStrategy = value; var currentConfig = _logPersistenceConfiguration; var newConfig = new LogPersistenceConfiguration { EvaluationMode = LogPersistenceEvaluationMode.Strategy, - StrategyType = value, + StrategyType = value?.TypeName, Expression = currentConfig?.Expression }; await UpdateLogPersistenceConfigAsync(newConfig);