From 1c9328597f07a8a5a9cbc9cd6020bd819ef6f44c Mon Sep 17 00:00:00 2001 From: Lars Nijholt Date: Tue, 7 Jan 2025 14:34:14 +0100 Subject: [PATCH] Add workflow name property to workflow instance filter. Add the name property to the workflow instance filter to make use of the name property that can be used in the Request class for the list endpoint. This allows us to filter purely on workflow instance name without using the SearchTerm --- .../Endpoints/WorkflowInstances/List/Endpoint.cs | 1 + .../Filters/WorkflowInstanceFilter.cs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowInstances/List/Endpoint.cs b/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowInstances/List/Endpoint.cs index a69047659..785de7b1d 100644 --- a/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowInstances/List/Endpoint.cs +++ b/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowInstances/List/Endpoint.cs @@ -38,6 +38,7 @@ internal class List(IWorkflowInstanceStore store) : ElsaEndpoint public string? SearchTerm { get; set; } + + /// + /// Filter workflow instances that match the specified name. + /// + public string? Name { get; set; } /// /// Filter workflow instances by definition ID. @@ -125,6 +130,7 @@ public class WorkflowInstanceFilter if (filter.WorkflowSubStatuses != null) query = query.Where(x => filter.WorkflowSubStatuses.Contains(x.SubStatus)); if (filter.HasIncidents != null) query = filter.HasIncidents == true ? query.Where(x => x.IncidentCount > 0) : query.Where(x => x.IncidentCount == 0); if (filter.IsSystem != null) query = query.Where(x => x.IsSystem == filter.IsSystem); + if (filter.Name != null) query = query.Where(x => x.Name!.Contains(filter.Name, StringComparison.InvariantCultureIgnoreCase)); if (TimestampFilters != null) {