Skip to content

Commit

Permalink
Merge branch '1.0.0-alpha1' of https://github.com/serverlessworkflow/…
Browse files Browse the repository at this point in the history
…synapse into 1.0.0-alpha1
  • Loading branch information
cdavernas committed Aug 12, 2024
2 parents 9eec5a4 + e08d344 commit ded68cb
Show file tree
Hide file tree
Showing 13 changed files with 81 additions and 78 deletions.
45 changes: 6 additions & 39 deletions Synapse.sln
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Synapse.Api.Application", "
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{C31B1410-C7AF-4D11-8DA5-6877756A9907}"
ProjectSection(SolutionItems) = preProject
CODE_OF_CONDUCT.md = CODE_OF_CONDUCT.md
CONTRIBUTING.md = CONTRIBUTING.md
GOVERNANCE.md = GOVERNANCE.md
code-of-conduct.md = code-of-conduct.md
contributing.md = contributing.md
governance.md = governance.md
LICENSE = LICENSE
MAINTAINERS.md = MAINTAINERS.md
maintainer-guidelines.md = maintainer-guidelines.md
maintainers.md = maintainers.md
owners.md = owners.md
README.md = README.md
SECURITY.md = SECURITY.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{F041A1CB-45FA-4432-BAD2-DE2EE174C6FC}"
Expand Down Expand Up @@ -79,46 +80,12 @@ EndProject
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "deployments\docker-compose\docker-compose.dcproj", "{A2D3AFB0-C7E0-4778-9D0A-DFCE0E24AF17}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "community", "community", "{EFD78767-3171-46D2-880C-4E8F3C97529A}"
ProjectSection(SolutionItems) = preProject
community\README.md = community\README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assets", "assets", "{750922F9-5C47-42FE-945F-576818E6DEC9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "images", "images", "{81124062-334B-4AE3-A538-92B044207A94}"
ProjectSection(SolutionItems) = preProject
assets\images\logo.eps = assets\images\logo.eps
assets\images\logo.svg = assets\images\logo.svg
assets\images\logomark.eps = assets\images\logomark.eps
assets\images\logomark.svg = assets\images\logomark.svg
assets\images\logomark_background.eps = assets\images\logomark_background.eps
assets\images\logomark_background.svg = assets\images\logomark_background.svg
assets\images\logomark_black.eps = assets\images\logomark_black.eps
assets\images\logomark_black.svg = assets\images\logomark_black.svg
assets\images\logomark_white.eps = assets\images\logomark_white.eps
assets\images\logomark_white.svg = assets\images\logomark_white.svg
assets\images\logo_background.eps = assets\images\logo_background.eps
assets\images\logo_background.svg = assets\images\logo_background.svg
assets\images\logo_black.eps = assets\images\logo_black.eps
assets\images\logo_black.svg = assets\images\logo_black.svg
assets\images\logo_white.eps = assets\images\logo_white.eps
assets\images\logo_white.svg = assets\images\logo_white.svg
assets\images\transparent_logo.png = assets\images\transparent_logo.png
assets\images\transparent_logomark.ico = assets\images\transparent_logomark.ico
assets\images\transparent_logomark.png = assets\images\transparent_logomark.png
assets\images\transparent_logomark_black.png = assets\images\transparent_logomark_black.png
assets\images\transparent_logomark_white.png = assets\images\transparent_logomark_white.png
assets\images\transparent_logo_black.png = assets\images\transparent_logo_black.png
assets\images\transparent_logo_white.png = assets\images\transparent_logo_white.png
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "fonts", "fonts", "{2A6EE5DF-BD7E-4CC6-BB9B-7BE5FC128302}"
ProjectSection(SolutionItems) = preProject
assets\fonts\Aquatico-Regular.otf = assets\fonts\Aquatico-Regular.otf
assets\fonts\Aquatico-Regular.ttf = assets\fonts\Aquatico-Regular.ttf
assets\fonts\Aquatico-Regular.woff = assets\fonts\Aquatico-Regular.woff
assets\fonts\Aquatico-Regular.woff2 = assets\fonts\Aquatico-Regular.woff2
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
4 changes: 2 additions & 2 deletions src/api/Synapse.Api.Http/Synapse.Api.Http.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Neuroglia.Mediation.AspNetCore" Version="4.12.7" />
<PackageReference Include="Neuroglia.Security.AspNetCore" Version="4.12.7" />
<PackageReference Include="Neuroglia.Mediation.AspNetCore" Version="4.12.8" />
<PackageReference Include="Neuroglia.Security.AspNetCore" Version="4.12.8" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.7.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

<ItemGroup>
<PackageReference Include="IdentityModel" Version="7.0.0" />
<PackageReference Include="Neuroglia.Data.Expressions.Abstractions" Version="4.12.7" />
<PackageReference Include="Neuroglia.Data.Infrastructure.Redis" Version="4.12.7" />
<PackageReference Include="Neuroglia.Data.Infrastructure.ResourceOriented.Redis" Version="4.12.7" />
<PackageReference Include="Neuroglia.Mediation" Version="4.12.7" />
<PackageReference Include="Neuroglia.Plugins" Version="4.12.7" />
<PackageReference Include="Neuroglia.Data.Expressions.Abstractions" Version="4.12.8" />
<PackageReference Include="Neuroglia.Data.Infrastructure.Redis" Version="4.12.8" />
<PackageReference Include="Neuroglia.Data.Infrastructure.ResourceOriented.Redis" Version="4.12.8" />
<PackageReference Include="Neuroglia.Mediation" Version="4.12.8" />
<PackageReference Include="Neuroglia.Plugins" Version="4.12.8" />
<PackageReference Include="ServerlessWorkflow.Sdk.IO" Version="1.0.0-alpha2.8" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions src/core/Synapse.Core/Synapse.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Neuroglia.Data.Infrastructure.ResourceOriented" Version="4.12.7" />
<PackageReference Include="Neuroglia.Eventing.CloudEvents" Version="4.12.7" />
<PackageReference Include="Neuroglia.Data.Infrastructure.ResourceOriented" Version="4.12.8" />
<PackageReference Include="Neuroglia.Eventing.CloudEvents" Version="4.12.8" />
<PackageReference Include="Semver" Version="2.3.0" />
<PackageReference Include="ServerlessWorkflow.Sdk" Version="1.0.0-alpha2.8" />
</ItemGroup>
Expand Down
12 changes: 6 additions & 6 deletions src/correlator/Synapse.Correlator/Synapse.Correlator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
<PackageReference Include="Microsoft.Extensions.Configuration.KeyPerFile" Version="8.0.7" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
<PackageReference Include="Neuroglia.Data.Expressions.JavaScript" Version="4.12.7" />
<PackageReference Include="Neuroglia.Data.Expressions.JQ" Version="4.12.7" />
<PackageReference Include="Neuroglia.Eventing.CloudEvents.AspNetCore" Version="4.12.7" />
<PackageReference Include="Neuroglia.Mediation.AspNetCore" Version="4.12.7" />
<PackageReference Include="Neuroglia.Eventing.CloudEvents.Infrastructure" Version="4.12.7" />
<PackageReference Include="Neuroglia.Security.AspNetCore" Version="4.12.7" />
<PackageReference Include="Neuroglia.Data.Expressions.JavaScript" Version="4.12.8" />
<PackageReference Include="Neuroglia.Data.Expressions.JQ" Version="4.12.8" />
<PackageReference Include="Neuroglia.Eventing.CloudEvents.AspNetCore" Version="4.12.8" />
<PackageReference Include="Neuroglia.Mediation.AspNetCore" Version="4.12.8" />
<PackageReference Include="Neuroglia.Eventing.CloudEvents.Infrastructure" Version="4.12.8" />
<PackageReference Include="Neuroglia.Security.AspNetCore" Version="4.12.8" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.7.0" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.7.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
namespace Synapse.Dashboard.Components;

/// <summary>
/// Represents the object that holds the data required to render the view of a workflow's end node
/// Used as a ghost node to create a top padding in clusters
/// </summary>
public class PortNodeViewModel(string id)
: WorkflowNodeViewModel(id, new() { CssClass = "port-node", Shape = NodeShape.Rectangle, Width = 1, Height = 1 })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@
height="@(bounds.Height.ToInvariantString())"
rx="@((Node.RadiusX).ToInvariantString())"
ry="@((Node.RadiusY).ToInvariantString())" />
<path class="node-cartouche" d="m @((bounds.X).ToInvariantString()) @((bounds.Y + (Node.RadiusX)).ToInvariantString()) c 0 -@(((Node.RadiusX) / 2).ToInvariantString()) @(((Node.RadiusX) / 2).ToInvariantString()) -@((Node.RadiusX).ToInvariantString()) @((Node.RadiusX).ToInvariantString()) -@((Node.RadiusX).ToInvariantString()) h @(((bounds.Width / 8) - 1).ToInvariantString()) v @((bounds.Height).ToInvariantString()) h -@(((bounds.Width / 8) - 1).ToInvariantString()) c -@(((Node.RadiusX) / 2).ToInvariantString()) 0 -@((Node.RadiusX).ToInvariantString()) -@(((Node.RadiusX) / 2).ToInvariantString()) -@((Node.RadiusX).ToInvariantString()) -@((Node.RadiusX).ToInvariantString()) z" />
<path class="node-cartouche" d="
m @(bounds.X.ToInvariantString()) @((bounds.Y + Node.RadiusX).ToInvariantString())
c 0 -@((Node.RadiusX / 2).ToInvariantString()) @((Node.RadiusX / 2).ToInvariantString()) -@(Node.RadiusX.ToInvariantString()) @(Node.RadiusX.ToInvariantString()) -@(Node.RadiusX.ToInvariantString())
h @(((bounds.Width / 8) - 1).ToInvariantString())
v @(bounds.Height.ToInvariantString())
h -@(((bounds.Width / 8) - 1).ToInvariantString())
c -@((Node.RadiusX / 2).ToInvariantString()) 0 -@(Node.RadiusX.ToInvariantString()) -@((Node.RadiusX / 2).ToInvariantString()) -@(Node.RadiusX.ToInvariantString()) -@(Node.RadiusX.ToInvariantString())
z"
/>
}
else
{
Expand All @@ -29,7 +37,15 @@
height="@(bounds.Height.ToInvariantString())"
rx="@((Node.RadiusX).ToInvariantString())"
ry="@((Node.RadiusY).ToInvariantString())" />
<path class="node-cartouche" d="m @((bounds.X).ToInvariantString()) @((bounds.Y + (Node.RadiusX)).ToInvariantString()) c 0 -@(((Node.RadiusX) / 2).ToInvariantString()) @(((Node.RadiusX) / 2).ToInvariantString()) -@((Node.RadiusX).ToInvariantString()) @((Node.RadiusX).ToInvariantString()) -@((Node.RadiusX).ToInvariantString()) h @(((bounds.Width / 8) - 1).ToInvariantString()) v @((bounds.Height).ToInvariantString()) h -@(((bounds.Width / 8) - 1).ToInvariantString()) c -@(((Node.RadiusX) / 2).ToInvariantString()) 0 -@((Node.RadiusX).ToInvariantString()) -@(((Node.RadiusX) / 2).ToInvariantString()) -@((Node.RadiusX).ToInvariantString()) -@((Node.RadiusX).ToInvariantString()) z" />
<path class="node-cartouche" d="
m @(bounds.X.ToInvariantString()) @((bounds.Y + Node.RadiusX).ToInvariantString())
c 0 -@((Node.RadiusX / 2).ToInvariantString()) @((Node.RadiusX / 2).ToInvariantString()) -@(Node.RadiusX.ToInvariantString()) @(Node.RadiusX.ToInvariantString()) -@(Node.RadiusX.ToInvariantString())
h @((bounds.Width - (Node.RadiusX * 2)).ToInvariantString())
c @((Node.RadiusX / 2).ToInvariantString()) 0 @(Node.RadiusX.ToInvariantString()) @((Node.RadiusY / 2).ToInvariantString()) @(Node.RadiusX.ToInvariantString()) @(Node.RadiusY.ToInvariantString())
v @Constants.ClusterHeight
h -@(bounds.Width.ToInvariantString())
z"
/>
}
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
<svg width="@width" height="@height">
<use href="#@Symbol" />
</svg>
<pre>
@Constants.ClusterHeight
@bounds.Height
@_symbolSize
</pre>
</g>
}

Expand All @@ -24,9 +29,12 @@
(0 - (bounds.Width - _symbolSize) / 2).ToInvariantString();
string? y => Node.Shape != SynapseNodeShape.Cartouche ?
(0 - bounds.Height / 4).ToInvariantString() :
(0 - _symbolSize / 2).ToInvariantString();
!WorkflowNode.IsCluster ?
(0 - _symbolSize / 2).ToInvariantString() :
(0 - (bounds.Height + _symbolSize - Constants.ClusterHeight) / 2).ToInvariantString();

[CascadingParameter(Name = "Node")] public INodeViewModel Node { get; set; } = null!;
[CascadingParameter(Name = "Symbol")] public string? Symbol { get; set; }
protected virtual IWorkflowNodeViewModel WorkflowNode => (IWorkflowNodeViewModel)this.Node;

}
2 changes: 1 addition & 1 deletion src/dashboard/Synapse.Dashboard/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
builder.Services.AddSingleton<IMonacoEditorHelper, MonacoEditorHelper>();
builder.Services.AddScoped<IApplicationLayout, ApplicationLayout>();
builder.Services.AddSingleton<MonacoInterop>();
builder.Services.AddSingleton<IDagreService, DagreService>();
builder.Services.AddSingleton<IGraphLayoutService, GraphLayoutService>();
builder.Services.AddSingleton<IWorkflowGraphBuilder, WorkflowGraphBuilder>();
builder.Services.AddSingleton<IBreadcrumbManager, BreadcrumbManager>();

Expand Down
31 changes: 22 additions & 9 deletions src/dashboard/Synapse.Dashboard/Services/WorkflowGraphBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using Neuroglia.Blazor.Dagre;
using Neuroglia.Blazor.Dagre.Models;
using ServerlessWorkflow.Sdk;
using ServerlessWorkflow.Sdk.Models;
using ServerlessWorkflow.Sdk.Models.Calls;
using ServerlessWorkflow.Sdk.Models.Tasks;
using System.Diagnostics;
using System.Xml.Linq;

namespace Synapse.Dashboard.Services;

Expand All @@ -30,6 +30,9 @@ public class WorkflowGraphBuilder(IYamlSerializer yamlSerializer, IJsonSerialize
: IWorkflowGraphBuilder
{

const string _portSuffix = "_port";
const double characterSize = 8d;

/// <summary>
/// Gets the default radius for start and end nodes
/// </summary>
Expand Down Expand Up @@ -193,7 +196,7 @@ protected virtual NodeViewModel BuildDoTaskNode(TaskNodeRenderingContext<DoTaskD
ArgumentNullException.ThrowIfNull(context);
var taskCount = context.TaskDefinition.Do.Count;
var cluster = new DoTaskNodeViewModel(context.TaskReference, context.TaskName, $"{taskCount} task{(taskCount > 1 ? "s" : "")}");
var port = new PortNodeViewModel(context.TaskReference + "-port");
var port = new PortNodeViewModel(context.TaskReference + _portSuffix);
cluster.AddChild(port);
if (context.TaskGroup == null) context.Graph.AddCluster(cluster);
else context.TaskGroup.AddChild(cluster);
Expand Down Expand Up @@ -431,18 +434,28 @@ protected virtual NodeViewModel BuildWaitTaskNode(TaskNodeRenderingContext<WaitT
/// <param name="target">The node to draw the edge to</param>
/// <param name="label">The edge label, if any</param>
/// <returns>A new awaitable <see cref="Task"/></returns>
protected virtual void BuildEdge(GraphViewModel graph, NodeViewModel source, NodeViewModel target, string? label = null)
protected virtual IEdgeViewModel BuildEdge(GraphViewModel graph, NodeViewModel source, NodeViewModel target, string? label = null)
{
var existingEdge = graph.Edges.Select(keyValuePair => keyValuePair.Value).FirstOrDefault(edge => edge.SourceId == source.Id && edge.TargetId == target.Id);
if (existingEdge != null)
var edge = graph.Edges.Select(keyValuePair => keyValuePair.Value).FirstOrDefault(edge => edge.SourceId == source.Id && edge.TargetId == target.Id);
if (edge != null)
{
if (!string.IsNullOrEmpty(label)) {
existingEdge.Label = existingEdge.Label + " / " + label;
edge.Label = edge.Label + " / " + label;
edge.Width = edge.Label.Length * characterSize;
}
return;
return edge;
}
edge = new EdgeViewModel(source.Id, target.Id, label);
if (!string.IsNullOrEmpty(edge.Label))
{
edge.LabelPosition = EdgeLabelPosition.Center;
edge.Width = edge.Label.Length * characterSize;
}
if (target.Id.EndsWith(_portSuffix))
{
edge.EndMarkerId = null;
}
if (graph.Edges.Select(keyValuePair => keyValuePair.Value).Any(edge => edge.SourceId == source.Id && edge.TargetId == target.Id && edge.Label == label)) return;
graph.AddEdge(new EdgeViewModel(source.Id, target.Id, label));
return graph.AddEdge(edge);
}

/// <summary>
Expand Down
3 changes: 1 addition & 2 deletions src/dashboard/Synapse.Dashboard/Synapse.Dashboard.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="8.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.7" PrivateAssets="all" />
<PackageReference Include="moment.net" Version="1.3.4" />
<PackageReference Include="Neuroglia.Blazor.Dagre" Version="4.12.7" />
<!--<PackageReference Include="Neuroglia.Blazor.Dagre" Version="4.12.5" />-->
<PackageReference Include="Neuroglia.Blazor.Dagre" Version="4.12.8" />
</ItemGroup>

<ItemGroup>
Expand Down
10 changes: 5 additions & 5 deletions src/runner/Synapse.Runner/Synapse.Runner.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.OpenApi.Readers" Version="1.6.17" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
<PackageReference Include="Neuroglia.Data.Expressions.JavaScript" Version="4.12.7" />
<PackageReference Include="Neuroglia.Data.Expressions.JQ" Version="4.12.7" />
<PackageReference Include="Neuroglia.Eventing.CloudEvents.Infrastructure" Version="4.12.7" />
<PackageReference Include="Neuroglia.Scripting.NodeJS" Version="4.12.7" />
<PackageReference Include="Neuroglia.Scripting.Python" Version="4.12.7" />
<PackageReference Include="Neuroglia.Data.Expressions.JavaScript" Version="4.12.8" />
<PackageReference Include="Neuroglia.Data.Expressions.JQ" Version="4.12.8" />
<PackageReference Include="Neuroglia.Eventing.CloudEvents.Infrastructure" Version="4.12.8" />
<PackageReference Include="Neuroglia.Scripting.NodeJS" Version="4.12.8" />
<PackageReference Include="Neuroglia.Scripting.Python" Version="4.12.8" />
<PackageReference Include="protobuf-net.Grpc.ClientFactory" Version="1.1.1" />
<PackageReference Include="System.Reactive" Version="6.0.1" />
</ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions tests/Synapse.UnitTests/Synapse.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="Neuroglia.Data.Expressions.JQ" Version="4.12.7" />
<PackageReference Include="Neuroglia.Data.Infrastructure.Memory" Version="4.12.7" />
<PackageReference Include="Neuroglia.Data.Infrastructure.ResourceOriented.Redis" Version="4.12.7" />
<PackageReference Include="Neuroglia.Data.Expressions.JQ" Version="4.12.8" />
<PackageReference Include="Neuroglia.Data.Infrastructure.Memory" Version="4.12.8" />
<PackageReference Include="Neuroglia.Data.Infrastructure.ResourceOriented.Redis" Version="4.12.8" />
<PackageReference Include="ServerlessWorkflow.Sdk.Builders" Version="1.0.0-alpha2.8" />
<PackageReference Include="ServerlessWorkflow.Sdk.IO" Version="1.0.0-alpha2.8" />
<PackageReference Include="Testcontainers" Version="3.9.0" />
Expand Down

0 comments on commit ded68cb

Please sign in to comment.