-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add optional refresh parameter (#5876)
* Add optional refresh parameter Renamed several `RefreshDescriptors` methods to `RefreshDescriptorsAsync` to reflect their asynchronous nature consistently. Added an optional refresh parameter in the `ListActivityDescriptorsRequest` class and updated related endpoints to handle this parameter, triggering a registry refresh if necessary. * Update version to 3.2.0-rc5 in GitHub Actions Modified the `packages.yml` workflow to change the version from `3.2.0-rc4` to `3.2.0-rc5` for non-tagged releases. This ensures version consistency with the new release candidate.
- Loading branch information
1 parent
ef2dfd3
commit c8669d1
Showing
8 changed files
with
23 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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
10 changes: 7 additions & 3 deletions
10
.../Elsa.Api.Client/Resources/ActivityDescriptors/Requests/ListActivityDescriptorsRequest.cs
This file contains 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 |
---|---|---|
@@ -1,6 +1,10 @@ | ||
using Refit; | ||
|
||
namespace Elsa.Api.Client.Resources.ActivityDescriptors.Requests; | ||
|
||
/// <summary> | ||
/// Represents a request to list activity descriptors. | ||
/// </summary> | ||
public record ListActivityDescriptorsRequest; | ||
public class ListActivityDescriptorsRequest | ||
{ | ||
/// Whether to refresh the activity descriptors or not. | ||
[Query] public bool Refresh { get; set; } | ||
} |
13 changes: 10 additions & 3 deletions
13
src/modules/Elsa.Workflows.Api/Endpoints/ActivityDescriptors/List/Endpoint.cs
This file contains 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 |
---|---|---|
@@ -1,23 +1,30 @@ | ||
using Elsa.Abstractions; | ||
using Elsa.Workflows.Contracts; | ||
using Elsa.Workflows.Management.Activities.WorkflowDefinitionActivity; | ||
using Elsa.Workflows.Management.Contracts; | ||
using JetBrains.Annotations; | ||
|
||
namespace Elsa.Workflows.Api.Endpoints.ActivityDescriptors.List; | ||
|
||
[PublicAPI] | ||
internal class List(IActivityRegistry registry) : ElsaEndpointWithoutRequest<Response> | ||
internal class List(IActivityRegistry registry, IActivityRegistryPopulator registryPopulator, WorkflowDefinitionActivityProvider workflowDefinitionActivityProvider) : ElsaEndpointWithoutRequest<Response> | ||
{ | ||
public override void Configure() | ||
{ | ||
Get("/descriptors/activities"); | ||
ConfigurePermissions("read:*", "read:activity-descriptors"); | ||
} | ||
|
||
public override Task<Response> ExecuteAsync(CancellationToken cancellationToken) | ||
public override async Task<Response> ExecuteAsync(CancellationToken cancellationToken) | ||
{ | ||
var forceRefresh = Query<bool>("refresh", false); | ||
|
||
if (forceRefresh) | ||
await registryPopulator.PopulateRegistryAsync(cancellationToken); | ||
|
||
var descriptors = registry.ListAll().ToList(); | ||
var response = new Response(descriptors); | ||
|
||
return Task.FromResult(response); | ||
return response; | ||
} | ||
} |
This file contains 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 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 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 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 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