forked from elsa-workflows/elsa-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Incremental work on saving and loading workflow definitions
- Loading branch information
1 parent
acf884c
commit c193b28
Showing
37 changed files
with
472 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
using System.Collections.Generic; | ||
using System.Runtime.Serialization; | ||
|
||
namespace Elsa.Client.Models | ||
{ | ||
[DataContract] | ||
public class List<T> | ||
{ | ||
public ICollection<T> Items { get; set; } = new System.Collections.Generic.List<T>(); | ||
[DataMember(Order = 1)] public ICollection<T> Items { get; set; } = new System.Collections.Generic.List<T>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
namespace Elsa.Client.Models | ||
using System.Runtime.Serialization; | ||
|
||
namespace Elsa.Client.Models | ||
{ | ||
[DataContract] | ||
public class PagedList<T> : List<T> | ||
{ | ||
public int? Page { get; set; } | ||
public int? PageSize { get; set; } | ||
public int TotalCount { get; set; } | ||
[DataMember(Order = 1)] public int? Page { get; set; } | ||
[DataMember(Order = 2)] public int? PageSize { get; set; } | ||
[DataMember(Order = 3)] public int TotalCount { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/dashboards/blazor/ElsaDashboard.Application.Server/BlazorRuntimeModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace ElsaDashboard.Application.Server | ||
{ | ||
public enum BlazorRuntimeModel | ||
{ | ||
Server, | ||
Browser | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 8 additions & 1 deletion
9
src/dashboards/blazor/ElsaDashboard.Application/ClientApp/src/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
<module href="./src/partials/layout.html"> | ||
|
||
<!-- Page title & actions --> | ||
<div class="border-b border-gray-200 px-4 py-4 sm:flex sm:items-center sm:justify-between sm:px-6 lg:px-8"> | ||
<div class="flex-1 min-w-0"> | ||
<h1 class="text-lg font-medium leading-6 text-gray-900 sm:truncate"> | ||
Home | ||
</h1> | ||
</div> | ||
</div> | ||
</module> |
13 changes: 8 additions & 5 deletions
13
src/dashboards/blazor/ElsaDashboard.Application/Models/MenuItem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
namespace ElsaDashboard.Application.Models | ||
using Microsoft.AspNetCore.Components.Routing; | ||
|
||
namespace ElsaDashboard.Application.Models | ||
{ | ||
public class MenuItem | ||
{ | ||
public MenuItem(string text, string url, string icon) | ||
public MenuItem(string text, string url, string icon, NavLinkMatch match = NavLinkMatch.Prefix) | ||
{ | ||
Text = text; | ||
Url = url; | ||
Icon = icon; | ||
} | ||
|
||
public string Text { get; set; } | ||
public string Icon { get; set; } | ||
public string Url { get; set; } | ||
public string Text { get; init; } | ||
public string Icon { get; init; } | ||
public string Url { get; init; } | ||
public NavLinkMatch Match { get; init; } = NavLinkMatch.Prefix; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 51 additions & 1 deletion
52
src/dashboards/blazor/ElsaDashboard.Application/Pages/Designer.razor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,56 @@ | ||
namespace ElsaDashboard.Application.Pages | ||
using System.Collections.Generic; | ||
using System.Collections.Immutable; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Elsa.Client.Models; | ||
using ElsaDashboard.Application.Models; | ||
using ElsaDashboard.Shared.Rpc; | ||
using Microsoft.AspNetCore.Components; | ||
|
||
namespace ElsaDashboard.Application.Pages | ||
{ | ||
partial class Designer | ||
{ | ||
[Parameter]public string? WorkflowDefinitionVersionId { get; set; } | ||
[Inject] private IWorkflowDefinitionService WorkflowDefinitionService { get; set; } = default!; | ||
[Inject] private IActivityService ActivityService { get; set; } = default!; | ||
private IDictionary<string, ActivityDescriptor> ActivityDescriptors { get; set; } = default!; | ||
private WorkflowModel WorkflowModel { get; set; } = WorkflowModel.Blank(); | ||
|
||
protected override async Task OnInitializedAsync() | ||
{ | ||
ActivityDescriptors = (await ActivityService.GetActivitiesAsync()).ToDictionary(x => x.Type); | ||
|
||
if (WorkflowDefinitionVersionId != null) | ||
{ | ||
var workflowDefinition = await WorkflowDefinitionService.GetByVersionIdAsync(WorkflowDefinitionVersionId); | ||
WorkflowModel = CreateWorkflowModel(workflowDefinition); | ||
} | ||
else | ||
{ | ||
WorkflowModel = WorkflowModel.Blank(); | ||
} | ||
} | ||
|
||
private WorkflowModel CreateWorkflowModel(WorkflowDefinition workflowDefinition) | ||
{ | ||
return new WorkflowModel | ||
{ | ||
Name = workflowDefinition.Name, | ||
Activities = workflowDefinition.Activities.Select(CreateActivityModel).ToImmutableList(), | ||
Connections = workflowDefinition.Connections.Select(CreateConnectionModel).ToImmutableList() | ||
}; | ||
} | ||
|
||
private ConnectionModel CreateConnectionModel(ConnectionDefinition connectionDefinition) | ||
{ | ||
return new(connectionDefinition.SourceActivityId, connectionDefinition.TargetActivityId, connectionDefinition.Outcome); | ||
} | ||
|
||
private ActivityModel CreateActivityModel(ActivityDefinition activityDefinition) | ||
{ | ||
var descriptor = ActivityDescriptors[activityDefinition.Type]; | ||
return new ActivityModel(activityDefinition.ActivityId, activityDefinition.Type, descriptor.Outcomes); | ||
} | ||
} | ||
} |
11 changes: 8 additions & 3 deletions
11
src/dashboards/blazor/ElsaDashboard.Application/Pages/Index.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
@page "/" | ||
|
||
<h1>Hello, world!</h1> | ||
|
||
Welcome to your new app. | ||
<!-- Page title & actions --> | ||
<div class="border-b border-gray-200 px-4 py-4 sm:flex sm:items-center sm:justify-between sm:px-6 lg:px-8"> | ||
<div class="flex-1 min-w-0"> | ||
<h1 class="text-lg font-medium leading-6 text-gray-900 sm:truncate"> | ||
Home | ||
</h1> | ||
</div> | ||
</div> |
Oops, something went wrong.