Incremental fixes
This commit is contained in:
parent
2f69176463
commit
b5cdb8d770
|
|
@ -8,20 +8,43 @@ using Microsoft.Extensions.Options;
|
|||
// ReSharper disable once CheckNamespace
|
||||
namespace Elsa.Extensions;
|
||||
|
||||
internal static class ExpressionExecutionContextExtensions
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static class ExpressionExecutionContextExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Generates a URL that can be used to trigger an event.
|
||||
/// </summary>
|
||||
/// <param name="context">The expression execution context.</param>
|
||||
/// <param name="eventName">The name of the event to trigger.</param>
|
||||
/// <param name="lifetime">The lifetime of the event trigger token.</param>
|
||||
/// <returns>A URL that can be used to trigger an event.</returns>
|
||||
public static string GenerateEventTriggerUrl(this ExpressionExecutionContext context, string eventName, TimeSpan lifetime)
|
||||
{
|
||||
var token = context.GenerateEventTriggerTokenInternal(eventName, lifetime);
|
||||
return context.GenerateEventTriggerUrlInternal(token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a URL that can be used to trigger an event.
|
||||
/// </summary>
|
||||
/// <param name="context">The expression execution context.</param>
|
||||
/// <param name="eventName">The name of the event to trigger.</param>
|
||||
/// <param name="expiresAt">The expiration date of the event trigger token.</param>
|
||||
/// <returns>A URL that can be used to trigger an event.</returns>
|
||||
public static string GenerateEventTriggerUrl(this ExpressionExecutionContext context, string eventName, DateTimeOffset expiresAt)
|
||||
{
|
||||
var token = context.GenerateEventTriggerTokenInternal(eventName, expiresAt: expiresAt);
|
||||
return context.GenerateEventTriggerUrlInternal(token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a URL that can be used to trigger an event.
|
||||
/// </summary>
|
||||
/// <param name="context">The expression execution context.</param>
|
||||
/// <param name="eventName">The name of the event to trigger.</param>
|
||||
/// <returns>A URL that can be used to trigger an event.</returns>
|
||||
public static string GenerateEventTriggerUrl(this ExpressionExecutionContext context, string eventName)
|
||||
{
|
||||
var token = context.GenerateEventTriggerTokenInternal(eventName);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ public class HttpActivityOptions
|
|||
/// <summary>
|
||||
/// The root path at which HTTP activities can be invoked.
|
||||
/// </summary>
|
||||
public PathString? BasePath { get; set; }
|
||||
public PathString? BasePath { get; set; } = "/workflows";
|
||||
|
||||
/// <summary>
|
||||
/// The base URL of the server. This should be set to the same value at which the Elsa Server is publicly available. It will be used when generating absolute URLs need to be generated by activities such as SendEmail.
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using System.Dynamic;
|
|||
using System.Net;
|
||||
using System.Net.Mime;
|
||||
using Elsa.Expressions.Models;
|
||||
using Elsa.Extensions;
|
||||
using Elsa.Http;
|
||||
using Elsa.Http.Models;
|
||||
using Elsa.Workflows.Core;
|
||||
|
|
@ -18,7 +19,7 @@ namespace Elsa.Samples.AspNet.DocumentApproval
|
|||
{
|
||||
protected override void Build(IWorkflowBuilder builder)
|
||||
{
|
||||
var documentVariable = builder.WithVariable<ExpandoObject>();
|
||||
var documentVariable = builder.WithVariable<ExpandoObject>().WithWorkflowStorage();
|
||||
var approvedVariable = builder.WithVariable<bool>();
|
||||
|
||||
builder.Root = new Sequence
|
||||
|
|
@ -144,7 +145,7 @@ namespace Elsa.Samples.AspNet.DocumentApproval
|
|||
|
||||
private string GenerateSignalUrl(ExpressionExecutionContext context, string signalName)
|
||||
{
|
||||
return "Signal (events in Elsa 3) URL generation not yet implemented";
|
||||
return context.GenerateEventTriggerUrl(signalName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7,8 +7,17 @@ var services = builder.Services;
|
|||
services.AddElsa(elsa => elsa
|
||||
.AddWorkflowsFrom<Program>()
|
||||
|
||||
// Add FastEndpoints.
|
||||
.UseWorkflowsApi()
|
||||
|
||||
// Enable SAS tokens.
|
||||
.UseSasTokens()
|
||||
|
||||
// Enable Elsa HTTP module (for HTTP related activities).
|
||||
.UseHttp()
|
||||
.UseHttp(http => http.ConfigureHttpOptions = options =>
|
||||
{
|
||||
options.BaseUrl = new Uri("https://localhost:5001");
|
||||
})
|
||||
);
|
||||
|
||||
// Configure middleware pipeline.
|
||||
|
|
@ -17,6 +26,9 @@ var app = builder.Build();
|
|||
if (app.Environment.IsDevelopment())
|
||||
app.UseDeveloperExceptionPage();
|
||||
|
||||
// Expose Elsa APIs.
|
||||
app.UseWorkflowsApi();
|
||||
|
||||
// Add Elsa HTTP middleware (to handle requests mapped to HTTP Endpoint activities)
|
||||
app.UseWorkflows();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue