Browse Source
- Upgrade elsa 2.x to 2.15.2 - Redirecting the `Rebus.RabbitMq` package version resolves the compatibility issue of the` RabbitMQ.Client` 6.x - Add `LINGYUN.Abp.Elsa.Designer`pull/1258/head
31 changed files with 460 additions and 28 deletions
@ -1,21 +0,0 @@ |
|||
using Microsoft.Extensions.Hosting; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Data; |
|||
|
|||
namespace LY.MicroService.Applications.Single.EntityFrameworkCore.DataSeeder; |
|||
|
|||
public class ApplicationSingleDataSeederWorker : BackgroundService |
|||
{ |
|||
protected IDataSeeder DataSeeder { get; } |
|||
|
|||
public ApplicationSingleDataSeederWorker(IDataSeeder dataSeeder) |
|||
{ |
|||
DataSeeder = dataSeeder; |
|||
} |
|||
|
|||
protected async override Task ExecuteAsync(CancellationToken stoppingToken) |
|||
{ |
|||
await DataSeeder.SeedAsync(); |
|||
} |
|||
} |
|||
@ -0,0 +1,73 @@ |
|||
using LINGYUN.Abp.Elsa.Designer.Bundling; |
|||
using LINGYUN.Abp.Elsa.Designer.Navigation; |
|||
using LINGYUN.Abp.Elsa.Localization; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.AspNetCore.Mvc.Localization; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Bundling; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Bundling; |
|||
using Volo.Abp.Localization; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.UI.Navigation; |
|||
using Volo.Abp.VirtualFileSystem; |
|||
|
|||
namespace LINGYUN.Abp.Elsa.Designer; |
|||
|
|||
[DependsOn(typeof(AbpElsaModule))] |
|||
[DependsOn(typeof(AbpAspNetCoreMvcUiThemeSharedModule))] |
|||
public class AbpElsaDesignerModule : AbpModule |
|||
{ |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.PreConfigure<AbpMvcDataAnnotationsLocalizationOptions>(options => |
|||
{ |
|||
options.AddAssemblyResource(typeof(ElsaResource), typeof(AbpElsaDesignerModule).Assembly); |
|||
}); |
|||
|
|||
PreConfigure<IMvcBuilder>(mvcBuilder => |
|||
{ |
|||
mvcBuilder.AddApplicationPartIfNotExists(typeof(AbpElsaDesignerModule).Assembly); |
|||
}); |
|||
} |
|||
|
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpVirtualFileSystemOptions>(options => |
|||
{ |
|||
options.FileSets.AddEmbedded<AbpElsaDesignerModule>(); |
|||
}); |
|||
|
|||
Configure<AbpLocalizationOptions>(options => |
|||
{ |
|||
options.Resources |
|||
.Get<ElsaResource>() |
|||
.AddVirtualJson("/Localization/Resources"); |
|||
}); |
|||
|
|||
Configure<AbpNavigationOptions>(options => |
|||
{ |
|||
options.MenuContributors.Add(new AbpElsaDesignerContributor()); |
|||
}); |
|||
|
|||
Configure<AbpBundlingOptions>(options => |
|||
{ |
|||
options |
|||
.StyleBundles |
|||
.Add(AbpElsaBundles.Styles.Global, bundle => |
|||
{ |
|||
bundle |
|||
.AddBaseBundles(StandardBundles.Styles.Global) |
|||
.AddContributors(typeof(AbpElsaStyleBundleContributor)); |
|||
}); |
|||
|
|||
options |
|||
.ScriptBundles |
|||
.Add(AbpElsaBundles.Scripts.Global, bundle => |
|||
{ |
|||
bundle |
|||
.AddBaseBundles(StandardBundles.Scripts.Global) |
|||
.AddContributors(typeof(AbpElsaScriptBundleContributor)); |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,33 @@ |
|||
using Asp.Versioning; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Http; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using System.Collections.Generic; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
|
|||
namespace LINGYUN.Abp.Elsa.Designer.Areas.Elsa; |
|||
|
|||
[ApiController] |
|||
[ApiVersion("1")] |
|||
[Route("v{apiVersion:apiVersion}/ElsaAuthentication/options")] |
|||
[Produces("application/json")] |
|||
public class ElsaAuthenticationContextController : AbpControllerBase |
|||
{ |
|||
public static string CurrentTenantAccessorName { get; internal set; } = nameof(AbpTenantAccessor); |
|||
public static string TenantAccessorKeyName { get; internal set; } = "__tenant"; |
|||
[AllowAnonymous] |
|||
[HttpGet] |
|||
[ProducesResponseType(StatusCodes.Status200OK)] |
|||
public IActionResult Handle() |
|||
{ |
|||
return Ok(new |
|||
{ |
|||
AuthenticationStyles = new List<string> |
|||
{ |
|||
"ServerManagedCookie" // Cookie
|
|||
}, |
|||
CurrentTenantAccessorName, |
|||
TenantAccessorKeyName |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using Microsoft.AspNetCore.Mvc; |
|||
|
|||
namespace LINGYUN.Abp.Elsa.Designer.Areas.Elsa; |
|||
|
|||
public class ElsaController : Controller |
|||
{ |
|||
public IActionResult Index() |
|||
{ |
|||
return View(); |
|||
} |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
using Asp.Versioning; |
|||
using Microsoft.AspNetCore.Http; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
|
|||
namespace LINGYUN.Abp.Elsa.Designer.Areas.Elsa; |
|||
|
|||
[ApiController] |
|||
[ApiVersion("1")] |
|||
[Route("v{apiVersion:apiVersion}/ElsaAuthentication/UserInfo")] |
|||
[Produces("application/json")] |
|||
public class ElsaUserInfoController : AbpControllerBase |
|||
{ |
|||
[HttpGet] |
|||
[ProducesResponseType(StatusCodes.Status200OK)] |
|||
public virtual IActionResult Handle() |
|||
{ |
|||
return Ok( |
|||
new { |
|||
IsAuthenticated = CurrentUser.IsAuthenticated, |
|||
name = CurrentUser.Name ?? CurrentUser.UserName, |
|||
tenantId = CurrentUser.TenantId |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using Microsoft.AspNetCore.Mvc; |
|||
|
|||
namespace LINGYUN.Abp.Elsa.Designer.Areas.Elsa; |
|||
|
|||
[Route("v{apiVersion:apiVersion}/ElsaAuthentication/logout")] |
|||
[Produces("application/json")] |
|||
public class ElsaUserLogoutController : Controller |
|||
{ |
|||
[HttpGet] |
|||
public IActionResult Handle() |
|||
{ |
|||
return Redirect("/Account/Logout"); |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
namespace LINGYUN.Abp.Elsa.Designer.Bundling; |
|||
|
|||
public static class AbpElsaBundles |
|||
{ |
|||
public static class Styles |
|||
{ |
|||
public const string Global = "Elsa.Designer"; |
|||
} |
|||
|
|||
public static class Scripts |
|||
{ |
|||
public const string Global = "Elsa.Designer"; |
|||
} |
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using System.Collections.Generic; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Bundling; |
|||
|
|||
namespace LINGYUN.Abp.Elsa.Designer.Bundling; |
|||
|
|||
public class AbpElsaScriptBundleContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
var configuration = context.ServiceProvider.GetRequiredService<IConfiguration>(); |
|||
var basePath = configuration["Hosting:BasePath"] ?? ""; |
|||
|
|||
context.Files.AddIfNotContains($"{basePath}/_content/Elsa.Designer.Components.Web/monaco-editor/min/vs/loader.js"); |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using System.Collections.Generic; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Bundling; |
|||
|
|||
namespace LINGYUN.Abp.Elsa.Designer.Bundling; |
|||
|
|||
public class AbpElsaStyleBundleContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
var configuration = context.ServiceProvider.GetRequiredService<IConfiguration>(); |
|||
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"); |
|||
} |
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
|||
<ConfigureAwait ContinueOnCapturedContext="false" /> |
|||
</Weavers> |
|||
@ -0,0 +1,30 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
|||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. --> |
|||
<xs:element name="Weavers"> |
|||
<xs:complexType> |
|||
<xs:all> |
|||
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1"> |
|||
<xs:complexType> |
|||
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" /> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:all> |
|||
<xs:attribute name="VerifyAssembly" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string"> |
|||
<xs:annotation> |
|||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="GenerateXsd" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:schema> |
|||
@ -0,0 +1,43 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk.Web"> |
|||
|
|||
<Import Project="..\..\..\..\configureawait.props" /> |
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net9.0</TargetFramework> |
|||
<AssemblyName>LINGYUN.Abp.Elsa.Designer</AssemblyName> |
|||
<PackageId>LINGYUN.Abp.Elsa.Designer</PackageId> |
|||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> |
|||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> |
|||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> |
|||
<GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest> |
|||
<RootNamespace>LINGYUN.Abp.Elsa.Designer</RootNamespace> |
|||
<OutputType>Library</OutputType> |
|||
<IsPackable>true</IsPackable> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<EmbeddedResource Include="Pages\**\*.js" /> |
|||
<EmbeddedResource Include="Pages\**\*.css" /> |
|||
<EmbeddedResource Include="Components\**\*.js" /> |
|||
<EmbeddedResource Include="Components\**\*.css" /> |
|||
<EmbeddedResource Include="Localization\**\*.json" /> |
|||
<Content Remove="Components\**\*.js" /> |
|||
<Content Remove="Components\**\*.css" /> |
|||
<Content Remove="Localization\**\*.json" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared" /> |
|||
<PackageReference Include="Elsa.Designer.Components.Web" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\LINGYUN.Abp.Elsa\LINGYUN.Abp.Elsa.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "en", |
|||
"texts": { |
|||
"Permission:ElsaDesigner": "Elsa Designer", |
|||
"Permission:ElsaDesigner:View": "View", |
|||
"Elsa:Designer": "Elsa Designer" |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "zh-Hans", |
|||
"texts": { |
|||
"Permission:ElsaDesigner": "Elsa工作流设计器", |
|||
"Permission:ElsaDesigner:View": "查看", |
|||
"Elsa:Designer": "Elsa工作流设计器" |
|||
} |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
using LINGYUN.Abp.Elsa.Designer.Permissions; |
|||
using LINGYUN.Abp.Elsa.Localization; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Authorization.Permissions; |
|||
using Volo.Abp.UI.Navigation; |
|||
|
|||
namespace LINGYUN.Abp.Elsa.Designer.Navigation; |
|||
|
|||
public class AbpElsaDesignerContributor : IMenuContributor |
|||
{ |
|||
public virtual Task ConfigureMenuAsync(MenuConfigurationContext context) |
|||
{ |
|||
if (context.Menu.Name != StandardMenus.Main) |
|||
{ |
|||
return Task.CompletedTask; |
|||
} |
|||
var l = context.GetLocalizer<ElsaResource>(); |
|||
|
|||
context.Menu.AddItem( |
|||
new ApplicationMenuItem( |
|||
AbpElsaDesignerMenuNames.Index, |
|||
l["Elsa:Designer"], |
|||
url: "~/Elsa", |
|||
icon: "fa fa-code-fork", |
|||
order: 1000, null) |
|||
.RequirePermissions(AbpElsaDesignerPermissionsNames.View) |
|||
); |
|||
|
|||
return Task.CompletedTask; |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
namespace LINGYUN.Abp.Elsa.Designer.Navigation; |
|||
|
|||
public class AbpElsaDesignerMenuNames |
|||
{ |
|||
public const string GroupName = "ElsaDesigner"; |
|||
|
|||
public const string Index = GroupName + ".Index"; |
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
@page |
|||
@using LINGYUN.Abp.Elsa.Localization; |
|||
@using LINGYUN.Abp.Elsa.Designer.Bundling; |
|||
@using LINGYUN.Abp.Elsa.Designer.Navigation; |
|||
@using Volo.Abp.AspNetCore.Mvc.UI.Layout |
|||
@using Microsoft.AspNetCore.Mvc.Localization |
|||
@using Microsoft.Extensions.Configuration |
|||
@inject IPageLayout PageLayout |
|||
@inject IConfiguration Configuration; |
|||
@inject IHtmlLocalizer<ElsaResource> L |
|||
@{ |
|||
var serverUrl = Configuration["Elsa:Server:BaseUrl"]; |
|||
var basePath = Configuration["Hosting:BasePath"] ?? ""; |
|||
|
|||
PageLayout.Content.Title = L["Elsa:Designer"].Value; |
|||
PageLayout.Content.BreadCrumb.Add(L["Elsa:Designer"].Value); |
|||
PageLayout.Content.MenuItemName = AbpElsaDesignerMenuNames.Index; |
|||
} |
|||
|
|||
@section styles { |
|||
<abp-style-bundle name="@AbpElsaBundles.Styles.Global" /> |
|||
} |
|||
|
|||
@section scripts { |
|||
<abp-script-bundle name="@AbpElsaBundles.Scripts.Global" /> |
|||
} |
|||
|
|||
<script type="module" src="@basePath/_content/Elsa.Designer.Components.Web/elsa-workflows-studio/elsa-workflows-studio.esm.js"></script> |
|||
|
|||
<elsa-studio-root server-url="@serverUrl" base-path="@basePath" monaco-lib-path="@basePath.TrimStart('/')/_content/Elsa.Designer.Components.Web/monaco-editor/min"> |
|||
<elsa-studio-dashboard></elsa-studio-dashboard> |
|||
</elsa-studio-root> |
|||
|
|||
<script type="module"> |
|||
// Import publicly exposed services. |
|||
import { WebhooksPlugin } from "@basePath/_content/Elsa.Designer.Components.Web/elsa-workflows-studio/index.esm.js"; |
|||
|
|||
// Get a handle to the elsa-studio-root element. |
|||
const elsaStudioRoot = document.querySelector('elsa-studio-root'); |
|||
|
|||
// Configure Elsa during the 'initializing' event. |
|||
elsaStudioRoot.addEventListener('initializing', e => { |
|||
const elsa = e.detail; |
|||
elsa.pluginManager.registerPlugin(WebhooksPlugin); |
|||
}); |
|||
</script> |
|||
@ -0,0 +1,4 @@ |
|||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling |
|||
@ -0,0 +1,19 @@ |
|||
using LINGYUN.Abp.Elsa.Localization; |
|||
using Volo.Abp.Authorization.Permissions; |
|||
using Volo.Abp.Localization; |
|||
|
|||
namespace LINGYUN.Abp.Elsa.Designer.Permissions; |
|||
|
|||
public class AbpElsaDesignerPermissionDefinitionProvider : PermissionDefinitionProvider |
|||
{ |
|||
public override void Define(IPermissionDefinitionContext context) |
|||
{ |
|||
var elsa = context.AddGroup(AbpElsaDesignerPermissionsNames.GroupName, L("Permission:ElsaDesigner")); |
|||
elsa.AddPermission(AbpElsaDesignerPermissionsNames.View, L("Permission:ElsaDesigner:View")); |
|||
} |
|||
|
|||
private static LocalizableString L(string name) |
|||
{ |
|||
return LocalizableString.Create<ElsaResource>(name); |
|||
} |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
using Volo.Abp.Reflection; |
|||
|
|||
namespace LINGYUN.Abp.Elsa.Designer.Permissions; |
|||
|
|||
public static class AbpElsaDesignerPermissionsNames |
|||
{ |
|||
public const string GroupName = "Abp.Elsa.Designer"; |
|||
|
|||
public const string View = GroupName + ".View"; |
|||
|
|||
public static string[] GetAll() |
|||
{ |
|||
return ReflectionHelper.GetPublicConstantsRecursively(typeof(AbpElsaDesignerPermissionsNames)); |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
{ |
|||
"profiles": { |
|||
"LINGYUN.Abp.Elsa.Designer": { |
|||
"commandName": "Project", |
|||
"launchBrowser": true, |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
}, |
|||
"applicationUrl": "https://localhost:59137;http://localhost:59139" |
|||
} |
|||
} |
|||
} |
|||
@ -1,5 +1,5 @@ |
|||
@page |
|||
@using LY.MicroService.Applications.Single.Pages |
|||
@using LY.MicroService.Applications.Single.Pages.Home |
|||
@using Volo.Abp.Users |
|||
@model IndexModel |
|||
@inject ICurrentUser CurrentUser |
|||
@ -1,6 +1,6 @@ |
|||
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; |
|||
|
|||
namespace LY.MicroService.Applications.Single.Pages |
|||
namespace LY.MicroService.Applications.Single.Pages.Home |
|||
{ |
|||
public class IndexModel : AbpPageModel |
|||
{ |
|||
@ -0,0 +1,4 @@ |
|||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling |
|||
Loading…
Reference in new issue