Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
sfmskywalker committed Dec 12, 2024
2 parents cd5d31c + 5eba6a8 commit a1453d5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
}
</MudSelect>
<MudSelect
T="IncidentStrategyDescriptor?"
T="IncidentStrategyDescriptor"
Label="@Localizer["Incident handling strategy"]"
Variant="@Variant.Outlined"
Value="@_selectedIncidentStrategy"
Expand All @@ -48,19 +48,20 @@
DisplayName="@Localizer["Log Persistence Strategy"]"
Description="@Localizer["Enter the expression that will be used to determine the log persistence strategy for this property."]"
ReadOnly="IsReadOnly">
<MudSelect
T="string"
<MudSelect
T="LogPersistenceStrategyDescriptor"
Label="@Localizer["Log Persistence Strategy"]"
Variant="@Variant.Outlined"
Value="@_logPersistenceConfiguration?.StrategyType"
Value="@_selectedLogPersistenceStrategy"
ToStringFunc="@(x => x?.DisplayName ?? "Inherit")"
ValueChanged="@OnLogPersistenceStrategyChanged"
ReadOnly="IsReadOnly"
Disabled="IsReadOnly"
HelperText="@Localizer["Select the log persistence strategy to use for activity properties of this workflow."]"
>
@foreach (var strategy in _logPersistenceStrategyDescriptors)
{
<MudSelectItem T="string" Value="@strategy.TypeName">@(strategy.DisplayName)</MudSelectItem>
<MudSelectItem T="LogPersistenceStrategyDescriptor" Value="@strategy">@(strategy.DisplayName ?? "Inherit")</MudSelectItem>
}
</MudSelect>
</ExpressionEditor>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public partial class Settings
private ICollection<LogPersistenceStrategyDescriptor> _logPersistenceStrategyDescriptors = new List<LogPersistenceStrategyDescriptor>();
private WorkflowActivationStrategyDescriptor? _selectedActivationStrategy;
private IncidentStrategyDescriptor? _selectedIncidentStrategy;
private LogPersistenceStrategyDescriptor? _selectedLogPersistenceStrategy;
private LogPersistenceConfiguration? _logPersistenceConfiguration;

/// <inheritdoc />
Expand All @@ -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()
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit a1453d5

Please sign in to comment.