PR change requests
This commit is contained in:
parent
2fdd7427b6
commit
f893cbe6e6
|
|
@ -30,7 +30,7 @@ namespace Elsa.Services
|
|||
Task<StartableWorkflow?> FindStartableWorkflowAsync(string workflowDefinitionId, string? activityId = default, string? correlationId = default, string? contextId = default, string? tenantId = default, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new test workflow instance with execution pending for the specified workflow blueprint using the specified starting activity ID.
|
||||
/// Creates a new workflow instance with execution pending for the specified workflow blueprint version using the specified starting activity ID.
|
||||
/// </summary>
|
||||
Task<StartableWorkflow?> FindStartableWorkflowAsync(string workflowDefinitionId, int version, string? activityId = default, string? correlationId = default, string? contextId = default, string? tenantId = default, CancellationToken cancellationToken = default);
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ export class ElsaScriptProperty {
|
|||
value: value,
|
||||
data: null,
|
||||
isValidated: false,
|
||||
isPositiveResult: false
|
||||
isValid: false
|
||||
};
|
||||
eventBus.emit(EventTypes.ActivityPluginValidating, this, this.activityValidatingContext);
|
||||
}
|
||||
|
|
@ -85,7 +85,7 @@ export class ElsaScriptProperty {
|
|||
if (this.activityValidatingContext == null || !this.activityValidatingContext.isValidated)
|
||||
return;
|
||||
|
||||
const isPositiveResult = this.activityValidatingContext.isPositiveResult;
|
||||
const isPositiveResult = this.activityValidatingContext.isValid;
|
||||
const color = isPositiveResult ? 'green' : 'red';
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -103,12 +103,13 @@ export class ElsaWorkflowTestPanel {
|
|||
const renderActivityTestMessage = () => {
|
||||
|
||||
const {message} = this;
|
||||
|
||||
|
||||
if (message == undefined || !message)
|
||||
return
|
||||
|
||||
let workflowStatus = this.workflowTestActivityMessages.last().workflowStatus;
|
||||
|
||||
const workflowStatus = this.workflowTestActivityMessages.last().workflowStatus;
|
||||
debugger
|
||||
|
||||
const t = (x, params?) => this.i18next.t(x, params);
|
||||
|
||||
return (
|
||||
|
|
@ -117,19 +118,19 @@ export class ElsaWorkflowTestPanel {
|
|||
<dt class="elsa-text-gray-500">{t('Status')}</dt>
|
||||
<dd class="elsa-text-gray-900">{workflowStatus}</dd>
|
||||
</div>
|
||||
{!!message.path ?
|
||||
{!!message.activityData["Path"] ?
|
||||
<div>
|
||||
<div class="elsa-py-3 elsa-flex elsa-justify-between elsa-text-sm elsa-font-medium">
|
||||
<dt class="elsa-text-gray-500">{t('EntryEndpoint')}</dt>
|
||||
</div>
|
||||
<div class="elsa-py-3 elsa-flex elsa-justify-between elsa-text-sm elsa-font-medium">
|
||||
<dt class="elsa-text-gray-900">
|
||||
<pre onClick={e => clip(e.currentTarget)}>{this.serverUrl + '/workflows' + message.path + '?correlation=' + message.correlationId}</pre>
|
||||
<pre onClick={e => clip(e.currentTarget)}>{this.serverUrl + '/workflows' + message.activityData["Path"].value + '?correlation=' + message.correlationId}</pre>
|
||||
</dt>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
:
|
||||
''
|
||||
undefined
|
||||
}
|
||||
</dl>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -324,7 +324,6 @@ export class SyntaxNames {
|
|||
}
|
||||
|
||||
export interface WorkflowTestActivityMessage {
|
||||
path?: string;
|
||||
workflowInstanceId: string;
|
||||
correlationId: string;
|
||||
activityId: string;
|
||||
|
|
@ -332,6 +331,7 @@ export interface WorkflowTestActivityMessage {
|
|||
workflowStatus: string;
|
||||
data?: any;
|
||||
error?: string;
|
||||
activityData?: any;
|
||||
}
|
||||
|
||||
export const getVersionOptionsString = (versionOptions?: VersionOptions) => {
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ export interface ActivityValidatingContext {
|
|||
value?: string,
|
||||
isValidated: boolean,
|
||||
data: any,
|
||||
isPositiveResult: boolean
|
||||
isValid: boolean
|
||||
}
|
||||
|
||||
export interface ActivityDescriptorDisplayContext {
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ export class HttpEndpointPlugin implements ElsaPlugin {
|
|||
}
|
||||
|
||||
context.isValidated = true;
|
||||
context.isPositiveResult = isValid;
|
||||
context.isValid = isValid;
|
||||
context.data = isValid ? 'Json is valid' : 'Json is invalid';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace Elsa.Server.Api.Handlers
|
|||
public async Task Handle(ActivityExecutionResultExecuted notification, CancellationToken cancellationToken)
|
||||
{
|
||||
var context = notification.ActivityExecutionContext;
|
||||
string? path = default;
|
||||
//string? path = default;
|
||||
|
||||
var signalRConnectionId = context.WorkflowExecutionContext.WorkflowInstance.GetMetadata("signalRConnectionId")?.ToString();
|
||||
if (string.IsNullOrWhiteSpace(signalRConnectionId)) return;
|
||||
|
|
@ -34,24 +34,26 @@ namespace Elsa.Server.Api.Handlers
|
|||
["Outcomes"] = JToken.FromObject(context.Outcomes)
|
||||
};
|
||||
|
||||
if (context.ActivityBlueprint.Type == "HttpEndpoint")
|
||||
{
|
||||
//if (context.ActivityBlueprint.Type == "HttpEndpoint")
|
||||
//{
|
||||
var body = context.Input != null ? ((dynamic)context.Input).Body : null;
|
||||
|
||||
if (body != null)
|
||||
data["Body"] = JToken.FromObject(body);
|
||||
|
||||
var activityData = context.WorkflowInstance.ActivityData.FirstOrDefault(x => x.Key == notification.ActivityExecutionContext.ActivityId);
|
||||
var pathProperty = activityData.Value.FirstOrDefault(x => x.Key == "Path");
|
||||
if (pathProperty.Value != null)
|
||||
{
|
||||
path = pathProperty.Value.ToString();
|
||||
}
|
||||
}
|
||||
// var activityData = context.WorkflowInstance.ActivityData.FirstOrDefault(x => x.Key == notification.ActivityExecutionContext.ActivityId);
|
||||
// var pathProperty = activityData.Value.FirstOrDefault(x => x.Key == "Path");
|
||||
// if (pathProperty.Value != null)
|
||||
// {
|
||||
// path = pathProperty.Value.ToString();
|
||||
// }
|
||||
//}
|
||||
|
||||
var activityData = context.WorkflowInstance.ActivityData.FirstOrDefault(x => x.Key == notification.ActivityExecutionContext.ActivityId).Value;
|
||||
|
||||
var message = new WorkflowTestMessage
|
||||
{
|
||||
Path = path,
|
||||
//Path = path,
|
||||
WorkflowInstanceId = context.WorkflowInstance.Id,
|
||||
CorrelationId = context.CorrelationId,
|
||||
ActivityId = context.ActivityId,
|
||||
|
|
@ -59,7 +61,8 @@ namespace Elsa.Server.Api.Handlers
|
|||
? "Executed"
|
||||
: context.WorkflowExecutionContext.Status.ToString(),
|
||||
Data = JsonConvert.SerializeObject(data, Formatting.Indented),
|
||||
Status = GetExecutionResult(notification.Result)
|
||||
Status = GetExecutionResult(notification.Result),
|
||||
ActivityData = activityData
|
||||
};
|
||||
|
||||
await _workflowTestService.DispatchMessage(signalRConnectionId, message);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Elsa.Server.Api.Models
|
||||
{
|
||||
public class WorkflowTestMessage
|
||||
{
|
||||
public string? Path { get; set; }
|
||||
public string WorkflowInstanceId { get; set; } = default!;
|
||||
public string CorrelationId { get; set; } = default!;
|
||||
public string ActivityId { get; set; } = default!;
|
||||
|
|
@ -10,5 +11,6 @@ namespace Elsa.Server.Api.Models
|
|||
public string WorkflowStatus { get; set; } = default!;
|
||||
public object? Data { get; set; }
|
||||
public string? Error { get; set; }
|
||||
public IDictionary<string, object?>? ActivityData { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue