Fix that composite child activities are displayed on workflow viewer
Fixes #922
This commit is contained in:
parent
645842f08f
commit
7ec6ada35f
|
|
@ -96,11 +96,12 @@ export class ElsaWorkflowBlueprintViewerScreen {
|
|||
updateModels(workflowBlueprint: WorkflowBlueprint) {
|
||||
this.workflowBlueprint = workflowBlueprint;
|
||||
this.workflowModel = this.mapWorkflowModel(workflowBlueprint);
|
||||
debugger;
|
||||
}
|
||||
|
||||
mapWorkflowModel(workflowBlueprint: WorkflowBlueprint): WorkflowModel {
|
||||
return {
|
||||
activities: workflowBlueprint.activities.map(this.mapActivityModel),
|
||||
activities: workflowBlueprint.activities.filter(x => x.parentId == null).map(this.mapActivityModel),
|
||||
connections: workflowBlueprint.connections.map(this.mapConnectionModel),
|
||||
persistenceBehavior: workflowBlueprint.persistenceBehavior,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -70,8 +70,7 @@ export class ElsaWorkflowInstanceJournal {
|
|||
@Method()
|
||||
async selectActivityRecord(activityId?: string) {
|
||||
const record = !!activityId ? this.records.items.find(x => x.activityId == activityId) : null;
|
||||
this.selectedRecordId = !!record ? record.id : null;
|
||||
this.selectedActivityId = activityId;
|
||||
this.selectActivityRecordInternal(record);
|
||||
await this.show();
|
||||
}
|
||||
|
||||
|
|
@ -93,6 +92,12 @@ export class ElsaWorkflowInstanceJournal {
|
|||
await this.workflowInstanceIdChangedHandler(this.workflowInstanceId);
|
||||
}
|
||||
|
||||
selectActivityRecordInternal(record?: WorkflowExecutionLogRecord) {
|
||||
const activity = !!record ? this.workflowBlueprint.activities.find(x => x.id === record.activityId) : null;
|
||||
this.selectedRecordId = !!record ? record.id : null;
|
||||
this.selectedActivityId = activity != null ? activity.parentId != null ? activity.parentId : activity.id : null;
|
||||
}
|
||||
|
||||
getEventColor(eventName: string) {
|
||||
const map = {
|
||||
'Executing': 'blue',
|
||||
|
|
@ -114,8 +119,7 @@ export class ElsaWorkflowInstanceJournal {
|
|||
}
|
||||
|
||||
onRecordClick(record: WorkflowExecutionLogRecord) {
|
||||
this.selectedRecordId = record.id;
|
||||
this.selectedActivityId = record.activityId;
|
||||
this.selectActivityRecordInternal(record);
|
||||
this.recordSelected.emit(record);
|
||||
}
|
||||
|
||||
|
|
@ -245,7 +249,7 @@ export class ElsaWorkflowInstanceJournal {
|
|||
|
||||
if (!value)
|
||||
continue;
|
||||
|
||||
|
||||
let valueText = null;
|
||||
|
||||
if (typeof value == 'string')
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ export class ElsaWorkflowInstanceViewerScreen {
|
|||
|
||||
mapWorkflowModel(workflowBlueprint: WorkflowBlueprint): WorkflowModel {
|
||||
return {
|
||||
activities: workflowBlueprint.activities.map(this.mapActivityModel),
|
||||
activities: workflowBlueprint.activities.filter(x => x.parentId == null).map(this.mapActivityModel),
|
||||
connections: workflowBlueprint.connections.map(this.mapConnectionModel),
|
||||
persistenceBehavior: workflowBlueprint.persistenceBehavior,
|
||||
};
|
||||
|
|
@ -160,7 +160,9 @@ export class ElsaWorkflowInstanceViewerScreen {
|
|||
}
|
||||
|
||||
onRecordSelected(e: CustomEvent<WorkflowExecutionLogRecord>) {
|
||||
this.selectedActivityId = e.detail.activityId;
|
||||
const record = e.detail;
|
||||
const activity = !!record ? this.workflowBlueprint.activities.find(x => x.id === record.activityId) : null;
|
||||
this.selectedActivityId = activity != null ? activity.parentId != null ? activity.parentId : activity.id : null;
|
||||
}
|
||||
|
||||
onActivitySelected(e: CustomEvent<ActivityModel>) {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@
|
|||
<body class="h-screen" style="background-size: 30px 30px; background-image: url(/build/assets/images/tile.png); background-color: #FBFBFB;">
|
||||
|
||||
<elsa-studio-root server-url="https://localhost:11000/" monaco-lib-path="build/assets/js"></elsa-studio-root>
|
||||
<!--<elsa-studio-root server-url="https://localhost:6080/" monaco-lib-path="build/assets/js"></elsa-studio-root>-->
|
||||
<!--<elsa-studio-root server-url="https://skynet-workflow.azurewebsites.net" monaco-lib-path="build/assets/js"></elsa-studio-root>-->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ export interface ActivityBlueprint {
|
|||
displayName?: string;
|
||||
description?: string;
|
||||
type: string;
|
||||
parentId?: string;
|
||||
persistWorkflow: boolean;
|
||||
loadWorkflowContext: boolean;
|
||||
saveWorkflowContext: boolean;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ namespace Elsa.Persistence.YesSql.Documents
|
|||
|
||||
public WorkflowFault? Fault { get; set; }
|
||||
public SimpleStack<ScheduledActivity> ScheduledActivities { get; set; } = new();
|
||||
public SimpleStack<string> Scopes { get; set; } = new();
|
||||
public SimpleStack<ActivityScope> Scopes { get; set; } = new();
|
||||
public ScheduledActivity? CurrentActivity { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
using Elsa.Activities.Console;
|
||||
using Elsa.Builders;
|
||||
using Elsa.Services;
|
||||
|
||||
namespace Elsa.Samples.Server.Host.Activities
|
||||
{
|
||||
public class SampleCompositeActivity : CompositeActivity
|
||||
{
|
||||
public override void Build(ICompositeActivityBuilder builder)
|
||||
{
|
||||
builder.WriteLine("Line 1");
|
||||
builder.WriteLine("Line 2");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -38,6 +38,7 @@ namespace Elsa.Server.Api.Endpoints.WorkflowRegistry
|
|||
public string? DisplayName { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public string Type { get; set; } = default!;
|
||||
public string? ParentId { get; set; }
|
||||
public bool PersistWorkflow { get; set; }
|
||||
public bool LoadWorkflowContext { get; set; }
|
||||
public bool SaveWorkflowContext { get; set; }
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ namespace Elsa.Server.Api.Mapping
|
|||
DisplayName = source.DisplayName,
|
||||
Description = source.Description,
|
||||
Type = source.Type,
|
||||
ParentId = source.Parent?.Id,
|
||||
PersistWorkflow = source.PersistWorkflow,
|
||||
LoadWorkflowContext = source.LoadWorkflowContext,
|
||||
SaveWorkflowContext = source.SaveWorkflowContext,
|
||||
|
|
|
|||
Loading…
Reference in a new issue