Commit graph

4884 commits

Author SHA1 Message Date
Sipke Schoorstra 0eb01c01f3
Add SearchTerm to Workflow Definitions List API client (#5035)
* Refactor search filtering and move ListWorkflowDefinitionsRequest file

Updated the searching mechanism in `WorkflowDefinitionFilter.cs` by validating that Name and Description are not null before performing the search. In `ListWorkflowDefinitionsRequest.cs`, the file was moved from the Responses namespace to Requests and a new property `SearchTerm` was added, allowing filtering of workflow definitions by their name, ID or description.

* Update code style settings for csproj

The .DotSettings file for the project has been adjusted with changes to code naming rules and settings migration. These modifications adjust policies for naming conventions of Instance and Static fields, enhancing code style conformance. Also, an additional settings migration rule has been applied.

* Add 'issue/*' branch to GitHub actions workflow

The GitHub actions workflow has been updated to include the 'issue/*' branch. This ensures that any changes made in the 'issue/*' branches will trigger the workflow and any associated tests or builds, improving the overall continuous integration process.

* Remove Skip and Take methods from SqlServerDialect

The mentioned functions have been removed from SqlServerDialect class in the Elsa.Dapper module. The base class provides the correct default implementation for the SQL Server dialect.
2024-03-05 07:31:59 +01:00
raymonddenhaan aa00e37993
Added logging to pinpoint issue #5033 (#5034) 2024-03-04 20:02:08 +01:00
faith 87428bcafe
Fix incorrect comment information in EFCoreWorkflowInboxMessageStore (#4979) 2024-02-29 20:25:03 +01:00
Isaac Hayes 5aa1ce85e6
Fix Security Bug: No permissions applied to version endpoints (#5008)
List,Delete, and Revert endpoints for editing endpoints by version were set to allow anonymous, meaning no authorisation policies were applied.

I have changed these to apply permissions as per the rest of the API.
2024-02-28 13:23:43 +01:00
Sipke Schoorstra ce27c9a279
Respond with 500 in case of Incidents (#5004)
* Modify error handling in Workflow middleware

The handling for workflow faults in the Workflow Middleware has been altered. Previously, the code was checking if the workflow state status was designated as 'Faulted'. Now it checks if there are any incidents or problems in the workflow state, which provides a more comprehensive fault check.

* Prevent deletion of all records with empty conditions

Added checks in the 'Delete' and 'PagedDelete' methods in the 'Store.cs' file to prevent the deletion of all records if the conditions are empty. This will protect the system from unintentional data loss by stopping the execution of these methods when they have no parameters.
2024-02-28 09:46:24 +01:00
Sipke Schoorstra 66a620b7d9
Disable Dapper and integrate EFCore.BulkExtensions.MIT package (#5005)
The changes involve turning off the use of Dapper in Elsa.Server.Web project for database operations. In addition, the `EFCore.BulkExtensions.MIT` has been added in the Elsa.EntityFrameworkCore.Common project as a package reference. The BulkUpsertAsync function has been refactored to utilize the BulkInsertOrUpdateAsync function provided by the BulkExtensions package, streamlining the operation. The related package versions have also been introduced in the Directory.Packages.props file.
2024-02-28 09:12:00 +01:00
Sipke Schoorstra d0736e5e88 Add dependency on InstanceManagementFeature
The AzureServiceBusFeature and RabbitMqServiceBusFeature in the Elsa.MassTransit module now have an added dependency on the InstanceManagementFeature. This change ensures the proper sequencing of feature initialization, enabling improved management of instances.
2024-02-26 15:21:33 +01:00
Sipke Schoorstra 330dc1a0d7
Fix Dapper Provider (#4998)
* Update Dapper for better support and pagination

The update includes a significant enhancement to the Dapper module. Improvements were made to support SQL Server and enhanced SQL query pagination. Additionally, table column size was increased for various fields to handle more extensive data. Minor refactoring was also done to improve code readability.

* Toggle SQL Server usage in Elsa Server

The previous setting had SQL Server usage in Elsa server enabled by default. This commit changes the useSqlServer constant in Elsa.Server.Web to false, effectively switching SQL Server off unless manually activated.
2024-02-25 20:36:31 +01:00
Sipke Schoorstra e48c5e2075 Enable Dapper and update its service registration
The Dapper usage flag has been set to true in the Elsa.Server.Web program. Additionally, in the Dapper feature, the DbConnectionProvider is now registered as a singleton instead of scoped, reflecting changes in the database connection strategy.
2024-02-25 14:23:46 +01:00
Sipke Schoorstra 4c41863e47 Disable Azure ServiceBus and RabbitMQ setup in Elsa Server
The changes made in the code comments out the sections where Azure ServiceBus and RabbitMQ were previously set up for the Elsa Server. This likely disables the respective services until the necessary configurations are uncommented or modified in the future.
2024-02-25 13:43:42 +01:00
Sipke Schoorstra 2f50470480 Update Docker commands in README
The Docker commands in README.md have been updated to pull the latest version of elsa-server-and-studio container instead of elsa-v3. Additionally, a new environment variable `HTTP__BASEURL` was added to the `docker run` command for configuration purposes.
2024-02-25 13:38:48 +01:00
Sipke Schoorstra 1caba6ddd6 Normalize collections in WorkflowManagementFeature
This commit ensures uniqueness within the 'ActivityTypes' and 'VariableDescriptors' collections in the WorkflowManagementFeature. 'ActivityTypes' has been updated to only add distinct activity types, and 'VariableDescriptors' has been refined to only add descriptors with unique 'Type' properties.
2024-02-25 13:33:38 +01:00
Sipke Schoorstra 7b0871750d Merge branch 'main' of https://github.com/elsa-workflows/elsa-core 2024-02-25 13:27:19 +01:00
Sipke Schoorstra 32827e7f5b Add RequiresUnreferencedCode attributes to methods
New RequiresUnreferencedCode attributes have been added to the Configure() methods in IFeature.cs and FeatureBase.cs. These attributes indicate that the assembly containing the specified marker type will be scanned for activity types.
2024-02-25 13:27:03 +01:00
Sipke Schoorstra 44b07ddae0 Modify data types in WorkflowManagementFeature
Expanded the primitive data types representations by adding int and float types in WorkflowManagementFeature. Removed the unused System.IO.Compression import to improve code cleanliness and maintainability.

Closes #4971
2024-02-25 13:26:55 +01:00
Christoph Keller 647e4f05a5
Example: added MassTransit triggered workflow example-project (#4968) (#4981)
* Added example for a programatic MassTransit triggered workflow (#4968)

* Fixed MassTransitActivities example to include the MassTransitDispatcher (#4968)
2024-02-25 10:07:28 +01:00
Sipke Schoorstra 640e888e1a Update serializer and dependencies in ConsoleApp
The code now uses IWorkflowSerializer instead of IActivitySerializer for deserialization in the Console application. This change also entailed updating imports, specifically replacing Elsa.Workflows.Activities with Elsa.Workflows.Management.Contracts.
2024-02-24 19:38:53 +01:00
raymonddenhaan 937398e351
Added workflow instance and bulk cancellation to the UI (#4965)
* Fixed issue where updated and finished date where not set when cancelling a workflow

* Single instance cancellation

* Updated bulk cancellation to allow multiple options

* Fixed counting of bulk cancellation

* Added proto actor implementation for batch cancellation

* Moved bulk cancellation method to separate service

---------

Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
2024-02-23 10:26:13 +01:00
Sipke Schoorstra 5f47cd0aab
Implement distributed lock for registry population (#4983)
* Implement distributed lock for registry population

Added distributed lock in 'PopulateRegistriesHostedService' to prevent concurrent registry updates. Also implemented a semaphore in 'DefaultWorkflowDefinitionStorePopulator' to control access to shared resources during add or update operations. This change helps to ensure the integrity and consistency of the workflow registries.

* Refactor dependency injection for IDistributedLockProvider

* Refactor option classes to parameter classes in workflow runtime

This refactoring enhances the clarity of the Elsa Workflow runtime by renaming "options" classes to "parameters" classes. The name "options" misrepresented the classes' role and created confusion, as they are used to parameterize method calls rather than to configure services. The change applies to various workflow methods and tests across the project.
2024-02-22 19:37:03 +01:00
raymonddenhaan 2710d6e7af
Merge pull request #4941 from elsa-workflows/feature/service-bus-pub-sub
Introduced messaging to running instances
2024-02-22 14:16:33 +01:00
Raymond den Haan 459a9ae288 Used systemclock over datetime 2024-02-21 14:24:37 +01:00
Raymond den Haan 1f28215565 Scoped admin client to singleton 2024-02-21 14:24:22 +01:00
Sipke Schoorstra f37b3c424b Expand triggers and branches for GitHub Actions
The GitHub Actions configuration has been updated to also trigger on Push events and Workflow Dispatch events. OnPushBranches and OnPullRequestBranches now also include branches prefixed with 'feature', 'patch', 'fix', and 'enhancement'. This is reflected in both the Build.CI.GitHubActions.cs file and the packages.yml GitHub workflow.
2024-02-21 11:26:09 +01:00
Sipke Schoorstra 662a076726 Add simulated latency middleware
A new middleware, SimulatedLatencyMiddleware, has been added to simulate latency in a designated range. This can be used for testing purposes by delaying a request for a random amount of time. Additionally, an extension method for IApplicationBuilder has been implemented to conveniently add this functionality to the application's pipeline.
2024-02-21 09:25:59 +01:00
Raymond den Haan d4e7c7d68d Removed versions from hosting project 2024-02-20 13:50:55 +01:00
Raymond den Haan 61429adbff Fixed orphaned solution references 2024-02-20 13:46:22 +01:00
Raymond den Haan ab3ee3ee1c Merge branch 'main' into feature/service-bus-pub-sub
# Conflicts:
#	src/modules/Elsa.MassTransit.AzureServiceBus/Features/AzureServiceBusFeature.cs
#	src/modules/Elsa.MassTransit.RabbitMq/Features/RabbitMqServiceBusFeature.cs
#	src/modules/Elsa.MassTransit/Features/MassTransitWorkflowDispatcherFeature.cs
#	src/modules/Elsa.MassTransit/Implementations/MassTransitWorkflowDispatcher.cs
#	src/modules/Elsa.MassTransit/Services/MassTransitWorkflowCancellationDispatcher.cs
#	src/modules/Elsa.Workflows.Runtime/Responses/DispatchWorkflowDefinitionResponse.cs
2024-02-20 13:34:29 +01:00
ayalros 26518a3759
#4963 - elastic store workflowinstance search fix (#4964)
Co-authored-by: אייל רוסמן <ayalr@edanel.co.il>
2024-02-20 11:52:41 +01:00
Sipke Schoorstra 1df8085eb0 Refactor code and update comments for better readability
Major refactoring done across several files in the src/modules directory. This includes simplifying complex sections of code, removing extraneous comments, and improving the clarity of existing comments. In addition, method names and certain variable names were updated to more accurately reflect their function.
2024-02-20 11:26:52 +01:00
Sipke Schoorstra e85f45ed62 Refactor heartbeat property names and definitions
The names for properties related to instance heartbeats have been refactored, providing clearer semantics. 'InstanceHeartbeatRhythm' changed to 'Interval', and 'HeartbeatTimeoutPeriod' to 'Timeout'. This change impacts the property name in the HeartbeatOptions class and anywhere else it is referenced, including the appsettings.json file.
2024-02-20 10:56:05 +01:00
Raymond den Haan 78bea4be7f Moved KeyValueStore to separate feature 2024-02-19 10:39:07 +01:00
Sipke Schoorstra c80f80fd81
Enhanced Workflow Instance Filters (#4957)
* Add timestamp filtering for workflow instances

Implemented a new feature in the workflow instances' querying API, enabling filtering based on timestamps. The changes include adding a new TimestampFilter class and modifying existing classes accordingly. This new filter supports various operators such as greater than and less than, providing flexibility in filtering workflow instances.

* Improve timestamp filtering efficiency and update UI in WorkflowInstanceList

Timestamp filtering within WorkflowInstanceList is refactored using System.Linq.Dynamic.Core for more compact expression. This change results in simpler and more efficient code, reducing repetitive code lines. The UI updates include changing the MudGrid structure to table for timestamp filters display, offering a more organized view. Also, protection against null or minimum date values during parsing and comparisons is added, increasing stability and safety of operations.

* Refactor HTTP verbs and routes configuration in Endpoint.cs

The previous Get and Post method calls for handling '/workflow-instances' have been replaced with a Verbs method for HTTP verbs and a Routes method for setting the route.

* Update WorkflowInstanceFilter to use nullable HasIncidents

The HasIncidents property in WorkflowInstanceFilter has been updated from a bool to a nullable bool so that it can represent three states (true, false, or null) instead of only two. This allows not only to filter workflow instances that have incidents, but also those that don't have any, enhancing the flexibility of the filter in the process.

* Improve search functionality and UI in WorkflowInstanceList

Updated search term comparison in WorkflowInstanceFilter to use "Contains" instead of "Equals" to improve search flexibility. Also, enhanced the user interface in WorkflowInstanceList by adding debounce interval for the search input for performance reasons and by adding a Close button for convenience.

* Add input validation to WorkflowInstances endpoint

The code modifies the API endpoint for WorkflowInstances. It now checks that the input provided in the request is valid before proceeding. Furthermore, a new file called 'RequiredMembers.cs' has been added, which introduces two new attributes 'RequiredMemberAttribute' and 'CompilerFeatureRequiredAttribute'.

* Update src/modules/Elsa.Workflows.Management/Models/TimestampFilter.cs

Co-authored-by: Béchir BEN AMEUR <32399944+bbenameur@users.noreply.github.com>

* Update src/modules/Elsa.Workflows.Management/Models/TimestampFilter.cs

Co-authored-by: Béchir BEN AMEUR <32399944+bbenameur@users.noreply.github.com>

* Update src/modules/Elsa.Workflows.Management/Models/TimestampFilter.cs

Co-authored-by: Béchir BEN AMEUR <32399944+bbenameur@users.noreply.github.com>

---------

Co-authored-by: Béchir BEN AMEUR <32399944+bbenameur@users.noreply.github.com>
2024-02-18 23:40:03 +01:00
Marko Lahma 01c34e6b13
Add PR workflow (#4956) 2024-02-18 23:36:24 +01:00
Inx51 c3f95bddc3
Removed references to packages that are not used (#4952)
Removed references to multiple packages that are not used within the project and some (Microsoft.AspNetCore.X) packages were deprecated and should not be used.
2024-02-17 09:38:22 +01:00
Béchir BEN AMEUR f7e224eb64
feature: add created date time to filter (#4932)
Co-authored-by: BEN AMEUR <Bechir.BEN-AMEUR.ext@sodexo.com>
2024-02-17 09:37:23 +01:00
Mohamed Ali f85615fb8f
Set the default value for Interval to match DefaultValue (should fix #4818) (#4926) 2024-02-17 09:20:07 +01:00
MariusVuscanNx 177891c91b
Updated client to include inputs as part of workflow instance (#4955) 2024-02-16 22:50:49 +01:00
Sipke Schoorstra 99d7d0009b Update MassTransitBroker to use Memory
The code previously had the MassTransitBroker set to AzureServiceBus. This commit changes it to use in-memory MassTransitBroker. An "Memory" enumeration value is also added in the MassTransitBroker enumeration.
2024-02-16 22:46:29 +01:00
Raymond den Haan 3fa7a06310 Renaming for clarification / project conformity 2024-02-16 14:00:28 +01:00
Raymond den Haan fd45171068 Update package prefix extraction logic in workflow 2024-02-16 11:58:26 +01:00
Raymond den Haan 4f20a8d5b4 Added fix path to package list 2024-02-16 11:58:26 +01:00
Raymond den Haan f0b5f750ac Fixed issue where updated and finished date where not set when cancelling a workflow 2024-02-16 11:58:26 +01:00
Sipke Schoorstra ef3431c57a
Implement dispatch channels (#4949)
* Add DispatchWorkflowOptions and update MassTransit configuration

Introduced a new class `DispatchWorkflowOptions` to provide workflow dispatch options. Updated MassTransit configuration to include NET6.0 and NET7.0 support, and ensure correct MassTransit version usage per target framework version.

* Add support for configurable MassTransit message dispatching

Implemented a feature which allows for configurable MassTransit message dispatching. Added support for specifying channels and message brokers. Message dispatching code was massively refactored and relevant endpoints and response models were updated to support new message dispatching features.

* Add IEndpointChannelFormatter interface and implementation

An interface for formatting channel queue names, 'IEndpointChannelFormatter', has been added, along with its default implementation 'DefaultEndpointChannelFormatter'. The code that uses hardcoded queue name formatting has been modified to use the new formatter instead, making it more configurable and reusable. The implementation of the formatter uses the 'Humanizer' library to kebab-case the channel names.

* Add channel dispatch option to workflow activities

Introduced `WorkflowDispatcherChannelOptionsProvider` to provide dropdown channel options for workflow dispatch-related activities. Updated `DispatchWorkflow` and `BulkDispatchWorkflows` activities to include a new dropdown input for specifying a dispatch channel. Also, included the selected channel name in the `DispatchWorkflowOptions` during workflow dispatching process.

* Update MassTransit configurations and remove unused code

The MassTransit setup in Elsa.MassTransit module has been simplified by removing conditional code for different .NET versions. Additionally, unused parameter '__X_Channel' in 'DispatchWorkflowDefinition' was removed. Lastly, the MassTransit broker in Elsa.Server.Web was switched from RabbitMq to AzureServiceBus.

* Refactor dispatch workflow classes and methods

Simplified the class, method and variable names related to workflow dispatching in the Elsa.Workflows.Runtime module. For example, the 'WorkflowDispatcherChannelDescriptor' class was renamed to 'DispatcherChannel'. This refactoring was performed to make code more readable and maintainable by removing redundant wording in the naming convention.

* Update GitHub Workflow to support feature and issue branches

The workflow changes add support for feature and issue branches. Now, it extracts the branch name and verifies the commit exists in the given branch rather than just 'main'. The versioning scheme is also modified to include the branch name and not just the run number.

* Add 'bug/*' to triggering branches in packages workflow

The 'bug/*' pattern was missing from the triggers that initiate the GitHub actions within our packages workflow. This update includes any branch with a 'bug/' prefix to the list, allowing bug-related branches to start jobs in our CI/CD pipeline.

* Remove 'issue/*' and 'bug/*' branches from packages workflow

The 'issue/*' and 'bug/*' branches have been removed from the GitHub action workflow for packages. This change was made to simplify the workflow and optimize the triggering of package building.

* Update GitHub workflow to handle main branch versioning

This commit modifies the GitHub workflow script to accommodate changes when the branch name is "main." If the branch name is "main", a preview version is used. It also updates script execution to print the branch name for easier debugging and verifies commit existence on the correct branch instead of dispatch channels.

* Enclose branch names in quotes in packages.yml

The update modifies the branch names in the packages.yml GitHub Actions workflow file. The change consists of enclosing the branch names 'main' and 'feature/*' in single quotes, ensuring compatibility and preventing potential string interpretation issues.

* Update GitHub workflows package configuration

The workflows package configuration has been updated to specifically watch for changes on 'feature/dispatch-channels' rather than on all feature branches. This change will prevent unnecessary builds on less relevant feature branches.

* Update trigger branches in packages workflow

The triggering branches in the packages workflow have been updated. Previously, only changes in the 'main' and 'feature/dispatch-channels' would trigger the workflow, now any 'feature/*' branch will. This will cause more frequent and comprehensive testing.

* Add 'patch/*' to workflow trigger branches

This update adds 'patch/*' to the list of branches in .github/workflows/packages.yml that can trigger the workflow. It will allow the workflow to be initiated not just for main and feature branches, but also for patches.

* Add 'preview/*' to workflow triggers

This commit adds a new trigger for the GitHub Actions workflow. It now also responds to push events on 'preview/*' branches, allowing for automated testing and building of these preview branches.

* Update branch name extraction in GitHub Actions

The extraction of the branch name has been slightly modified in the packages.yml GitHub workflow file. This alteration ensures the correct branch name is obtained for further processing within the workflow without any discrepancy.

* Update branch name extraction in packages.yml

Corrected the syntax for extracting the branch name within the packages.yml github workflow file. Added an extra line to print out the ref which might be useful for debugging.

* Update branch name extraction in GitHub workflow

The commit simplifies the way the branch name is being extracted from the GitHub ref in the packages.yml workflow file. The new method employs straightforward string manipulation, making it easier to understand and debug in case of potential issues.

* Add extraction of branch name in workflow

Added a new line in the GitHub workflow file (.github/workflows/packages.yml) to extract the last part after the final slash from the branch name. This enhancement allows cleaner naming conventions, especially in cases where branches are named feature/issue-123, as it will only retain 'issue-123'.

* Update package naming in Github workflow

The Github workflow has been updated to handle package naming more effectively. Previously, the branch name was used directly for package versioning. Now, the last part of the branch name is extracted and used as the package prefix. If the branch name is "main", the package prefix is set to "preview".

* Move and add environment variable assignments

The placement of the assignment for BRANCH_NAME environment variable was moved for better readability. Additionally, the PACKAGE_PREFIX environment variable was also added. These environment variables are crucial for subsequent steps in the GitHub workflow.

* Add workflow dispatch validation and response handling

Removed several specific dispatch response classes and consolidated all types of dispatch responses into a single DispatchWorkflowResponse class. Added a new ValidatingWorkflowDispatcher service to validate dispatch requests before they're sent. Updated several classes to work with these changes, including the BackgroundWorkflowDispatcher, MassTransitWorkflowDispatcher, and the API endpoint class.

* Handle dispatch workflow failures with exceptions

The DispatchWorkflow and BulkDispatchWorkflows activities now throw a FaultException when the dispatch operations fail. Previously, these operations were not checking for success and could fail silently. Now, an unsuccessful dispatch response results in a FaultException with an error message from the dispatch response.
2024-02-16 10:56:30 +01:00
Sipke Schoorstra ff7c5dce1e Refine package building workflow in GitHub Actions
The updates in this commit refine the way branch names and package prefixes are determined in the GitHub workflow for package building. Moreover, the workflow now recognizes and supports additional branch patterns, including 'patch/*' and 'preview/*', extending the existing support for 'main' and 'feature/*' branches.
2024-02-14 18:35:38 +01:00
Sipke Schoorstra 67feaab876 Enclose branch names in quotes in packages.yml
The commit message updates the branch names in the packages.yml GitHub workflows file by enclosing them in single quotes. The change is done on both 'main' and 'feature/*' branches.
2024-02-14 18:13:51 +01:00
Sipke Schoorstra 68b26576a3 Update branch name handling in GitHub workflow
This update modifies the GitHub packages workflow. 'issue/*' and 'bug/*' branches were removed from the workflow trigger, and branch name handling logic updated. Now, if the branch name is 'main', the version is labeled as 'preview'. Otherwise, the branch name is used.
2024-02-14 18:09:39 +01:00
Sipke Schoorstra ceee982198 Update GitHub workflow for better branch handling
This update modifies the GitHub workflow in packages.yml for improved branch name extraction and more accurate commit verification. It provides more feedback by outputting the extracted branch name, and checks for commits in the specific branch rather than in 'origin/dispatch-channels'.
2024-02-14 18:06:51 +01:00
Sipke Schoorstra 2f05eae1d5 Update GitHub action for branch-specific workflows
Expanded GitHub action to now trigger on push events for feature/*, issue/*, and bug/* branches. The workflow has been modified to fetch the name of the current working branch, check if the commit exists on that branch, and append it to version number. This will effectively allow isolated workflows for each specific branch.
2024-02-14 18:03:31 +01:00
Sipke Schoorstra 8b290ffc53 Add 'From' methods and mark 'Get' methods as obsolete
Added 'From' and 'From<T>' methods to the 'OutputProxy' class, which retrieve the value of a specified output from a certain activity. The pre-existing 'Get' methods, serving a similar function, have been marked as obsolete and updated to use the new 'From' methods.
2024-02-14 11:39:47 +01:00
Sipke Schoorstra eeb8aefa3e Add Postgres service to docker-compose file
A new Postgres service has been added to the docker-compose file, with its respective environmental variables and volume. This service uses postgres:13.3-alpine image and is accessible via the port 5432.
2024-02-14 11:39:29 +01:00