From b69f360b90c2febc45a88cf3d7a88d0f32d7e448 Mon Sep 17 00:00:00 2001 From: colin Date: Wed, 12 Nov 2025 11:58:35 +0800 Subject: [PATCH] fix(elsa): Fix elsa module - Fix the issue where the workflow editor cannot be opened - Fix the issue where the workflow endpoint is not registered - Fix the invalid HttpEndpoint workflow --- .../Bundling/AbpElsaScriptBundleContributor.cs | 8 ++------ .../Bundling/AbpElsaStyleBundleContributor.cs | 10 +++------- .../LINGYUN.Abp.Elsa.Designer/Pages/Elsa/Index.cshtml | 11 ++++++++--- .../LINGYUN/Abp/Elsa/AbpElsaServerModule.cs | 1 + .../LY.MicroService.Applications.Single/Program.cs | 1 + .../WorkflowManagementHttpApiHostModule.cs | 5 ++--- 6 files changed, 17 insertions(+), 19 deletions(-) diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Designer/Bundling/AbpElsaScriptBundleContributor.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Designer/Bundling/AbpElsaScriptBundleContributor.cs index 1426e116c..5e818c6bb 100644 --- a/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Designer/Bundling/AbpElsaScriptBundleContributor.cs +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Designer/Bundling/AbpElsaScriptBundleContributor.cs @@ -1,5 +1,4 @@ -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using System.Collections.Generic; using Volo.Abp.AspNetCore.Mvc.UI.Bundling; @@ -9,9 +8,6 @@ public class AbpElsaScriptBundleContributor : BundleContributor { public override void ConfigureBundle(BundleConfigurationContext context) { - var configuration = context.ServiceProvider.GetRequiredService(); - var basePath = configuration["Hosting:BasePath"] ?? ""; - - context.Files.AddIfNotContains($"{basePath}/_content/Elsa.Designer.Components.Web/monaco-editor/min/vs/loader.js"); + context.Files.AddIfNotContains("/_content/Elsa.Designer.Components.Web/monaco-editor/min/vs/loader.js"); } } diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Designer/Bundling/AbpElsaStyleBundleContributor.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Designer/Bundling/AbpElsaStyleBundleContributor.cs index e86ff13f5..1aa37b517 100644 --- a/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Designer/Bundling/AbpElsaStyleBundleContributor.cs +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Designer/Bundling/AbpElsaStyleBundleContributor.cs @@ -1,5 +1,4 @@ -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using System.Collections.Generic; using Volo.Abp.AspNetCore.Mvc.UI.Bundling; @@ -9,10 +8,7 @@ public class AbpElsaStyleBundleContributor : BundleContributor { public override void ConfigureBundle(BundleConfigurationContext context) { - var configuration = context.ServiceProvider.GetRequiredService(); - var basePath = configuration["Hosting:BasePath"] ?? ""; - - context.Files.AddIfNotContains($"{basePath}/_content/Elsa.Designer.Components.Web/elsa-workflows-studio/assets/fonts/inter/inter.css"); - context.Files.AddIfNotContains($"{basePath}/_content/Elsa.Designer.Components.Web/elsa-workflows-studio/elsa-workflows-studio.css"); + context.Files.AddIfNotContains("/_content/Elsa.Designer.Components.Web/elsa-workflows-studio/assets/fonts/inter/inter.css"); + context.Files.AddIfNotContains("/_content/Elsa.Designer.Components.Web/elsa-workflows-studio/elsa-workflows-studio.css"); } } diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Designer/Pages/Elsa/Index.cshtml b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Designer/Pages/Elsa/Index.cshtml index 4b2a6cfd4..7d1ec89e9 100644 --- a/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Designer/Pages/Elsa/Index.cshtml +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Designer/Pages/Elsa/Index.cshtml @@ -10,7 +10,7 @@ @inject IHtmlLocalizer L @{ var serverUrl = Configuration["Elsa:Server:BaseUrl"]; - var basePath = Configuration["Hosting:BasePath"] ?? ""; + var basePath = Request.PathBase.Value; PageLayout.Content.Title = L["Elsa:Designer"].Value; PageLayout.Content.BreadCrumb.Add(L["Elsa:Designer"].Value); @@ -25,9 +25,9 @@ } - + - + @@ -43,4 +43,9 @@ const elsa = e.detail; elsa.pluginManager.registerPlugin(WebhooksPlugin); }); + + // Some components publish DOM events that we can handle directly: + elsaStudioRoot.addEventListener('workflow-changed', e => { + console.log('Workflow model changed! New model: ${e.detail}'); + }) \ No newline at end of file diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Server/LINGYUN/Abp/Elsa/AbpElsaServerModule.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Server/LINGYUN/Abp/Elsa/AbpElsaServerModule.cs index 762afef26..2dae8f825 100644 --- a/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Server/LINGYUN/Abp/Elsa/AbpElsaServerModule.cs +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Server/LINGYUN/Abp/Elsa/AbpElsaServerModule.cs @@ -21,6 +21,7 @@ public class AbpElsaServerModule : AbpModule .AddSingleton() .AddScoped() .AddSingleton() + .AddElsaApiEndpoints() .AddSignalR(); PreConfigure(mvcBuilder => diff --git a/aspnet-core/services/LY.MicroService.Applications.Single/Program.cs b/aspnet-core/services/LY.MicroService.Applications.Single/Program.cs index 50890bddf..2e6709ace 100644 --- a/aspnet-core/services/LY.MicroService.Applications.Single/Program.cs +++ b/aspnet-core/services/LY.MicroService.Applications.Single/Program.cs @@ -72,5 +72,6 @@ app.UseAbpSwaggerUI(options => app.UseAuditing(); app.UseAbpSerilogEnrichers(); app.UseConfiguredEndpoints(); +app.UseHttpActivities(); await app.RunAsync(); diff --git a/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.cs b/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.cs index 9e1c0bc86..5f9e0a95d 100644 --- a/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.cs +++ b/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.cs @@ -1,5 +1,4 @@ -using Elsa; -using LINGYUN.Abp.AspNetCore.HttpOverrides; +using LINGYUN.Abp.AspNetCore.HttpOverrides; using LINGYUN.Abp.AspNetCore.Mvc.Localization; using LINGYUN.Abp.AspNetCore.Mvc.Wrapper; using LINGYUN.Abp.AuditLogging.Elasticsearch; @@ -146,7 +145,6 @@ public partial class WorkflowManagementHttpApiHostModule : AbpModule app.MapAbpStaticAssets(); app.UseRouting(); app.UseCors(); - app.UseElsaFeatures(); app.UseAuthentication(); app.UseJwtTokenMiddleware(); app.UseMultiTenancy(); @@ -165,5 +163,6 @@ public partial class WorkflowManagementHttpApiHostModule : AbpModule app.UseAuditing(); app.UseAbpSerilogEnrichers(); app.UseConfiguredEndpoints(); + app.UseHttpActivities(); } }