-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Configures Flowchart Execution via DI #7141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 7 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
a99a6c3
Introduce `FlowchartExecutionMode` to streamline flowchart execution …
sfmskywalker 9ed5cde
Add support for configuring flowchart execution behavior via `Flowcha…
sfmskywalker 9dc2129
Update default Flowchart execution settings to align with version 3.5…
sfmskywalker 6ef97bd
Update src/modules/Elsa.Workflows.Core/Activities/Flowchart/Models/Fl…
sfmskywalker 5d4afa2
Update src/modules/Elsa.Workflows.Core/Activities/Flowchart/Extension…
sfmskywalker 061476d
Update test/integration/Elsa.Workflows.IntegrationTests/Scenarios/Flo…
sfmskywalker 713d48f
Update src/modules/Elsa.Workflows.Core/Activities/Flowchart/Extension…
sfmskywalker 7732163
Refactor flowchart integration tests for improved formatting and cons…
sfmskywalker 3c4596f
Refactor workflow tests and related services to improve reusability a…
sfmskywalker 24203e2
Merge remote-tracking branch 'origin/enh/flowchart-token-toggle' into…
sfmskywalker 8cb3368
Update src/modules/Elsa.Workflows.Core/Activities/Flowchart/Options/F…
sfmskywalker 9b53ce0
Refactor flowchart execution logic to use `FlowchartExecutionMode` en…
sfmskywalker 25be18f
Merge remote-tracking branch 'origin/enh/flowchart-token-toggle' into…
sfmskywalker 87aab09
Refactor tests and workflow logic to replace boolean `useTokenFlow` w…
sfmskywalker 971b40a
Refactor flowchart execution logic to centralize mode-based behavior …
sfmskywalker 58c610b
Remove unnecessary whitespace in Flowchart.cs to improve code formatting
sfmskywalker ad3cef6
Remove unnecessary whitespace in FlowJoinTests.cs to improve code for…
sfmskywalker b9aaab8
Update src/common/Elsa.Testing.Shared.Integration/WorkflowTestFixture.cs
sfmskywalker ab9f637
Update src/modules/Elsa.Workflows.Core/Activities/Flowchart/Activitie…
sfmskywalker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...modules/Elsa.Workflows.Core/Activities/Flowchart/Extensions/FlowchartFeatureExtensions.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| using Elsa.Workflows.Activities.Flowchart.Models; | ||
| using Elsa.Workflows.Activities.Flowchart.Options; | ||
| using Elsa.Workflows.Features; | ||
|
|
||
| namespace Elsa.Workflows.Activities.Flowchart.Extensions; | ||
|
|
||
| /// <summary> | ||
| /// Extension methods for <see cref="FlowchartFeature"/>. | ||
| /// </summary> | ||
| public static class FlowchartFeatureExtensions | ||
| { | ||
| extension(FlowchartFeature feature) | ||
| { | ||
| /// <summary> | ||
| /// Configures the flowchart options. | ||
| /// </summary> | ||
| public FlowchartFeature ConfigureFlowchart(Action<FlowchartOptions> configure) | ||
| { | ||
| feature.FlowchartOptionsConfigurator = configure; | ||
| return feature; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Sets the default execution mode for flowcharts to token-based. | ||
| /// </summary> | ||
| public FlowchartFeature UseTokenBasedExecution() | ||
| { | ||
| return feature.ConfigureFlowchart(options => options.DefaultExecutionMode = FlowchartExecutionMode.TokenBased); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Sets the default execution mode for flowcharts to counter-based (legacy mode). | ||
| /// </summary> | ||
| public FlowchartFeature UseCounterBasedExecution() | ||
| { | ||
| return feature.ConfigureFlowchart(options => options.DefaultExecutionMode = FlowchartExecutionMode.CounterBased); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Sets the default execution mode for flowcharts to the specified mode. | ||
| /// </summary> | ||
|
sfmskywalker marked this conversation as resolved.
|
||
| public FlowchartFeature UseExecution(FlowchartExecutionMode mode) | ||
| { | ||
| return feature.ConfigureFlowchart(options => options.DefaultExecutionMode = mode); | ||
| } | ||
| } | ||
| } | ||
39 changes: 39 additions & 0 deletions
39
...dules/Elsa.Workflows.Core/Activities/Flowchart/Extensions/RunWorkflowOptionsExtensions.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| using Elsa.Workflows.Activities.Flowchart.Models; | ||
| using Elsa.Workflows.Options; | ||
|
|
||
| namespace Elsa.Workflows.Activities.Flowchart.Extensions; | ||
|
|
||
| /// <summary> | ||
| /// Extension methods for <see cref="RunWorkflowOptions"/> to configure flowchart execution mode. | ||
| /// </summary> | ||
| public static class RunWorkflowOptionsExtensions | ||
| { | ||
| extension(RunWorkflowOptions options) | ||
| { | ||
| /// <summary> | ||
| /// Sets the flowchart execution mode to token-based. | ||
| /// </summary> | ||
| public RunWorkflowOptions WithTokenBasedFlowchart() | ||
| { | ||
| return options.WithFlowchartExecutionMode(FlowchartExecutionMode.TokenBased); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Sets the flowchart execution mode to counter-based (legacy mode). | ||
| /// </summary> | ||
| public RunWorkflowOptions WithCounterBasedFlowchart() | ||
| { | ||
| return options.WithFlowchartExecutionMode(FlowchartExecutionMode.CounterBased); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Sets the flowchart execution mode. | ||
| /// </summary> | ||
| public RunWorkflowOptions WithFlowchartExecutionMode(FlowchartExecutionMode mode) | ||
| { | ||
| options.Properties ??= new Dictionary<string, object>(); | ||
| options.Properties[Elsa.Workflows.Activities.Flowchart.Activities.Flowchart.ExecutionModePropertyKey] = mode; | ||
| return options; | ||
| } | ||
| } | ||
| } |
22 changes: 22 additions & 0 deletions
22
src/modules/Elsa.Workflows.Core/Activities/Flowchart/Models/FlowchartExecutionMode.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| namespace Elsa.Workflows.Activities.Flowchart.Models; | ||
|
|
||
| /// <summary> | ||
| /// Specifies the execution mode for flowchart activities. | ||
| /// </summary> | ||
| public enum FlowchartExecutionMode | ||
| { | ||
| /// <summary> | ||
| /// Use the default mode as specified by <see cref="Elsa.Workflows.Activities.Flowchart.Flowchart.UseTokenFlow"/>. | ||
|
Check warning on line 9 in src/modules/Elsa.Workflows.Core/Activities/Flowchart/Models/FlowchartExecutionMode.cs
|
||
| /// </summary> | ||
|
sfmskywalker marked this conversation as resolved.
|
||
| Default = 0, | ||
|
|
||
| /// <summary> | ||
| /// Use token-based flow logic. | ||
| /// </summary> | ||
| TokenBased = 1, | ||
|
|
||
| /// <summary> | ||
| /// Use counter-based flow logic (legacy mode). | ||
| /// </summary> | ||
| CounterBased = 2 | ||
| } | ||
15 changes: 15 additions & 0 deletions
15
src/modules/Elsa.Workflows.Core/Activities/Flowchart/Options/FlowchartOptions.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| using Elsa.Workflows.Activities.Flowchart.Models; | ||
|
|
||
| namespace Elsa.Workflows.Activities.Flowchart.Options; | ||
|
|
||
| /// <summary> | ||
| /// Options for configuring flowchart execution behavior. | ||
| /// </summary> | ||
| public class FlowchartOptions | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the default execution mode for flowcharts when not explicitly specified. | ||
| /// Defaults to <see cref="FlowchartExecutionMode.TokenBased"/>. | ||
|
sfmskywalker marked this conversation as resolved.
Outdated
|
||
| /// </summary> | ||
| public FlowchartExecutionMode DefaultExecutionMode { get; set; } = FlowchartExecutionMode.CounterBased; // Default to counter-based in order to maintain the same behavior with 3.5.2 out of the box. | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.