using System.Reflection;
using Elsa.Workflows;
using Elsa.Workflows.UIHints;
using Elsa.Workflows.UIHints.SingleLine;
namespace Elsa.Http.UIHints;
///
/// Provides additional options for the Path input field.
///
public class HttpEndpointPathUIHandler(IHttpEndpointBasePathProvider httpEndpointBasePathProvider) : IPropertyUIHandler
{
///
public ValueTask> GetUIPropertiesAsync(PropertyInfo propertyInfo, object? context, CancellationToken cancellationToken = default)
{
var completeBaseUrl = httpEndpointBasePathProvider.GetBasePath();
return new(new Dictionary
{
[InputUIHints.SingleLine] = new SingleLineProps
{
AdornmentText = completeBaseUrl.TrimEnd('/') + '/',
EnableCopyAdornment = true
},
["Refresh"] = true
});
}
}