-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add UI hints for HTTP endpoint and single line fields
Introduced HttpEndpointPathUIHandler to provide additional UI options for the Path input field in the HTTP Endpoint activity. This commits also adds SingleLineProps to offer more options for SingleLine input fields across different modules. The implementation improves UI component interactions.
- Loading branch information
1 parent
5202b39
commit 5d936ad
Showing
4 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
src/clients/Elsa.Api.Client/Shared/UIHints/SingleLine/SingleLineProps.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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace Elsa.Api.Client.Shared.UIHints.SingleLine; | ||
|
||
/// <summary> | ||
/// Provides additional options for the SingleLine input field. | ||
/// </summary> | ||
public class SingleLineProps | ||
{ | ||
/// <summary> | ||
/// Gets or sets adornment text. | ||
/// </summary> | ||
public string? AdornmentText { get; set; } | ||
} |
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
30 changes: 30 additions & 0 deletions
30
src/modules/Elsa.Http/UIHints/HttpEndpointPathUIHandler.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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System.Reflection; | ||
using Elsa.Http.Options; | ||
using Elsa.Workflows.Contracts; | ||
using Elsa.Workflows.UIHints; | ||
using Elsa.Workflows.UIHints.SingleLine; | ||
using Microsoft.Extensions.Options; | ||
|
||
namespace Elsa.Http.UIHints; | ||
|
||
/// <summary> | ||
/// Provides additional options for the Path input field. | ||
/// </summary> | ||
public class HttpEndpointPathUIHandler(IOptions<HttpActivityOptions> options) : IPropertyUIHandler | ||
{ | ||
/// <inheritdoc /> | ||
public ValueTask<IDictionary<string, object>> GetUIPropertiesAsync(PropertyInfo propertyInfo, object? context, CancellationToken cancellationToken = default) | ||
{ | ||
var baseUrl = options.Value.BaseUrl; | ||
var apiRoutePrefix = options.Value.ApiRoutePrefix; | ||
var completeBaseUrl = new Uri(baseUrl, apiRoutePrefix); | ||
|
||
return new(new Dictionary<string, object> | ||
{ | ||
[InputUIHints.SingleLine] = new SingleLineProps | ||
{ | ||
AdornmentText = completeBaseUrl.ToString().TrimEnd('/') + '/' | ||
}, | ||
}); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/modules/Elsa.Workflows.Core/UIHints/SingleLine/SingleLineProps.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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace Elsa.Workflows.UIHints.SingleLine; | ||
|
||
/// <summary> | ||
/// Provides additional options for the SingleLine input field. | ||
/// </summary> | ||
public class SingleLineProps | ||
{ | ||
/// <summary> | ||
/// Gets or sets adornment text. | ||
/// </summary> | ||
public string? AdornmentText { get; set; } | ||
} |