From d6b573f892db4b74e9f29bbb7075cd55aa2f2467 Mon Sep 17 00:00:00 2001 From: colin Date: Fri, 11 Sep 2026 18:14:52 +0800 Subject: [PATCH] feat: Add Alterations Module --- Directory.Packages.props | 2 + aspnet-core/LINGYUN.MicroService.Aspire.slnx | 2 + ...UN.Abp.MicroService.WorkflowService.csproj | 3 ++ .../WorkflowServiceModule.Configure.cs | 15 ++++-- .../WorkflowServiceModule.cs | 2 + .../FodyWeavers.xml | 3 ++ .../FodyWeavers.xsd | 30 ++++++++++++ .../LINGYUN.Abp.ElsaNext.Alterations.csproj | 24 ++++++++++ .../AbpElsaNextAlterationsModule.cs | 28 +++++++++++ ...bpElsaNextStudioAlterationsBlazorModule.cs | 47 +++++++++++++++++++ .../FodyWeavers.xml | 3 ++ .../FodyWeavers.xsd | 30 ++++++++++++ ....ElsaNext.Studio.Alterations.Blazor.csproj | 29 ++++++++++++ .../Resources/AlterationsBlazor/en.json | 7 +++ .../Resources/AlterationsBlazor/zh-Hans.json | 7 +++ .../ElsaStudioAlterationsMenuContributor.cs | 28 +++++++++++ .../_Imports.razor | 5 ++ 17 files changed, 261 insertions(+), 4 deletions(-) create mode 100644 aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Alterations/FodyWeavers.xml create mode 100644 aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Alterations/FodyWeavers.xsd create mode 100644 aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Alterations/LINGYUN.Abp.ElsaNext.Alterations.csproj create mode 100644 aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Alterations/LINGYUN/Abp/ElsaNext/Alterations/AbpElsaNextAlterationsModule.cs create mode 100644 aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/AbpElsaNextStudioAlterationsBlazorModule.cs create mode 100644 aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/FodyWeavers.xml create mode 100644 aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/FodyWeavers.xsd create mode 100644 aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor.csproj create mode 100644 aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/Localization/Resources/AlterationsBlazor/en.json create mode 100644 aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/Localization/Resources/AlterationsBlazor/zh-Hans.json create mode 100644 aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/Navigation/ElsaStudioAlterationsMenuContributor.cs create mode 100644 aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/_Imports.razor diff --git a/Directory.Packages.props b/Directory.Packages.props index c56454e95..15a3e0344 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -246,6 +246,7 @@ + @@ -270,6 +271,7 @@ + diff --git a/aspnet-core/LINGYUN.MicroService.Aspire.slnx b/aspnet-core/LINGYUN.MicroService.Aspire.slnx index 7cd80886c..0ee73ccac 100644 --- a/aspnet-core/LINGYUN.MicroService.Aspire.slnx +++ b/aspnet-core/LINGYUN.MicroService.Aspire.slnx @@ -556,6 +556,7 @@ + @@ -564,6 +565,7 @@ + diff --git a/aspnet-core/aspire/LINGYUN.Abp.MicroService.WorkflowService/LINGYUN.Abp.MicroService.WorkflowService.csproj b/aspnet-core/aspire/LINGYUN.Abp.MicroService.WorkflowService/LINGYUN.Abp.MicroService.WorkflowService.csproj index 89a66b7c6..4a9b0aa05 100644 --- a/aspnet-core/aspire/LINGYUN.Abp.MicroService.WorkflowService/LINGYUN.Abp.MicroService.WorkflowService.csproj +++ b/aspnet-core/aspire/LINGYUN.Abp.MicroService.WorkflowService/LINGYUN.Abp.MicroService.WorkflowService.csproj @@ -19,6 +19,7 @@ + @@ -93,6 +94,8 @@ + + diff --git a/aspnet-core/aspire/LINGYUN.Abp.MicroService.WorkflowService/WorkflowServiceModule.Configure.cs b/aspnet-core/aspire/LINGYUN.Abp.MicroService.WorkflowService/WorkflowServiceModule.Configure.cs index 419496663..149e8fbd7 100644 --- a/aspnet-core/aspire/LINGYUN.Abp.MicroService.WorkflowService/WorkflowServiceModule.Configure.cs +++ b/aspnet-core/aspire/LINGYUN.Abp.MicroService.WorkflowService/WorkflowServiceModule.Configure.cs @@ -1,10 +1,11 @@ using DotNetCore.CAP; using Elsa.Agents; -using Elsa.AI.Persistence.EFCore.Features; using Elsa.AI.Persistence.EFCore.Sqlite.Extensions; +using Elsa.Alterations.Extensions; using Elsa.Extensions; using Elsa.Features.Services; using Elsa.Persistence.EFCore.Extensions; +using Elsa.Persistence.EFCore.Modules.Alterations; using Elsa.Persistence.EFCore.Modules.Labels; using Elsa.Persistence.EFCore.Modules.Management; using Elsa.Persistence.EFCore.Modules.Runtime; @@ -12,7 +13,6 @@ using Elsa.Secrets.Persistence.EFCore.Extensions; using Elsa.Secrets.Persistence.EFCore.Sqlite.Extensions; using Elsa.Studio.Authentication.OpenIdConnect.HttpMessageHandlers; using Elsa.Studio.Workflows.Designer.Extensions; -using LINGYUN.Abp.ElsaNext.Permissions; using LINGYUN.Abp.ElsaNext.Studio.Blazor; using LINGYUN.Abp.Localization.CultureMap; using LINGYUN.Abp.LocalizationManagement; @@ -31,7 +31,6 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Caching.StackExchangeRedis; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Options; using Microsoft.IdentityModel.Logging; using Microsoft.IdentityModel.Tokens; using Microsoft.OpenApi; @@ -49,7 +48,6 @@ using Volo.Abp.AspNetCore.Components.Web.Theming.MudBlazor.Routing; using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc.AntiForgery; using Volo.Abp.Auditing; -using Volo.Abp.Authorization.Permissions; using Volo.Abp.BlobStoring; using Volo.Abp.Caching; using Volo.Abp.EntityFrameworkCore; @@ -160,7 +158,9 @@ public partial class WorkflowServiceModule { options.IsBlazorWebApp = true; }); + services.AddAIPersistenceStores(options => options.UseSqlite()); + PreConfigure(elsa => { elsa.UseWorkflowManagement(management => @@ -173,6 +173,11 @@ public partial class WorkflowServiceModule runtime.UseEntityFrameworkCore(ef => ef.UseSqlite()); }); + elsa.UseAlterations(alteration => + { + alteration.UseEntityFrameworkCore(ef => ef.UseSqlite()); + }); + elsa.UseAgentPersistence(agent => { agent.UseEntityFrameworkCore(ef => ef.UseSqlite()); @@ -226,6 +231,8 @@ public partial class WorkflowServiceModule // options.WithFeature(); //}); + // EndpointSecurityOptions.DisableSecurity(); + services.AddOpenIdConnectAuth(options => { configuration.GetSection("Authentication:OpenIdConnect").Bind(options); diff --git a/aspnet-core/aspire/LINGYUN.Abp.MicroService.WorkflowService/WorkflowServiceModule.cs b/aspnet-core/aspire/LINGYUN.Abp.MicroService.WorkflowService/WorkflowServiceModule.cs index 922e5d874..a00464ccb 100644 --- a/aspnet-core/aspire/LINGYUN.Abp.MicroService.WorkflowService/WorkflowServiceModule.cs +++ b/aspnet-core/aspire/LINGYUN.Abp.MicroService.WorkflowService/WorkflowServiceModule.cs @@ -14,6 +14,7 @@ using LINGYUN.Abp.ElsaNext.Notifications; using LINGYUN.Abp.ElsaNext.Secrets.Blazor; using LINGYUN.Abp.ElsaNext.Server; using LINGYUN.Abp.ElsaNext.Studio.AI.Blazor; +using LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor; using LINGYUN.Abp.ElsaNext.Studio.Blazor; using LINGYUN.Abp.ElsaNext.Studio.Dashboard.Blazor; using LINGYUN.Abp.ElsaNext.Studio.Diagnostics.OpenTelemetry.Blazor; @@ -76,6 +77,7 @@ namespace LINGYUN.Abp.MicroService.WorkflowService; typeof(AbpElsaNextAgentsBlazorModule), typeof(AbpElsaNextSecretsBlazorModule), typeof(AbpElsaNextStudioAIBlazorModule), + typeof(AbpElsaNextStudioAlterationsBlazorModule), typeof(AbpElsaNextStudioDashboardBlazorModule), typeof(AbpElsaNextStudioDiagnosticsOpenTelemetryBlazorModule), typeof(AbpElsaNextStudioDiagnosticsStructuredLogsBlazorModule), diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Alterations/FodyWeavers.xml b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Alterations/FodyWeavers.xml new file mode 100644 index 000000000..5d6962159 --- /dev/null +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Alterations/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Alterations/FodyWeavers.xsd b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Alterations/FodyWeavers.xsd new file mode 100644 index 000000000..3f3946e28 --- /dev/null +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Alterations/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Alterations/LINGYUN.Abp.ElsaNext.Alterations.csproj b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Alterations/LINGYUN.Abp.ElsaNext.Alterations.csproj new file mode 100644 index 000000000..2001eff90 --- /dev/null +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Alterations/LINGYUN.Abp.ElsaNext.Alterations.csproj @@ -0,0 +1,24 @@ + + + + + + + net10.0 + LINGYUN.Abp.ElsaNext.Alterations + LINGYUN.Abp.ElsaNext.Alterations + false + false + false + + + + + + + + + + + + diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Alterations/LINGYUN/Abp/ElsaNext/Alterations/AbpElsaNextAlterationsModule.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Alterations/LINGYUN/Abp/ElsaNext/Alterations/AbpElsaNextAlterationsModule.cs new file mode 100644 index 000000000..e1f4c0470 --- /dev/null +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Alterations/LINGYUN/Abp/ElsaNext/Alterations/AbpElsaNextAlterationsModule.cs @@ -0,0 +1,28 @@ +using Elsa.Alterations.Extensions; +using Elsa.Features.Contracts; +using Elsa.Features.Services; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.ElsaNext.Alterations; + +[DependsOn( + typeof(AbpElsaNextModule))] +public class AbpElsaNextAlterationsModule : AbpModule +{ + public override void PreConfigureServices(ServiceConfigurationContext context) + { + PreConfigure(elsa => + { + elsa.UseAlterations(); + }); + } + + public override void OnApplicationInitialization(ApplicationInitializationContext context) + { + // TODO: 强制启用Studio中的Alterations? + var registry = context.ServiceProvider.GetRequiredService(); + registry.Add(new("Alterations.ShellFeatures.Alterations", "Elsa", "Alterations.ShellFeatures.Alterations")); + } +} diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/AbpElsaNextStudioAlterationsBlazorModule.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/AbpElsaNextStudioAlterationsBlazorModule.cs new file mode 100644 index 000000000..f60916195 --- /dev/null +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/AbpElsaNextStudioAlterationsBlazorModule.cs @@ -0,0 +1,47 @@ +using Elsa.Studio.Alterations.Extensions; +using LINGYUN.Abp.ElsaNext.Alterations; +using LINGYUN.Abp.ElsaNext.Localization; +using LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor.Navigation; +using LINGYUN.Abp.ElsaNext.Studio.Blazor; +using Volo.Abp.AspNetCore.Components.Web.Theming.MudBlazor.Routing; +using Volo.Abp.Localization; +using Volo.Abp.Modularity; +using Volo.Abp.UI.Navigation; +using Volo.Abp.VirtualFileSystem; + +namespace LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor; + +[DependsOn( + typeof(AbpElsaNextAlterationsModule), + typeof(AbpElsaNextStudioBlazorModule))] +public class AbpElsaNextStudioAlterationsBlazorModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + var configuration = context.Configuration.GetSection("Elsa:Studio"); + + Configure(options => + { + options.AdditionalAssemblies.Add(typeof(Elsa.Studio.Alterations.Feature).Assembly); + }); + + Configure(options => + { + options.MenuContributors.Add(new ElsaStudioAlterationsMenuContributor()); + }); + + Configure(options => + { + options.FileSets.AddEmbedded("LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor"); + }); + + Configure(options => + { + options.Resources + .Get() + .AddVirtualJson("/Localization/Resources/AlterationsBlazor"); + }); + + context.Services.AddAlterationsModule(); + } +} diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/FodyWeavers.xml b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/FodyWeavers.xml new file mode 100644 index 000000000..5d6962159 --- /dev/null +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/FodyWeavers.xsd b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/FodyWeavers.xsd new file mode 100644 index 000000000..3f3946e28 --- /dev/null +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor.csproj b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor.csproj new file mode 100644 index 000000000..2c9202ba5 --- /dev/null +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor.csproj @@ -0,0 +1,29 @@ + + + + + + + net10.0 + LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor + LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor + false + false + false + + + + + + + + + + + + + + + + + diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/Localization/Resources/AlterationsBlazor/en.json b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/Localization/Resources/AlterationsBlazor/en.json new file mode 100644 index 000000000..18e81f1fd --- /dev/null +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/Localization/Resources/AlterationsBlazor/en.json @@ -0,0 +1,7 @@ +{ + "culture": "en", + "texts": { + "Menu:Alterations": "Alterations", + "Alterations": "Alterations" + } +} diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/Localization/Resources/AlterationsBlazor/zh-Hans.json b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/Localization/Resources/AlterationsBlazor/zh-Hans.json new file mode 100644 index 000000000..dd101c953 --- /dev/null +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/Localization/Resources/AlterationsBlazor/zh-Hans.json @@ -0,0 +1,7 @@ +{ + "culture": "zh-Hans", + "texts": { + "Menu:Alterations": "变更", + "Alterations": "变更" + } +} diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/Navigation/ElsaStudioAlterationsMenuContributor.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/Navigation/ElsaStudioAlterationsMenuContributor.cs new file mode 100644 index 000000000..7c1a77171 --- /dev/null +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/Navigation/ElsaStudioAlterationsMenuContributor.cs @@ -0,0 +1,28 @@ +using LINGYUN.Abp.ElsaNext.Localization; +using LINGYUN.Abp.ElsaNext.Studio.Blazor.Navigation; +using System.Threading.Tasks; +using Volo.Abp.UI.Navigation; + +namespace LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor.Navigation; + +public class ElsaStudioAlterationsMenuContributor : IMenuContributor +{ + public Task ConfigureMenuAsync(MenuConfigurationContext context) + { + if (context.Menu.Name == StandardMenus.Main) + { + var menu = context.Menu; + var l = context.GetLocalizer(); + + var group = menu.GetMenuItemOrNull(ElsaStudioMenus.GroupName); + group?.AddItem(new ApplicationMenuItem( + ElsaStudioMenus.GroupName + ".Alterations", + l["Menu:Alterations"], + url: "/alterations", + icon: "fa fa-clock-rotate-left", + order: 5)); + } + + return Task.CompletedTask; + } +} diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/_Imports.razor b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/_Imports.razor new file mode 100644 index 000000000..6a4064616 --- /dev/null +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.ElsaNext.Studio.Alterations.Blazor/_Imports.razor @@ -0,0 +1,5 @@ +@using Microsoft.AspNetCore.Authorization +@using Microsoft.AspNetCore.Components.Web +@using Elsa.Studio.Components +@using Elsa.Studio.Localization +@using MudBlazor