2023-12-28 19:52:04 +00:00
|
|
|
using System.Reflection;
|
2024-10-11 18:41:49 +00:00
|
|
|
using Elsa.Workflows;
|
2023-12-28 19:52:04 +00:00
|
|
|
using Elsa.Workflows.UIHints;
|
|
|
|
|
using Elsa.Workflows.UIHints.SingleLine;
|
|
|
|
|
|
|
|
|
|
namespace Elsa.Http.UIHints;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Provides additional options for the Path input field.
|
|
|
|
|
/// </summary>
|
2024-10-17 17:47:55 +00:00
|
|
|
public class HttpEndpointPathUIHandler(IHttpEndpointBasePathProvider httpEndpointBasePathProvider) : IPropertyUIHandler
|
2023-12-28 19:52:04 +00:00
|
|
|
{
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public ValueTask<IDictionary<string, object>> GetUIPropertiesAsync(PropertyInfo propertyInfo, object? context, CancellationToken cancellationToken = default)
|
|
|
|
|
{
|
2024-10-17 17:47:55 +00:00
|
|
|
var completeBaseUrl = httpEndpointBasePathProvider.GetBasePath();
|
2023-12-28 19:52:04 +00:00
|
|
|
|
|
|
|
|
return new(new Dictionary<string, object>
|
|
|
|
|
{
|
|
|
|
|
[InputUIHints.SingleLine] = new SingleLineProps
|
|
|
|
|
{
|
2024-10-17 17:47:55 +00:00
|
|
|
AdornmentText = completeBaseUrl.TrimEnd('/') + '/'
|
2023-12-28 19:52:04 +00:00
|
|
|
},
|
2024-10-17 17:47:55 +00:00
|
|
|
["Refresh"] = true
|
2023-12-28 19:52:04 +00:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|