From eb442130d851840cae6ce58cf2bb6da6b2750d97 Mon Sep 17 00:00:00 2001 From: colin Date: Mon, 13 Jan 2025 16:33:25 +0800 Subject: [PATCH 1/4] :arrow_up: feat: Upgrade abp framework to 8.3.4 --- Directory.Packages.props | 4 +- .../LINGYUN.Abp.Cli/LINGYUN.Abp.Cli.csproj | 2 +- .../LINGYUN/Abp/Cli/Commands/CreateCommand.cs | 2 +- .../Abp/Cli/Commands/GenerateProxyCommand.cs | 2 +- .../Abp/Cli/Commands/GenerateViewCommand.cs | 2 +- .../LINGYUN/Abp/Cli/Commands/HelpCommand.cs | 11 +- .../open-api/OpenApi.Sdk/FodyWeavers.xml | 3 + .../open-api/OpenApi.Sdk/FodyWeavers.xsd | 30 ++ ...rviceApplicationsSingleModule.Configure.cs | 26 +- .../micro/content/Directory.Packages.props | 330 +++++++++--------- .../DbMigratorHostedService.cs | 31 +- ....CompanyName.ProjectName.DbMigrator.csproj | 12 +- .../Program.cs | 41 ++- .../appsettings.json | 3 + ...ompanyName.ProjectName.HttpApi.Host.csproj | 84 +---- .../appsettings.Development.json | 9 +- ...e.ProjectName.Application.Contracts.csproj | 1 - .../ProjectNameApplicationContractsModule.cs | 2 - ...Name.CompanyName.ProjectName.Domain.csproj | 1 + .../ProjectNameFeatureDefinitionProvider.cs | 0 .../Features/ProjectNameFeatureNames.cs | 0 .../ProjectName/ProjectNameDomainModule.cs | 2 + .../ProjectNameDbContextFactory.cs | 2 +- .../ProjectNameEntityFrameworkCoreModule.cs | 21 ++ common.props | 4 +- 25 files changed, 319 insertions(+), 306 deletions(-) create mode 100644 aspnet-core/framework/open-api/OpenApi.Sdk/FodyWeavers.xml create mode 100644 aspnet-core/framework/open-api/OpenApi.Sdk/FodyWeavers.xsd rename aspnet-core/templates/micro/content/src/{PackageName.CompanyName.ProjectName.Application.Contracts => PackageName.CompanyName.ProjectName.Domain}/PackageName/CompanyName/ProjectName/Features/ProjectNameFeatureDefinitionProvider.cs (100%) rename aspnet-core/templates/micro/content/src/{PackageName.CompanyName.ProjectName.Application.Contracts => PackageName.CompanyName.ProjectName.Domain}/PackageName/CompanyName/ProjectName/Features/ProjectNameFeatureNames.cs (100%) diff --git a/Directory.Packages.props b/Directory.Packages.props index 4a5051a57..d0793379a 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -3,8 +3,8 @@ 8.2.0 2.14.1 3.2.3 - 8.3.0 - 8.3.0 + 8.3.4 + 8.3.4 8.0.0 8.0.0 8.0.0 diff --git a/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN.Abp.Cli.csproj b/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN.Abp.Cli.csproj index 4ca3e578f..d058740c3 100644 --- a/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN.Abp.Cli.csproj +++ b/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN.Abp.Cli.csproj @@ -5,7 +5,7 @@ Exe net8.0 - 8.3.0 + 8.3.4 colin Use LINGYUN.MicroService.Templates command line true diff --git a/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/CreateCommand.cs b/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/CreateCommand.cs index 506b462b8..6734417c9 100644 --- a/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/CreateCommand.cs +++ b/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/CreateCommand.cs @@ -179,7 +179,7 @@ namespace LINGYUN.Abp.Cli.Commands await CreateProjectService.CreateAsync(projectArgs); } - public string GetShortDescription() + public static string GetShortDescription() { return "Generate a new solution based on the customed ABP startup templates."; } diff --git a/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/GenerateProxyCommand.cs b/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/GenerateProxyCommand.cs index 2f39ce204..c168d493c 100644 --- a/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/GenerateProxyCommand.cs +++ b/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/GenerateProxyCommand.cs @@ -142,7 +142,7 @@ public class GenerateProxyCommand : IConsoleCommand, ITransientDependency return sb.ToString(); } - public string GetShortDescription() + public static string GetShortDescription() { return "Generates client service proxies and DTOs to consume HTTP APIs."; } diff --git a/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/GenerateViewCommand.cs b/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/GenerateViewCommand.cs index 446205306..812f17e37 100644 --- a/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/GenerateViewCommand.cs +++ b/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/GenerateViewCommand.cs @@ -71,7 +71,7 @@ public class GenerateViewCommand : IConsoleCommand, ITransientDependency serviceType); } - public string GetShortDescription() + public static string GetShortDescription() { return "Generate the view code from the http api proxy."; } diff --git a/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/HelpCommand.cs b/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/HelpCommand.cs index ea1416767..8d9906a3e 100644 --- a/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/HelpCommand.cs +++ b/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/HelpCommand.cs @@ -3,6 +3,7 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; using Volo.Abp.Cli; @@ -70,14 +71,14 @@ namespace LINGYUN.Abp.Cli.Commands foreach (var command in AbpCliOptions.Commands.ToArray()) { - string shortDescription; - - using (var scope = ServiceScopeFactory.CreateScope()) + var method = command.Value.GetMethod("GetShortDescription", BindingFlags.Static | BindingFlags.Public); + if (method == null) { - shortDescription = ((IConsoleCommand)scope.ServiceProvider - .GetRequiredService(command.Value)).GetShortDescription(); + continue; } + var shortDescription = (string)method.Invoke(null, null); + sb.Append(" > "); sb.Append(command.Key); sb.Append(string.IsNullOrWhiteSpace(shortDescription) ? "" : ":"); diff --git a/aspnet-core/framework/open-api/OpenApi.Sdk/FodyWeavers.xml b/aspnet-core/framework/open-api/OpenApi.Sdk/FodyWeavers.xml new file mode 100644 index 000000000..00e1d9a1c --- /dev/null +++ b/aspnet-core/framework/open-api/OpenApi.Sdk/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/framework/open-api/OpenApi.Sdk/FodyWeavers.xsd b/aspnet-core/framework/open-api/OpenApi.Sdk/FodyWeavers.xsd new file mode 100644 index 000000000..3f3946e28 --- /dev/null +++ b/aspnet-core/framework/open-api/OpenApi.Sdk/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/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs b/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs index 6b72a8062..57c7ef4d5 100644 --- a/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs +++ b/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs @@ -510,7 +510,31 @@ public partial class MicroServiceApplicationsSingleModule { Configure(options => { - configuration.GetSection("Databases").Bind(options.Databases); + options.Databases.Configure("Default", db => + { + db.MappedConnections.Add("AbpIdentity"); + db.MappedConnections.Add("AppPlatform"); + db.MappedConnections.Add("TaskManagement"); + db.MappedConnections.Add("Notifications"); + db.MappedConnections.Add("MessageService"); + db.MappedConnections.Add("AbpAuditLogging"); + db.MappedConnections.Add("AbpOpenIddict"); + db.MappedConnections.Add("AbpIdentityServer"); + db.MappedConnections.Add("AbpFeatureManagement"); + db.MappedConnections.Add("AbpSettingManagement"); + db.MappedConnections.Add("AbpPermissionManagement"); + }); + + options.Databases.Configure("HostOnly", db => + { + db.MappedConnections.Add("AbpSaas"); + db.MappedConnections.Add("AbpTextTemplating"); + db.MappedConnections.Add("AbpLocalizationManagement"); + db.MappedConnections.Add("Workflow"); + db.MappedConnections.Add("Demo"); + + db.IsUsedByTenants = false; + }); }); Configure(options => { diff --git a/aspnet-core/templates/micro/content/Directory.Packages.props b/aspnet-core/templates/micro/content/Directory.Packages.props index 90640add1..af9607d7a 100644 --- a/aspnet-core/templates/micro/content/Directory.Packages.props +++ b/aspnet-core/templates/micro/content/Directory.Packages.props @@ -66,6 +66,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -118,6 +281,7 @@ + @@ -170,6 +334,7 @@ + @@ -300,171 +465,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.DbMigrator/DbMigratorHostedService.cs b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.DbMigrator/DbMigratorHostedService.cs index d279fb30f..b27abc956 100644 --- a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.DbMigrator/DbMigratorHostedService.cs +++ b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.DbMigrator/DbMigratorHostedService.cs @@ -13,39 +13,38 @@ public class DbMigratorHostedService : IHostedService private readonly IHostApplicationLifetime _hostApplicationLifetime; private readonly IConfiguration _configuration; - public DbMigratorHostedService( - IHostApplicationLifetime hostApplicationLifetime, - IConfiguration configuration) + public DbMigratorHostedService(IHostApplicationLifetime hostApplicationLifetime, IConfiguration configuration) { _hostApplicationLifetime = hostApplicationLifetime; _configuration = configuration; } - public async Task StartAsync(CancellationToken cancellationToken) + public async virtual Task StartAsync(CancellationToken cancellationToken) { - using var application = await AbpApplicationFactory - .CreateAsync(options => + using (var application = await AbpApplicationFactory.CreateAsync(options => { options.Configuration.UserSecretsId = Environment.GetEnvironmentVariable("APPLICATION_USER_SECRETS_ID"); - options.Configuration.UserSecretsAssembly = typeof(DbMigratorHostedService).Assembly; + options.Configuration.UserSecretsAssembly = typeof(PackageNameCompanyNameProjectNameDbMigratorModule).Assembly; options.Services.ReplaceConfiguration(_configuration); options.UseAutofac(); options.Services.AddLogging(c => c.AddSerilog()); options.AddDataMigrationEnvironment(); - }); - await application.InitializeAsync(); + })) + { + await application.InitializeAsync(); - await application - .ServiceProvider - .GetRequiredService() - .CheckAndApplyDatabaseMigrationsAsync(); + await application + .ServiceProvider + .GetRequiredService() + .CheckAndApplyDatabaseMigrationsAsync(); - await application.ShutdownAsync(); + await application.ShutdownAsync(); - _hostApplicationLifetime.StopApplication(); + _hostApplicationLifetime.StopApplication(); + } } - public Task StopAsync(CancellationToken cancellationToken) + public virtual Task StopAsync(CancellationToken cancellationToken) { return Task.CompletedTask; } diff --git a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.DbMigrator/PackageName.CompanyName.ProjectName.DbMigrator.csproj b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.DbMigrator/PackageName.CompanyName.ProjectName.DbMigrator.csproj index 4d69cfc5b..5acdeee3b 100644 --- a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.DbMigrator/PackageName.CompanyName.ProjectName.DbMigrator.csproj +++ b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.DbMigrator/PackageName.CompanyName.ProjectName.DbMigrator.csproj @@ -1,6 +1,5 @@  - @@ -8,6 +7,8 @@ net8.0 enable enable + false + latest @@ -39,4 +40,13 @@ + + + PreserveNewest + + + PreserveNewest + + + diff --git a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.DbMigrator/Program.cs b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.DbMigrator/Program.cs index e4739face..41c337f4c 100644 --- a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.DbMigrator/Program.cs +++ b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.DbMigrator/Program.cs @@ -1,16 +1,14 @@ -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; +using PackageName.CompanyName.ProjectName.DbMigrator; using Serilog; using Serilog.Events; -namespace PackageName.CompanyName.ProjectName.DbMigrator; - -public class Program +try { - public async static Task Main(string[] args) - { - Log.Logger = new LoggerConfiguration() + Log.Logger = new LoggerConfiguration() .MinimumLevel.Information() .MinimumLevel.Override("Microsoft", LogEventLevel.Warning) .MinimumLevel.Override("Volo.Abp", LogEventLevel.Warning) @@ -24,17 +22,26 @@ public class Program .WriteTo.Console() .CreateLogger(); - await CreateHostBuilder(args).RunConsoleAsync(); - } + var builder = Host.CreateDefaultBuilder(args) + .AddAppSettingsSecretsJson() + .ConfigureLogging((context, logger) => logger.ClearProviders()) + .ConfigureServices((hostContext, services) => services.AddHostedService()); + + await builder.RunConsoleAsync(); - public static IHostBuilder CreateHostBuilder(string[] args) + return 0; +} +catch (Exception ex) +{ + if (ex is HostAbortedException) { - return Host.CreateDefaultBuilder(args) - .AddAppSettingsSecretsJson() - .ConfigureLogging((context, logging) => logging.ClearProviders()) - .ConfigureServices((hostContext, services) => - { - services.AddHostedService(); - }); + throw; } + + Log.Fatal(ex, "Host terminated unexpectedly!"); + return 1; } +finally +{ + Log.CloseAndFlush(); +} \ No newline at end of file diff --git a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.DbMigrator/appsettings.json b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.DbMigrator/appsettings.json index 2f919b2c2..4cc470a9f 100644 --- a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.DbMigrator/appsettings.json +++ b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.DbMigrator/appsettings.json @@ -1,4 +1,7 @@ { + "ConnectionStrings": { + "Default": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456" + }, "StringEncryption": { "DefaultPassPhrase": "s46c5q55nxpeS8Ra", "InitVectorBytes": "s83ng0abvd02js84", diff --git a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/PackageName.CompanyName.ProjectName.HttpApi.Host.csproj b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/PackageName.CompanyName.ProjectName.HttpApi.Host.csproj index 01dc53a9b..6ee2a7fc9 100644 --- a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/PackageName.CompanyName.ProjectName.HttpApi.Host.csproj +++ b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/PackageName.CompanyName.ProjectName.HttpApi.Host.csproj @@ -1,5 +1,4 @@ -<<<<<<< HEAD:aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/PackageName.CompanyName.ProjectName.HttpApi.Host.csproj - + net8.0 @@ -60,7 +59,7 @@ - + @@ -76,82 +75,3 @@ -======= - - - - net8.0 - PackageName.CompanyName.ProjectName - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ->>>>>>> aio/main:aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/PackageName.CompanyName.ProjectName.HttpApi.Host.csproj - diff --git a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/appsettings.Development.json b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/appsettings.Development.json index 9f72f9390..a28116f22 100644 --- a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/appsettings.Development.json +++ b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/appsettings.Development.json @@ -26,13 +26,8 @@ }, "ConnectionStrings": { "Default": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", - "ProjectName": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", - "AbpSaas": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", - "AbpFeatureManagement": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", - "AbpPermissionManagement": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", - "AbpSettingManagement": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", - "AbpLocalizationManagement": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", - "AbpTextTemplating": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456" + "Business": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", + "Framework": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456" }, "DistributedLock": { "IsEnabled": true, diff --git a/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName.CompanyName.ProjectName.Application.Contracts.csproj b/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName.CompanyName.ProjectName.Application.Contracts.csproj index 0eaa24015..e1f9883d3 100644 --- a/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName.CompanyName.ProjectName.Application.Contracts.csproj +++ b/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName.CompanyName.ProjectName.Application.Contracts.csproj @@ -16,7 +16,6 @@ - diff --git a/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/ProjectNameApplicationContractsModule.cs b/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/ProjectNameApplicationContractsModule.cs index eb0b2fb15..91867bd40 100644 --- a/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/ProjectNameApplicationContractsModule.cs +++ b/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/ProjectNameApplicationContractsModule.cs @@ -1,13 +1,11 @@ using LINGYUN.Abp.Dynamic.Queryable; using Volo.Abp.Application; using Volo.Abp.Authorization; -using Volo.Abp.Features; using Volo.Abp.Modularity; namespace PackageName.CompanyName.ProjectName; [DependsOn( - typeof(AbpFeaturesModule), typeof(AbpAuthorizationModule), typeof(AbpDddApplicationContractsModule), typeof(AbpDynamicQueryableApplicationContractsModule), diff --git a/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName.CompanyName.ProjectName.Domain.csproj b/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName.CompanyName.ProjectName.Domain.csproj index 2cccd0944..26f401f9e 100644 --- a/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName.CompanyName.ProjectName.Domain.csproj +++ b/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName.CompanyName.ProjectName.Domain.csproj @@ -17,6 +17,7 @@ + diff --git a/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/Features/ProjectNameFeatureDefinitionProvider.cs b/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/Features/ProjectNameFeatureDefinitionProvider.cs similarity index 100% rename from aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/Features/ProjectNameFeatureDefinitionProvider.cs rename to aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/Features/ProjectNameFeatureDefinitionProvider.cs diff --git a/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/Features/ProjectNameFeatureNames.cs b/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/Features/ProjectNameFeatureNames.cs similarity index 100% rename from aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/Features/ProjectNameFeatureNames.cs rename to aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/Features/ProjectNameFeatureNames.cs diff --git a/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/ProjectNameDomainModule.cs b/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/ProjectNameDomainModule.cs index 401aa849e..1a21ca913 100644 --- a/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/ProjectNameDomainModule.cs +++ b/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/ProjectNameDomainModule.cs @@ -3,6 +3,7 @@ using Microsoft.Extensions.DependencyInjection; using PackageName.CompanyName.ProjectName.ObjectExtending; using Volo.Abp.AutoMapper; using Volo.Abp.Domain.Entities.Events.Distributed; +using Volo.Abp.Features; using Volo.Abp.Modularity; using Volo.Abp.ObjectExtending.Modularity; using Volo.Abp.Threading; @@ -10,6 +11,7 @@ using Volo.Abp.Threading; namespace PackageName.CompanyName.ProjectName; [DependsOn( + typeof(AbpFeaturesModule), typeof(AbpAutoMapperModule), typeof(AbpDataProtectionModule), typeof(ProjectNameDomainSharedModule))] diff --git a/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameDbContextFactory.cs b/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameDbContextFactory.cs index d9ffcb9ca..c16735c99 100644 --- a/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameDbContextFactory.cs +++ b/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameDbContextFactory.cs @@ -39,7 +39,7 @@ public class ProjectNameDbContextFactory : IDesignTimeDbContextFactory(options => + { + options.Databases.Configure("Business", db => + { + db.MappedConnections.Add("ProjectName"); + }); + + options.Databases.Configure("Framework", db => + { + db.MappedConnections.Add("AbpSaas"); + db.MappedConnections.Add("AbpFeatureManagement"); + db.MappedConnections.Add("AbpPermissionManagement"); + db.MappedConnections.Add("AbpSettingManagement"); + db.MappedConnections.Add("AbpLocalizationManagement"); + db.MappedConnections.Add("AbpTextTemplating"); + + db.IsUsedByTenants = false; + }); + }); + // 配置Ef Configure(options => { diff --git a/common.props b/common.props index 119cc175a..c7ad4f6ed 100644 --- a/common.props +++ b/common.props @@ -1,12 +1,12 @@ latest - 8.3.0 + 8.3.4 colin $(NoWarn);CS1591;CS0436;CS8618;NU1803 https://github.com/colinin/abp-next-admin $(SolutionDir)LocalNuget - 8.3.0 + 8.3.4 MIT git https://github.com/colinin/abp-next-admin From a0d0959155b67df43db5db83bc186d640a5c13a9 Mon Sep 17 00:00:00 2001 From: colin Date: Mon, 13 Jan 2025 16:35:51 +0800 Subject: [PATCH 2/4] :arrow_up: feat: Update workflow --- .github/workflows/publish.yml | 2 +- .github/workflows/release.yml | 4 ++-- aspnet-core/services/Directory.Packages.props | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cb3855bc6..efd7a4322 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,7 +2,7 @@ name: "Publish" on: push: - branches: [ rel-8.3.0 ] + branches: [ rel-8.3.4 ] env: DOTNET_VERSION: "8.0.200" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a7794b528..697605b3b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,7 @@ name: "Tagged Release" on: push: - branches: [ rel-8.3.0 ] + branches: [ rel-8.3.4 ] jobs: tagged-release: @@ -14,4 +14,4 @@ jobs: with: repo_token: "${{ secrets.GITHUB_TOKEN }}" prerelease: false - automatic_release_tag: "8.3.0" + automatic_release_tag: "8.3.4" diff --git a/aspnet-core/services/Directory.Packages.props b/aspnet-core/services/Directory.Packages.props index 84f4c0737..9c3dce1ab 100644 --- a/aspnet-core/services/Directory.Packages.props +++ b/aspnet-core/services/Directory.Packages.props @@ -1,7 +1,7 @@ - 8.3.0 + 8.3.4 From c702f5d080ba5e8ad721f03a74bf6b2c96445a3c Mon Sep 17 00:00:00 2001 From: colin Date: Tue, 14 Jan 2025 08:12:17 +0800 Subject: [PATCH 3/4] =?UTF-8?q?:sparkles:=20feat:=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E6=A8=A1=E6=9D=BF=E8=A7=A3=E6=9E=90=E6=A8=A1?= =?UTF-8?q?=E5=9D=97.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/publish.yml | 2 +- .github/workflows/release.yml | 2 +- aspnet-core/LINGYUN.MicroService.All.sln | 14 ++++ .../LINGYUN.MicroService.SingleProject.sln | 7 ++ .../FodyWeavers.xml | 3 + .../FodyWeavers.xsd | 30 ++++++++ ...INGYUN.Abp.Notifications.Templating.csproj | 20 +++++ .../AbpNotificationsResolveOptions.cs | 17 +++++ .../AbpNotificationsTemplatingModule.cs | 9 +++ .../INotificationTemplateResolveContext.cs | 11 +++ ...INotificationTemplateResolveContributor.cs | 9 +++ .../INotificationTemplateResolver.cs | 17 +++++ .../NotificationTemplateResolveContext.cs | 26 +++++++ ...ificationTemplateResolveContributorBase.cs | 13 ++++ .../NotificationTemplateResolveResult.cs | 16 ++++ .../NotificationTemplateResolver.cs | 58 ++++++++++++++ aspnet-core/services/Directory.Packages.props | 47 ------------ .../LY.AIO.Applications.Single.csproj | 13 +--- .../Distributed/NotificationEventHandler.cs | 21 ++++-- ...LY.MicroService.Applications.Single.csproj | 1 + .../MicroServiceApplicationsSingleModule.cs | 3 + .../Distributed/NotificationEventHandler.cs | 21 ++++-- ...ervice.RealtimeMessage.HttpApi.Host.csproj | 1 + .../RealtimeMessageHttpApiHostModule.cs | 2 + ...PackageName.CompanyName.ProjectName.csproj | 4 +- .../micro/content/Directory.Packages.props | 4 +- .../templates/micro/content/common.props | 4 +- ...ompanyName.ProjectName.HttpApi.Host.csproj | 6 +- .../Program.cs | 23 +++--- .../ProjectNameHttpApiHostModule.cs | 8 +- .../appsettings.json | 20 +++++ ....Abp.Notifications.Templating.Tests.csproj | 26 +++++++ .../AbpNotificationsTemplatingTestBase.cs | 8 ++ .../AbpNotificationsTemplatingTestModule.cs | 14 ++++ ...wtownsoftJsonTemplateResolveContributor.cs | 20 +++++ .../Templating/NotificationModel.cs | 29 +++++++ .../NotificationTemplateResolverTests.cs | 75 +++++++++++++++++++ ...tNotificationTemplateResolveContributor.cs | 29 +++++++ 38 files changed, 538 insertions(+), 95 deletions(-) create mode 100644 aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/FodyWeavers.xml create mode 100644 aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/FodyWeavers.xsd create mode 100644 aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN.Abp.Notifications.Templating.csproj create mode 100644 aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/AbpNotificationsResolveOptions.cs create mode 100644 aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/AbpNotificationsTemplatingModule.cs create mode 100644 aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/INotificationTemplateResolveContext.cs create mode 100644 aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/INotificationTemplateResolveContributor.cs create mode 100644 aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/INotificationTemplateResolver.cs create mode 100644 aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/NotificationTemplateResolveContext.cs create mode 100644 aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/NotificationTemplateResolveContributorBase.cs create mode 100644 aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/NotificationTemplateResolveResult.cs create mode 100644 aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/NotificationTemplateResolver.cs create mode 100644 aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN.Abp.Notifications.Templating.Tests.csproj create mode 100644 aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN/Abp/Notifications/Templating/AbpNotificationsTemplatingTestBase.cs create mode 100644 aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN/Abp/Notifications/Templating/AbpNotificationsTemplatingTestModule.cs create mode 100644 aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN/Abp/Notifications/Templating/NewtownsoftJsonTemplateResolveContributor.cs create mode 100644 aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN/Abp/Notifications/Templating/NotificationModel.cs create mode 100644 aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN/Abp/Notifications/Templating/NotificationTemplateResolverTests.cs create mode 100644 aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN/Abp/Notifications/Templating/ToObjectNotificationTemplateResolveContributor.cs diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index efd7a4322..d69ed2ef4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,7 +2,7 @@ name: "Publish" on: push: - branches: [ rel-8.3.4 ] + branches: [ main ] env: DOTNET_VERSION: "8.0.200" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 697605b3b..c0e87a66a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,7 @@ name: "Tagged Release" on: push: - branches: [ rel-8.3.4 ] + branches: [ main ] jobs: tagged-release: diff --git a/aspnet-core/LINGYUN.MicroService.All.sln b/aspnet-core/LINGYUN.MicroService.All.sln index 1ed9cfe2b..5581b0989 100644 --- a/aspnet-core/LINGYUN.MicroService.All.sln +++ b/aspnet-core/LINGYUN.MicroService.All.sln @@ -767,6 +767,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.OssManagement.I EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Notifications.HttpApi.Client", "modules\realtime-notifications\LINGYUN.Abp.Notifications.HttpApi.Client\LINGYUN.Abp.Notifications.HttpApi.Client.csproj", "{3CBD1342-C021-49FB-933F-FAC1DAFC7B48}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Notifications.Templating", "modules\realtime-notifications\LINGYUN.Abp.Notifications.Templating\LINGYUN.Abp.Notifications.Templating.csproj", "{E2AC3DB8-D579-49A3-845B-528C77A1EC75}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Notifications.Templating.Tests", "tests\LINGYUN.Abp.Notifications.Templating.Tests\LINGYUN.Abp.Notifications.Templating.Tests.csproj", "{F47EDB4F-1F92-4887-8F33-BFCEB61BB51A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1969,6 +1973,14 @@ Global {3CBD1342-C021-49FB-933F-FAC1DAFC7B48}.Debug|Any CPU.Build.0 = Debug|Any CPU {3CBD1342-C021-49FB-933F-FAC1DAFC7B48}.Release|Any CPU.ActiveCfg = Release|Any CPU {3CBD1342-C021-49FB-933F-FAC1DAFC7B48}.Release|Any CPU.Build.0 = Release|Any CPU + {E2AC3DB8-D579-49A3-845B-528C77A1EC75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E2AC3DB8-D579-49A3-845B-528C77A1EC75}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E2AC3DB8-D579-49A3-845B-528C77A1EC75}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E2AC3DB8-D579-49A3-845B-528C77A1EC75}.Release|Any CPU.Build.0 = Release|Any CPU + {F47EDB4F-1F92-4887-8F33-BFCEB61BB51A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F47EDB4F-1F92-4887-8F33-BFCEB61BB51A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F47EDB4F-1F92-4887-8F33-BFCEB61BB51A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F47EDB4F-1F92-4887-8F33-BFCEB61BB51A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2340,6 +2352,8 @@ Global {76DDE71D-00BD-4BC8-AEA2-31209E2B7E05} = {B05CB08F-C088-4D6D-97EE-A94A5D1AE4A6} {267933BD-BFB8-4906-BA39-DF193B2FD558} = {B05CB08F-C088-4D6D-97EE-A94A5D1AE4A6} {3CBD1342-C021-49FB-933F-FAC1DAFC7B48} = {1A23BB7F-1839-4204-88C5-7E9A6C9FBF1E} + {E2AC3DB8-D579-49A3-845B-528C77A1EC75} = {1A23BB7F-1839-4204-88C5-7E9A6C9FBF1E} + {F47EDB4F-1F92-4887-8F33-BFCEB61BB51A} = {370D7CD5-1E17-4F3D-BBFA-03429F6D4F2F} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {C95FDF91-16F2-4A8B-A4BE-0E62D1B66718} diff --git a/aspnet-core/LINGYUN.MicroService.SingleProject.sln b/aspnet-core/LINGYUN.MicroService.SingleProject.sln index 7c62c9ff2..c0759b755 100644 --- a/aspnet-core/LINGYUN.MicroService.SingleProject.sln +++ b/aspnet-core/LINGYUN.MicroService.SingleProject.sln @@ -616,6 +616,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.AuditLogging.IP EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LY.MicroService.Applications.Single.EntityFrameworkCore.MySql", "migrations\LY.MicroService.Applications.Single.EntityFrameworkCore.MySql\LY.MicroService.Applications.Single.EntityFrameworkCore.MySql.csproj", "{746813A9-4221-42D8-AAB5-66CB69EC844F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Notifications.Templating", "modules\realtime-notifications\LINGYUN.Abp.Notifications.Templating\LINGYUN.Abp.Notifications.Templating.csproj", "{8CFA17AA-568C-4B40-A48E-1212123ABDD6}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1622,6 +1624,10 @@ Global {746813A9-4221-42D8-AAB5-66CB69EC844F}.Debug|Any CPU.Build.0 = Debug|Any CPU {746813A9-4221-42D8-AAB5-66CB69EC844F}.Release|Any CPU.ActiveCfg = Release|Any CPU {746813A9-4221-42D8-AAB5-66CB69EC844F}.Release|Any CPU.Build.0 = Release|Any CPU + {8CFA17AA-568C-4B40-A48E-1212123ABDD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8CFA17AA-568C-4B40-A48E-1212123ABDD6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8CFA17AA-568C-4B40-A48E-1212123ABDD6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8CFA17AA-568C-4B40-A48E-1212123ABDD6}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1921,6 +1927,7 @@ Global {5BE31786-EAAB-4C86-8FFF-C07F27FBFD1C} = {99B7CBDE-A251-4738-97F0-DB1DB484BEE1} {77B3C7A4-15C7-4EFF-8451-4F13B4CCA4AE} = {C22741F9-FC56-4AE3-B543-9F15C779D345} {746813A9-4221-42D8-AAB5-66CB69EC844F} = {0D69B63D-F082-4D57-9FF0-355642C56993} + {8CFA17AA-568C-4B40-A48E-1212123ABDD6} = {42F31C68-B8B2-4BE0-9AD0-A7DFA6092629} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {711A43C0-A2F8-4E5C-9B9F-F2551E4B3FF1} diff --git a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/FodyWeavers.xml b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/FodyWeavers.xml new file mode 100644 index 000000000..1715698cc --- /dev/null +++ b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/FodyWeavers.xsd b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/FodyWeavers.xsd new file mode 100644 index 000000000..3f3946e28 --- /dev/null +++ b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/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/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN.Abp.Notifications.Templating.csproj b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN.Abp.Notifications.Templating.csproj new file mode 100644 index 000000000..188573b06 --- /dev/null +++ b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN.Abp.Notifications.Templating.csproj @@ -0,0 +1,20 @@ + + + + + + + netstandard2.0;netstandard2.1;net8.0 + LINGYUN.Abp.Notifications.Templating + LINGYUN.Abp.Notifications.Templating + false + false + false + + + + + + + + diff --git a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/AbpNotificationsResolveOptions.cs b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/AbpNotificationsResolveOptions.cs new file mode 100644 index 000000000..8fde7a895 --- /dev/null +++ b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/AbpNotificationsResolveOptions.cs @@ -0,0 +1,17 @@ +using JetBrains.Annotations; +using System.Collections.Generic; + +namespace LINGYUN.Abp.Notifications.Templating; +public class AbpNotificationsResolveOptions +{ + /// + /// 模板解析提供者列表 + /// + [NotNull] + public List TemplateResolvers { get; } + + public AbpNotificationsResolveOptions() + { + TemplateResolvers = new List(); + } +} diff --git a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/AbpNotificationsTemplatingModule.cs b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/AbpNotificationsTemplatingModule.cs new file mode 100644 index 000000000..ddcabe3e9 --- /dev/null +++ b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/AbpNotificationsTemplatingModule.cs @@ -0,0 +1,9 @@ +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.Notifications.Templating; + +[DependsOn(typeof(AbpNotificationsCoreModule))] +public class AbpNotificationsTemplatingModule : AbpModule +{ + +} diff --git a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/INotificationTemplateResolveContext.cs b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/INotificationTemplateResolveContext.cs new file mode 100644 index 000000000..723f8a46c --- /dev/null +++ b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/INotificationTemplateResolveContext.cs @@ -0,0 +1,11 @@ +using Volo.Abp.DependencyInjection; + +namespace LINGYUN.Abp.Notifications.Templating; +public interface INotificationTemplateResolveContext : IServiceProviderAccessor +{ + NotificationTemplate Template { get; } + + object Model { get; set; } + + bool Handled { get; set; } +} diff --git a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/INotificationTemplateResolveContributor.cs b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/INotificationTemplateResolveContributor.cs new file mode 100644 index 000000000..9326eac5d --- /dev/null +++ b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/INotificationTemplateResolveContributor.cs @@ -0,0 +1,9 @@ +using System.Threading.Tasks; + +namespace LINGYUN.Abp.Notifications.Templating; +public interface INotificationTemplateResolveContributor +{ + string Name { get; } + + Task ResolveAsync(INotificationTemplateResolveContext context); +} diff --git a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/INotificationTemplateResolver.cs b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/INotificationTemplateResolver.cs new file mode 100644 index 000000000..a88345afd --- /dev/null +++ b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/INotificationTemplateResolver.cs @@ -0,0 +1,17 @@ +using JetBrains.Annotations; +using System.Threading.Tasks; + +namespace LINGYUN.Abp.Notifications.Templating; +/// +/// 通知模板模型解析接口 +/// +public interface INotificationTemplateResolver +{ + /// + /// 解析模板数据 + /// + /// + /// + [NotNull] + Task ResolveAsync(NotificationTemplate template); +} diff --git a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/NotificationTemplateResolveContext.cs b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/NotificationTemplateResolveContext.cs new file mode 100644 index 000000000..1de28038b --- /dev/null +++ b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/NotificationTemplateResolveContext.cs @@ -0,0 +1,26 @@ +using System; + +namespace LINGYUN.Abp.Notifications.Templating; +public class NotificationTemplateResolveContext : INotificationTemplateResolveContext +{ + public IServiceProvider ServiceProvider { get; } + + public NotificationTemplate Template { get; } + + public object Model { get; set; } + + public bool Handled { get; set; } + + public bool HasResolvedModel() + { + return Handled || Model != null; + } + + public NotificationTemplateResolveContext( + NotificationTemplate template, + IServiceProvider serviceProvider) + { + Template = template; + ServiceProvider = serviceProvider; + } +} diff --git a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/NotificationTemplateResolveContributorBase.cs b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/NotificationTemplateResolveContributorBase.cs new file mode 100644 index 000000000..6e1d55080 --- /dev/null +++ b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/NotificationTemplateResolveContributorBase.cs @@ -0,0 +1,13 @@ +using System.Threading.Tasks; + +namespace LINGYUN.Abp.Notifications.Templating; +public abstract class NotificationTemplateResolveContributorBase : INotificationTemplateResolveContributor +{ + public abstract string Name { get; } + /// + /// 实现此接口处理模板数据 + /// + /// + /// + public abstract Task ResolveAsync(INotificationTemplateResolveContext context); +} diff --git a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/NotificationTemplateResolveResult.cs b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/NotificationTemplateResolveResult.cs new file mode 100644 index 000000000..c1cd21968 --- /dev/null +++ b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/NotificationTemplateResolveResult.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace LINGYUN.Abp.Notifications.Templating; +public class NotificationTemplateResolveResult +{ + /// + /// 模板数据 + /// + public object Model { get; set; } + + public List AppliedResolvers { get; } + public NotificationTemplateResolveResult() + { + AppliedResolvers = new List(); + } +} diff --git a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/NotificationTemplateResolver.cs b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/NotificationTemplateResolver.cs new file mode 100644 index 000000000..b92d95044 --- /dev/null +++ b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Templating/LINGYUN/Abp/Notifications/Templating/NotificationTemplateResolver.cs @@ -0,0 +1,58 @@ +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; +using System; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; + +namespace LINGYUN.Abp.Notifications.Templating; +public class NotificationTemplateResolver : INotificationTemplateResolver, ITransientDependency +{ + private readonly IServiceProvider _serviceProvider; + private readonly AbpNotificationsResolveOptions _options; + + public NotificationTemplateResolver( + IOptions options, + IServiceProvider serviceProvider) + { + _serviceProvider = serviceProvider; + _options = options.Value; + } + public async virtual Task ResolveAsync(NotificationTemplate template) + { + var result = new NotificationTemplateResolveResult(); + + using (var serviceScope = _serviceProvider.CreateScope()) + { + var context = new NotificationTemplateResolveContext(template, serviceScope.ServiceProvider); + + foreach (var resolveContributor in _options.TemplateResolvers) + { + // TODO: 设定为每一个通知都配置自己的解析提供者? + /** + if (resolveContributor.Name.Equals(template.Name)) + { + await resolveContributor.ResolveAsync(context); + } + + if (context.HasResolvedModel()) + { + result.Model = context.Model; + break; + } + **/ + + await resolveContributor.ResolveAsync(context); + + result.AppliedResolvers.Add(resolveContributor.Name); + + if (context.HasResolvedModel()) + { + result.Model = context.Model; + break; + } + } + } + + return result; + } +} diff --git a/aspnet-core/services/Directory.Packages.props b/aspnet-core/services/Directory.Packages.props index 9c3dce1ab..cbce42789 100644 --- a/aspnet-core/services/Directory.Packages.props +++ b/aspnet-core/services/Directory.Packages.props @@ -3,53 +3,6 @@ 8.3.4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/aspnet-core/services/LY.AIO.Applications.Single/LY.AIO.Applications.Single.csproj b/aspnet-core/services/LY.AIO.Applications.Single/LY.AIO.Applications.Single.csproj index 0fbfdd223..61185e75c 100644 --- a/aspnet-core/services/LY.AIO.Applications.Single/LY.AIO.Applications.Single.csproj +++ b/aspnet-core/services/LY.AIO.Applications.Single/LY.AIO.Applications.Single.csproj @@ -1,4 +1,4 @@ - + @@ -54,6 +54,7 @@ + @@ -212,8 +213,6 @@ - - @@ -261,12 +260,4 @@ - - - - - - - - diff --git a/aspnet-core/services/LY.MicroService.Applications.Single/EventBus/Distributed/NotificationEventHandler.cs b/aspnet-core/services/LY.MicroService.Applications.Single/EventBus/Distributed/NotificationEventHandler.cs index 8f9ee9a3e..5cc4b0e37 100644 --- a/aspnet-core/services/LY.MicroService.Applications.Single/EventBus/Distributed/NotificationEventHandler.cs +++ b/aspnet-core/services/LY.MicroService.Applications.Single/EventBus/Distributed/NotificationEventHandler.cs @@ -1,4 +1,5 @@ using LINGYUN.Abp.Notifications; +using LINGYUN.Abp.Notifications.Templating; using LY.MicroService.Applications.Single.BackgroundJobs; using LY.MicroService.Applications.Single.MultiTenancy; using Microsoft.Extensions.Localization; @@ -65,6 +66,10 @@ namespace LY.MicroService.Applications.Single.EventBus.Distributed /// protected IStringLocalizerFactory StringLocalizerFactory { get; } /// + /// Reference to . + /// + protected INotificationTemplateResolver NotificationTemplateResolver { get; } + /// /// Reference to . /// protected INotificationDataSerializer NotificationDataSerializer { get; } @@ -94,6 +99,7 @@ namespace LY.MicroService.Applications.Single.EventBus.Distributed IOptions options, INotificationStore notificationStore, INotificationDataSerializer notificationDataSerializer, + INotificationTemplateResolver notificationTemplateResolver, INotificationDefinitionManager notificationDefinitionManager, INotificationSubscriptionManager notificationSubscriptionManager, INotificationPublishProviderManager notificationPublishProviderManager) @@ -107,6 +113,7 @@ namespace LY.MicroService.Applications.Single.EventBus.Distributed StringLocalizerFactory = stringLocalizerFactory; NotificationStore = notificationStore; NotificationDataSerializer = notificationDataSerializer; + NotificationTemplateResolver = notificationTemplateResolver; NotificationDefinitionManager = notificationDefinitionManager; NotificationSubscriptionManager = notificationSubscriptionManager; NotificationPublishProviderManager = notificationPublishProviderManager; @@ -130,23 +137,25 @@ namespace LY.MicroService.Applications.Single.EventBus.Distributed } using (CultureHelper.Use(culture, culture)) { + var result = await NotificationTemplateResolver.ResolveAsync(eventData.Data); + if (notification.NotificationType == NotificationType.System) { using (CurrentTenant.Change(null)) { - await SendToTenantAsync(null, notification, eventData); + await SendToTenantAsync(null, notification, eventData, result); var allActiveTenants = await TenantConfigurationCache.GetTenantsAsync(); foreach (var activeTenant in allActiveTenants) { - await SendToTenantAsync(activeTenant.Id, notification, eventData); + await SendToTenantAsync(activeTenant.Id, notification, eventData, result); } } } else { - await SendToTenantAsync(eventData.TenantId, notification, eventData); + await SendToTenantAsync(eventData.TenantId, notification, eventData, result); } } } @@ -183,7 +192,8 @@ namespace LY.MicroService.Applications.Single.EventBus.Distributed protected async virtual Task SendToTenantAsync( Guid? tenantId, NotificationDefinition notification, - NotificationEto eventData) + NotificationEto eventData, + NotificationTemplateResolveResult templateResolveResult) { using (CurrentTenant.Change(tenantId)) { @@ -219,7 +229,8 @@ namespace LY.MicroService.Applications.Single.EventBus.Distributed // 由于模板通知受租户影响, 格式化失败的消息将被丢弃. message = await TemplateRenderer.RenderAsync( templateName: eventData.Data.Name, - model: eventData.Data.ExtraProperties, + // 序列化之后数据可能需要自行处理, 如未处理数据, 将使用默认数据渲染模板 + model: templateResolveResult.Model ?? eventData.Data.ExtraProperties, cultureName: eventData.Data.Culture, globalContext: new Dictionary { diff --git a/aspnet-core/services/LY.MicroService.Applications.Single/LY.MicroService.Applications.Single.csproj b/aspnet-core/services/LY.MicroService.Applications.Single/LY.MicroService.Applications.Single.csproj index f19b3c14a..0581ca288 100644 --- a/aspnet-core/services/LY.MicroService.Applications.Single/LY.MicroService.Applications.Single.csproj +++ b/aspnet-core/services/LY.MicroService.Applications.Single/LY.MicroService.Applications.Single.csproj @@ -202,6 +202,7 @@ + diff --git a/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.cs b/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.cs index 4abe4ef46..4d38ff881 100644 --- a/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.cs +++ b/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.cs @@ -1,6 +1,7 @@ using LINGYUN.Abp.AuditLogging.IP.Location; using LINGYUN.Abp.EventBus.CAP; using LINGYUN.Abp.IP2Region; +using LINGYUN.Abp.Notifications.Templating; using LY.MicroService.Applications.Single.EntityFrameworkCore; using LY.MicroService.Applications.Single.EntityFrameworkCore.MySql; using Volo.Abp.MailKit; @@ -295,6 +296,8 @@ namespace LY.MicroService.Applications.Single; typeof(AbpNotificationsSignalRModule), // 通知模块 邮件通知 typeof(AbpNotificationsEmailingModule), + // 通知模块 模板解析 + typeof(AbpNotificationsTemplatingModule), // 通知模块 微信小程序 typeof(AbpNotificationsWeChatMiniProgramModule), // 多租户模块 版本 diff --git a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/EventBus/Distributed/NotificationEventHandler.cs b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/EventBus/Distributed/NotificationEventHandler.cs index 96c338307..d6c9002df 100644 --- a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/EventBus/Distributed/NotificationEventHandler.cs +++ b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/EventBus/Distributed/NotificationEventHandler.cs @@ -1,4 +1,5 @@ using LINGYUN.Abp.Notifications; +using LINGYUN.Abp.Notifications.Templating; using LY.MicroService.RealtimeMessage.BackgroundJobs; using LY.MicroService.RealtimeMessage.MultiTenancy; using Microsoft.Extensions.Localization; @@ -74,6 +75,10 @@ namespace LY.MicroService.RealtimeMessage.EventBus.Distributed /// protected INotificationDataSerializer NotificationDataSerializer { get; } /// + /// Reference to . + /// + protected INotificationTemplateResolver NotificationTemplateResolver { get; } + /// /// Reference to . /// protected INotificationDefinitionManager NotificationDefinitionManager { get; } @@ -99,6 +104,7 @@ namespace LY.MicroService.RealtimeMessage.EventBus.Distributed IOptions options, INotificationStore notificationStore, INotificationDataSerializer notificationDataSerializer, + INotificationTemplateResolver notificationTemplateResolver, INotificationDefinitionManager notificationDefinitionManager, INotificationSubscriptionManager notificationSubscriptionManager, INotificationPublishProviderManager notificationPublishProviderManager) @@ -112,6 +118,7 @@ namespace LY.MicroService.RealtimeMessage.EventBus.Distributed StringLocalizerFactory = stringLocalizerFactory; NotificationStore = notificationStore; NotificationDataSerializer = notificationDataSerializer; + NotificationTemplateResolver = notificationTemplateResolver; NotificationDefinitionManager = notificationDefinitionManager; NotificationSubscriptionManager = notificationSubscriptionManager; NotificationPublishProviderManager = notificationPublishProviderManager; @@ -135,23 +142,25 @@ namespace LY.MicroService.RealtimeMessage.EventBus.Distributed } using (CultureHelper.Use(culture, culture)) { + var result = await NotificationTemplateResolver.ResolveAsync(eventData.Data); + if (notification.NotificationType == NotificationType.System) { using (CurrentTenant.Change(null)) { - await SendToTenantAsync(null, notification, eventData); + await SendToTenantAsync(null, notification, eventData, result); var allActiveTenants = await TenantConfigurationCache.GetTenantsAsync(); foreach (var activeTenant in allActiveTenants) { - await SendToTenantAsync(activeTenant.Id, notification, eventData); + await SendToTenantAsync(activeTenant.Id, notification, eventData, result); } } } else { - await SendToTenantAsync(eventData.TenantId, notification, eventData); + await SendToTenantAsync(eventData.TenantId, notification, eventData, result); } } } @@ -188,7 +197,8 @@ namespace LY.MicroService.RealtimeMessage.EventBus.Distributed protected async virtual Task SendToTenantAsync( Guid? tenantId, NotificationDefinition notification, - NotificationEto eventData) + NotificationEto eventData, + NotificationTemplateResolveResult templateResolveResult) { using (CurrentTenant.Change(tenantId)) { @@ -224,7 +234,8 @@ namespace LY.MicroService.RealtimeMessage.EventBus.Distributed // 由于模板通知受租户影响, 格式化失败的消息将被丢弃. message = await TemplateRenderer.RenderAsync( templateName: eventData.Data.Name, - model: eventData.Data.ExtraProperties, + // 解决序列化后的数据无法渲染模板 + model: templateResolveResult.Model ?? eventData.Data.ExtraProperties, cultureName: eventData.Data.Culture, globalContext: new Dictionary { diff --git a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/LY.MicroService.RealtimeMessage.HttpApi.Host.csproj b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/LY.MicroService.RealtimeMessage.HttpApi.Host.csproj index b1adfb3ad..c8be1f727 100644 --- a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/LY.MicroService.RealtimeMessage.HttpApi.Host.csproj +++ b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/LY.MicroService.RealtimeMessage.HttpApi.Host.csproj @@ -89,6 +89,7 @@ + diff --git a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.cs b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.cs index 2f970c91e..2029bf94a 100644 --- a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.cs +++ b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.cs @@ -28,6 +28,7 @@ using LINGYUN.Abp.Notifications.EntityFrameworkCore; using LINGYUN.Abp.Notifications.Jobs; using LINGYUN.Abp.Notifications.SignalR; using LINGYUN.Abp.Notifications.Sms; +using LINGYUN.Abp.Notifications.Templating; using LINGYUN.Abp.Notifications.WeChat.MiniProgram; using LINGYUN.Abp.Notifications.WeChat.Work; using LINGYUN.Abp.Notifications.WxPusher; @@ -101,6 +102,7 @@ namespace LY.MicroService.RealtimeMessage; typeof(AbpNotificationsWeChatMiniProgramModule), typeof(AbpNotificationsWeChatWorkModule), typeof(AbpNotificationsExceptionHandlingModule), + typeof(AbpNotificationsTemplatingModule), typeof(AbpWeChatWorkHandlersModule), typeof(AbpWeChatOfficialHandlersModule), typeof(AbpIdentityNotificationsModule), diff --git a/aspnet-core/templates/micro/PackageName.CompanyName.ProjectName.csproj b/aspnet-core/templates/micro/PackageName.CompanyName.ProjectName.csproj index cceabf72e..17ebde66d 100644 --- a/aspnet-core/templates/micro/PackageName.CompanyName.ProjectName.csproj +++ b/aspnet-core/templates/micro/PackageName.CompanyName.ProjectName.csproj @@ -3,13 +3,13 @@ net8.0 true LINGYUN.Abp.MicroService.Templates - 8.3.0 + 8.3.4 colin.in@foxmail.com Abp framework micro-service template MIT false https://github.com/colinin/abp-next-admin - micro webapi cloud + abp micro webapi cloud Template git https://github.com/colinin/abp-next-admin diff --git a/aspnet-core/templates/micro/content/Directory.Packages.props b/aspnet-core/templates/micro/content/Directory.Packages.props index af9607d7a..18e6f3e9a 100644 --- a/aspnet-core/templates/micro/content/Directory.Packages.props +++ b/aspnet-core/templates/micro/content/Directory.Packages.props @@ -2,8 +2,8 @@ 8.2.0 2.14.1 - 8.3.0 - 8.3.0 + 8.3.4 + 8.3.4 8.0.0 8.0.0 8.0.0 diff --git a/aspnet-core/templates/micro/content/common.props b/aspnet-core/templates/micro/content/common.props index d7d7622cf..6052366a9 100644 --- a/aspnet-core/templates/micro/content/common.props +++ b/aspnet-core/templates/micro/content/common.props @@ -1,12 +1,12 @@ latest - 8.2.1 + 8.3.4 colin $(NoWarn);CS1591;CS0436;CS8618;NU1803 https://github.com/colinin/abp-next-admin $(SolutionDir)LocalNuget - 8.2.1 + 8.3.4 MIT git https://github.com/colinin/abp-next-admin diff --git a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/PackageName.CompanyName.ProjectName.HttpApi.Host.csproj b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/PackageName.CompanyName.ProjectName.HttpApi.Host.csproj index 6ee2a7fc9..32ccca462 100644 --- a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/PackageName.CompanyName.ProjectName.HttpApi.Host.csproj +++ b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/PackageName.CompanyName.ProjectName.HttpApi.Host.csproj @@ -31,10 +31,6 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - @@ -59,7 +55,7 @@ - + diff --git a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/Program.cs b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/Program.cs index 092cdeb82..ad8792c62 100644 --- a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/Program.cs +++ b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/Program.cs @@ -23,15 +23,19 @@ public class Program Log.Information("Starting web host."); var builder = WebApplication.CreateBuilder(args); - builder.Host.AddAppSettingsSecretsJson() + builder.Host + .AddAppSettingsSecretsJson() .UseAutofac() .ConfigureAppConfiguration((context, config) => { - var configuration = config.Build(); - var agileConfigEnabled = configuration["AgileConfig:IsEnabled"]; - if (agileConfigEnabled.IsNullOrEmpty() || bool.Parse(agileConfigEnabled)) + var agileConfig = context.Configuration.GetSection("AgileConfig");//IsEnabled + if (agileConfig.Exists()) { - config.AddAgileConfig(new AgileConfig.Client.ConfigClient(configuration)); + var isAgileConfigEnabled = agileConfig["IsEnabled"]; + if (isAgileConfigEnabled.IsNullOrWhiteSpace() || bool.Parse(isAgileConfigEnabled)) + { + config.AddAgileConfig(new AgileConfig.Client.ConfigClient(context.Configuration)); + } } }) .UseSerilog((context, provider, config) => @@ -45,12 +49,11 @@ public class Program options.ApplicationName = ProjectNameHttpApiHostModule.ApplicationName; // 搜索 Modules 目录下所有文件作为插件 // 取消显示引用所有其他项目的模块,改为通过插件的形式引用 - var pluginFolder = Path.Combine( - Directory.GetCurrentDirectory(), "Modules"); + var pluginFolder = Path.Combine(Directory.GetCurrentDirectory(), "Modules"); + DirectoryHelper.CreateIfNotExists(pluginFolder); - options.PlugInSources.AddFolder( - pluginFolder, - SearchOption.AllDirectories); + + options.PlugInSources.AddFolder(pluginFolder, SearchOption.AllDirectories); }); var app = builder.Build(); await app.InitializeApplicationAsync(); diff --git a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/ProjectNameHttpApiHostModule.cs b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/ProjectNameHttpApiHostModule.cs index ea6e034c3..b943b09a6 100644 --- a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/ProjectNameHttpApiHostModule.cs +++ b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/ProjectNameHttpApiHostModule.cs @@ -1,12 +1,14 @@ +using LINGYUN.Abp.AspNetCore.HttpOverrides; using LINGYUN.Abp.AspNetCore.Mvc.Wrapper; using LINGYUN.Abp.AuditLogging.Elasticsearch; using LINGYUN.Abp.EventBus.CAP; using LINGYUN.Abp.ExceptionHandling.Emailing; +using LINGYUN.Abp.Identity.Session.AspNetCore; using LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore; -using LINGYUN.Abp.TextTemplating.EntityFrameworkCore; using LINGYUN.Abp.Saas.EntityFrameworkCore; using LINGYUN.Abp.Serilog.Enrichers.Application; using LINGYUN.Abp.Serilog.Enrichers.UniqueId; +using LINGYUN.Abp.TextTemplating.EntityFrameworkCore; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; @@ -22,13 +24,11 @@ using Volo.Abp.Caching.StackExchangeRedis; using Volo.Abp.DistributedLocking; using Volo.Abp.FeatureManagement.EntityFrameworkCore; using Volo.Abp.Http.Client.IdentityModel.Web; +using Volo.Abp.MailKit; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement.EntityFrameworkCore; using Volo.Abp.SettingManagement.EntityFrameworkCore; using Volo.Abp.Swashbuckle; -using LINGYUN.Abp.AspNetCore.HttpOverrides; -using LINGYUN.Abp.Identity.Session.AspNetCore; -using Volo.Abp.MailKit; namespace PackageName.CompanyName.ProjectName; diff --git a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/appsettings.json b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/appsettings.json index b9c69ab64..4f3ee4d30 100644 --- a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/appsettings.json +++ b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/appsettings.json @@ -1,4 +1,9 @@ { + "App": { + "CorsOrigins": "http://127.0.0.1:30000", + "RefreshClaimsUrl": "http://127.0.0.1:30015/", + "HealthChecks": "/healthz" + }, "Clock": { "Kind": "Local" }, @@ -44,6 +49,9 @@ "path": "Logs/Debug-.log", "restrictedToMinimumLevel": "Debug", "rollingInterval": "Day", + "rollOnFileSizeLimit": true, + "retainedFileCountLimit": 50, + "fileSizeLimitBytes": 5242880, "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" } }, @@ -53,6 +61,9 @@ "path": "Logs/Info-.log", "restrictedToMinimumLevel": "Information", "rollingInterval": "Day", + "rollOnFileSizeLimit": true, + "retainedFileCountLimit": 50, + "fileSizeLimitBytes": 5242880, "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" } }, @@ -62,6 +73,9 @@ "path": "Logs/Warn-.log", "restrictedToMinimumLevel": "Warning", "rollingInterval": "Day", + "rollOnFileSizeLimit": true, + "retainedFileCountLimit": 50, + "fileSizeLimitBytes": 5242880, "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" } }, @@ -71,6 +85,9 @@ "path": "Logs/Error-.log", "restrictedToMinimumLevel": "Error", "rollingInterval": "Day", + "rollOnFileSizeLimit": true, + "retainedFileCountLimit": 50, + "fileSizeLimitBytes": 5242880, "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" } }, @@ -80,6 +97,9 @@ "path": "Logs/Fatal-.log", "restrictedToMinimumLevel": "Fatal", "rollingInterval": "Day", + "rollOnFileSizeLimit": true, + "retainedFileCountLimit": 50, + "fileSizeLimitBytes": 5242880, "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" } } diff --git a/aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN.Abp.Notifications.Templating.Tests.csproj b/aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN.Abp.Notifications.Templating.Tests.csproj new file mode 100644 index 000000000..e4783658c --- /dev/null +++ b/aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN.Abp.Notifications.Templating.Tests.csproj @@ -0,0 +1,26 @@ + + + + net8.0 + + false + Debug;Release; + AnyCPU + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + + + diff --git a/aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN/Abp/Notifications/Templating/AbpNotificationsTemplatingTestBase.cs b/aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN/Abp/Notifications/Templating/AbpNotificationsTemplatingTestBase.cs new file mode 100644 index 000000000..c9d76e56e --- /dev/null +++ b/aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN/Abp/Notifications/Templating/AbpNotificationsTemplatingTestBase.cs @@ -0,0 +1,8 @@ +using LINGYUN.Abp.Tests; + +namespace LINGYUN.Abp.Notifications.Templating; + +public class AbpNotificationsTemplatingTestBase : AbpTestsBase +{ + +} diff --git a/aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN/Abp/Notifications/Templating/AbpNotificationsTemplatingTestModule.cs b/aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN/Abp/Notifications/Templating/AbpNotificationsTemplatingTestModule.cs new file mode 100644 index 000000000..4fb515f7d --- /dev/null +++ b/aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN/Abp/Notifications/Templating/AbpNotificationsTemplatingTestModule.cs @@ -0,0 +1,14 @@ +using LINGYUN.Abp.Tests; +using Volo.Abp.Json; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.Notifications.Templating; + +[DependsOn( + typeof(AbpNotificationsTemplatingModule), + typeof(AbpJsonModule), + typeof(AbpTestsBaseModule))] +public class AbpNotificationsTemplatingTestModule : AbpModule +{ + +} diff --git a/aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN/Abp/Notifications/Templating/NewtownsoftJsonTemplateResolveContributor.cs b/aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN/Abp/Notifications/Templating/NewtownsoftJsonTemplateResolveContributor.cs new file mode 100644 index 000000000..6b93271c4 --- /dev/null +++ b/aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN/Abp/Notifications/Templating/NewtownsoftJsonTemplateResolveContributor.cs @@ -0,0 +1,20 @@ +using Newtonsoft.Json.Linq; +using System.Threading.Tasks; + +namespace LINGYUN.Abp.Notifications.Templating; +internal class NewtownsoftJsonTemplateResolveContributor : INotificationTemplateResolveContributor +{ + public string Name => "ToDynamic"; + + public Task ResolveAsync(INotificationTemplateResolveContext context) + { + var jsonObject = new JObject(); + foreach (var prop in context.Template.ExtraProperties) + { + jsonObject.Add(prop.Key, prop.Value.ToString()); + } + context.Model = jsonObject.ToObject(); + + return Task.CompletedTask; + } +} diff --git a/aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN/Abp/Notifications/Templating/NotificationModel.cs b/aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN/Abp/Notifications/Templating/NotificationModel.cs new file mode 100644 index 000000000..4122ff61b --- /dev/null +++ b/aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN/Abp/Notifications/Templating/NotificationModel.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; + +namespace LINGYUN.Abp.Notifications.Templating; + +public class NotificationSimpleModel +{ + public string Name { get; set; } + public string Firend { get; set; } +} + +public class NotificationModel +{ + public string Name { get; set; } + public List Jobs { get; set; } +} + +public class NotificationJob +{ + public string Name { get; set; } + public NotificationJob() + { + + } + + public NotificationJob(string name) + { + Name = name; + } +} diff --git a/aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN/Abp/Notifications/Templating/NotificationTemplateResolverTests.cs b/aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN/Abp/Notifications/Templating/NotificationTemplateResolverTests.cs new file mode 100644 index 000000000..70b14f5ea --- /dev/null +++ b/aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN/Abp/Notifications/Templating/NotificationTemplateResolverTests.cs @@ -0,0 +1,75 @@ +using LINGYUN.Abp.RealTime; +using Newtonsoft.Json; +using Shouldly; +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.Json; +using Xunit; + +namespace LINGYUN.Abp.Notifications.Templating; +public class NotificationTemplateResolverTests : AbpNotificationsTemplatingTestBase +{ + private IJsonSerializer _jsonSerializer; + public NotificationTemplateResolverTests() + { + _jsonSerializer = GetRequiredService(); + } + + [Fact] + public async Task Resolve_Deserialize_To_Object() + { + var notificationTemplate = new NotificationTemplate( + "Test", + data: new Dictionary + { + { "Name", "Tom" }, + { "Jobs", new List + { + new NotificationJob("Catch Jerry"), + new NotificationJob("Hit Pike") + } + } + }); + + var receivedEto = _jsonSerializer.Deserialize>( + _jsonSerializer.Serialize( + new RealTimeEto(notificationTemplate))); + + var contributor = new ToObjectNotificationTemplateResolveContributor(); + var context = new NotificationTemplateResolveContext(receivedEto.Data, ServiceProvider); + + await contributor.ResolveAsync(context); + + var model = context.Model.ShouldBeOfType(); + model.Name.ShouldBe("Tom"); + model.Jobs.Count.ShouldBe(2); + model.Jobs[0].Name.ShouldBe("Catch Jerry"); + model.Jobs[1].Name.ShouldBe("Hit Pike"); + } + + [Fact] + public async Task Resolve_Deserialize_To_Dynamic() + { + var notificationTemplate = new NotificationTemplate( + "Test", + data: new Dictionary + { + { "Name", "Tom" }, + { "Firend", "Jerry" } + }); + + var receivedEto = _jsonSerializer.Deserialize>( + _jsonSerializer.Serialize( + new RealTimeEto(notificationTemplate))); + + var contributor = new NewtownsoftJsonTemplateResolveContributor(); + var context = new NotificationTemplateResolveContext(receivedEto.Data, ServiceProvider); + + await contributor.ResolveAsync(context); + + dynamic model = context.Model; + + Assert.Equal(model.Name, "Tom"); + Assert.Equal(model.Firend, "Jerry"); + } +} diff --git a/aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN/Abp/Notifications/Templating/ToObjectNotificationTemplateResolveContributor.cs b/aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN/Abp/Notifications/Templating/ToObjectNotificationTemplateResolveContributor.cs new file mode 100644 index 000000000..b3a410f84 --- /dev/null +++ b/aspnet-core/tests/LINGYUN.Abp.Notifications.Templating.Tests/LINGYUN/Abp/Notifications/Templating/ToObjectNotificationTemplateResolveContributor.cs @@ -0,0 +1,29 @@ +using Microsoft.Extensions.DependencyInjection; +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.Data; +using Volo.Abp.Json; + +namespace LINGYUN.Abp.Notifications.Templating; +internal class ToObjectNotificationTemplateResolveContributor : INotificationTemplateResolveContributor +{ + public string Name => "ToObject"; + + public Task ResolveAsync(INotificationTemplateResolveContext context) + { + var model = new NotificationModel(); + + var nameObj = context.Template.GetProperty(nameof(NotificationModel.Name)); + model.Name = nameObj.ToString(); + + var jobsObj = context.Template.GetProperty(nameof(NotificationModel.Jobs)); + + var jsonSerializer = context.ServiceProvider.GetRequiredService(); + + model.Jobs = jsonSerializer.Deserialize>(jobsObj.ToString()); + + context.Model = model; + + return Task.CompletedTask; + } +} From c4a587fcda184d4d01ef3428a108830c70e249c7 Mon Sep 17 00:00:00 2001 From: colin Date: Fri, 7 Feb 2025 09:46:12 +0800 Subject: [PATCH 4/4] :arrow_up: chore: update vben --- apps/vben5/.lintstagedrc.mjs | 14 +- apps/vben5/apps/app-antd/.env.development | 4 +- apps/vben5/apps/app-antd/package.json | 16 +- apps/vben5/apps/app-antd/src/bootstrap.ts | 4 + apps/vben5/apps/app-antd/src/locales/index.ts | 9 +- .../apps/app-antd/src/router/routes/core.ts | 10 +- .../app-antd/src/router/routes/modules/abp.ts | 2 - .../src/router/routes/modules/dashboard.ts | 4 +- .../src/router/routes/modules/demos.ts | 2 - .../src/router/routes/modules/vben.ts | 24 +- .../dashboard/analytics/analytics-trends.vue | 8 +- .../analytics/analytics-visits-data.vue | 8 +- .../analytics/analytics-visits-sales.vue | 8 +- .../analytics/analytics-visits-source.vue | 8 +- .../dashboard/analytics/analytics-visits.vue | 8 +- .../src/views/dashboard/analytics/index.vue | 2 +- .../apps/backend-mock/utils/mock-data.ts | 4 +- apps/vben5/apps/web-antd/package.json | 2 +- .../web-antd/src/adapter/component/index.ts | 3 +- apps/vben5/apps/web-antd/src/api/request.ts | 31 +- apps/vben5/apps/web-antd/src/bootstrap.ts | 13 + apps/vben5/apps/web-antd/src/locales/index.ts | 4 +- .../apps/web-antd/src/router/routes/core.ts | 10 +- .../src/router/routes/modules/dashboard.ts | 4 +- .../src/router/routes/modules/demos.ts | 2 - .../src/router/routes/modules/vben.ts | 24 +- .../dashboard/analytics/analytics-trends.vue | 8 +- .../analytics/analytics-visits-data.vue | 8 +- .../analytics/analytics-visits-sales.vue | 8 +- .../analytics/analytics-visits-source.vue | 8 +- .../dashboard/analytics/analytics-visits.vue | 8 +- .../src/views/dashboard/analytics/index.vue | 2 +- apps/vben5/apps/web-ele/package.json | 2 +- .../web-ele/src/adapter/component/index.ts | 3 +- apps/vben5/apps/web-ele/src/api/request.ts | 30 +- apps/vben5/apps/web-ele/src/bootstrap.ts | 12 + apps/vben5/apps/web-ele/src/locales/index.ts | 4 +- .../apps/web-ele/src/router/routes/core.ts | 10 +- .../src/router/routes/modules/dashboard.ts | 4 +- .../src/router/routes/modules/demos.ts | 2 - .../web-ele/src/router/routes/modules/vben.ts | 24 +- .../dashboard/analytics/analytics-trends.vue | 8 +- .../analytics/analytics-visits-data.vue | 8 +- .../analytics/analytics-visits-sales.vue | 8 +- .../analytics/analytics-visits-source.vue | 8 +- .../dashboard/analytics/analytics-visits.vue | 8 +- .../src/views/dashboard/analytics/index.vue | 2 +- apps/vben5/apps/web-naive/package.json | 2 +- .../web-naive/src/adapter/component/index.ts | 3 +- apps/vben5/apps/web-naive/src/api/request.ts | 30 +- apps/vben5/apps/web-naive/src/bootstrap.ts | 15 + .../vben5/apps/web-naive/src/locales/index.ts | 4 +- .../apps/web-naive/src/router/routes/core.ts | 10 +- .../src/router/routes/modules/dashboard.ts | 4 +- .../src/router/routes/modules/demos.ts | 2 - .../src/router/routes/modules/vben.ts | 24 +- .../dashboard/analytics/analytics-trends.vue | 8 +- .../analytics/analytics-visits-data.vue | 8 +- .../analytics/analytics-visits-sales.vue | 8 +- .../analytics/analytics-visits-source.vue | 8 +- .../dashboard/analytics/analytics-visits.vue | 8 +- .../src/views/dashboard/analytics/index.vue | 2 +- .../web-naive/src/views/demos/form/basic.vue | 18 +- .../web-naive/src/views/demos/naive/index.vue | 3 +- .../.vitepress/components/preview-group.vue | 4 +- apps/vben5/docs/.vitepress/config/en.mts | 4 +- apps/vben5/docs/.vitepress/config/zh.mts | 4 +- .../theme/components/site-layout.vue | 1 - apps/vben5/docs/package.json | 2 +- apps/vben5/docs/src/_env/adapter/component.ts | 3 +- .../common-ui/vben-api-component.md | 13 +- .../src/components/common-ui/vben-drawer.md | 30 +- .../src/components/common-ui/vben-form.md | 15 +- .../src/components/common-ui/vben-modal.md | 31 +- .../src/demos/vben-drawer/dynamic/index.vue | 3 +- .../demos/vben-drawer/shared-data/index.vue | 11 +- .../src/demos/vben-modal/dynamic/index.vue | 3 +- .../demos/vben-modal/shared-data/index.vue | 11 +- .../docs/src/en/guide/essentials/route.md | 3 - apps/vben5/docs/src/guide/essentials/route.md | 18 +- .../vben5/docs/src/guide/essentials/server.md | 24 +- apps/vben5/docs/src/guide/in-depth/access.md | 2 +- .../src/guide/introduction/quick-start.md | 2 +- .../commitlint-config/package.json | 2 +- .../eslint-config/src/configs/import.ts | 1 + .../eslint-config/src/configs/javascript.ts | 1 - .../src/configs/perfectionist.ts | 61 ++-- .../stylelint-config/package.json | 2 +- apps/vben5/internal/node-utils/package.json | 2 +- apps/vben5/internal/node-utils/src/index.ts | 2 +- apps/vben5/internal/node-utils/src/spinner.ts | 4 +- .../internal/tailwind-config/package.json | 2 +- .../internal/tailwind-config/src/index.ts | 2 +- apps/vben5/internal/tsconfig/package.json | 2 +- apps/vben5/internal/vite-config/package.json | 2 +- .../vite-config/src/plugins/importmap.ts | 4 +- .../src/plugins/inject-app-loading/index.ts | 4 +- .../internal/vite-config/src/utils/env.ts | 4 +- apps/vben5/package.json | 8 +- apps/vben5/packages/@abp/account/package.json | 2 +- .../vben5/packages/@abp/auditing/package.json | 2 +- apps/vben5/packages/@abp/core/package.json | 2 +- .../vben5/packages/@abp/identity/package.json | 2 +- .../packages/@abp/notifications/package.json | 2 +- .../packages/@abp/openiddict/package.json | 2 +- apps/vben5/packages/@abp/request/package.json | 2 +- .../@abp/request/src/hooks/useRequest.ts | 2 +- apps/vben5/packages/@abp/request/src/index.ts | 8 +- .../vben5/packages/@abp/settings/package.json | 2 +- apps/vben5/packages/@abp/signalr/package.json | 2 +- apps/vben5/packages/@abp/ui/package.json | 2 +- .../@abp/ui/src/adapter/component/index.ts | 3 +- .../@abp/ui/src/components/vxe-table/api.ts | 11 +- .../ui/src/components/vxe-table/extends.ts | 3 +- .../@abp/ui/src/components/vxe-table/init.ts | 2 +- .../@abp/ui/src/components/vxe-table/types.ts | 14 +- .../src/components/vxe-table/use-vxe-grid.vue | 19 +- .../packages/@core/base/design/package.json | 2 +- .../packages/@core/base/design/src/css/ui.css | 4 + .../base/design/src/design-tokens/dark.css | 6 +- .../base/design/src/design-tokens/default.css | 2 + .../packages/@core/base/icons/package.json | 2 +- .../packages/@core/base/icons/src/lucide.ts | 6 +- .../packages/@core/base/shared/package.json | 4 +- .../base/shared/src/cache/storage-manager.ts | 18 +- .../shared/src/utils/__tests__/util.test.ts | 12 +- .../@core/base/shared/src/utils/cn.ts | 4 +- .../@core/base/shared/src/utils/download.ts | 1 + .../base/shared/src/utils/state-handler.ts | 12 +- .../packages/@core/base/typings/package.json | 2 +- .../packages/@core/base/typings/src/app.d.ts | 4 + .../@core/base/typings/src/helper.d.ts | 5 +- .../@core/base/typings/src/menu-record.ts | 7 +- .../@core/base/typings/src/vue-router.d.ts | 14 +- .../packages/@core/composables/package.json | 2 +- .../@core/composables/src/use-layout-style.ts | 8 +- .../composables/src/use-priority-value.ts | 1 + .../src/use-simple-locale/index.ts | 4 +- .../__snapshots__/config.test.ts.snap | 5 +- .../packages/@core/preferences/package.json | 2 +- .../packages/@core/preferences/src/config.ts | 5 +- .../@core/preferences/src/preferences.ts | 168 +++++----- .../packages/@core/preferences/src/types.ts | 7 + .../@core/preferences/src/use-preferences.ts | 24 +- .../@core/ui-kit/form-ui/package.json | 2 +- .../form-ui/src/components/form-actions.vue | 55 +--- .../@core/ui-kit/form-ui/src/config.ts | 3 +- .../@core/ui-kit/form-ui/src/form-api.ts | 136 +++++--- .../form-ui/src/form-render/form-field.vue | 19 +- .../ui-kit/form-ui/src/form-render/form.vue | 11 +- .../ui-kit/form-ui/src/form-render/index.ts | 2 +- .../@core/ui-kit/form-ui/src/index.ts | 2 +- .../@core/ui-kit/form-ui/src/types.ts | 35 +- .../ui-kit/form-ui/src/use-form-context.ts | 14 +- .../ui-kit/form-ui/src/vben-use-form.vue | 12 +- .../@core/ui-kit/layout-ui/package.json | 2 +- .../src/components/layout-content.vue | 3 +- .../src/components/layout-footer.vue | 1 + .../src/components/layout-header.vue | 1 + .../src/components/layout-sidebar.vue | 1 + .../src/components/layout-tabbar.vue | 1 + .../ui-kit/layout-ui/src/hooks/use-layout.ts | 14 +- .../ui-kit/layout-ui/src/vben-layout.vue | 26 +- .../@core/ui-kit/menu-ui/package.json | 2 +- .../ui-kit/menu-ui/src/components/index.ts | 2 +- .../ui-kit/menu-ui/src/components/menu.vue | 10 +- .../@core/ui-kit/menu-ui/src/types.ts | 4 +- .../@core/ui-kit/menu-ui/src/utils/index.ts | 1 + .../src/drawer/__tests__/drawer-api.test.ts | 30 +- .../ui-kit/popup-ui/src/drawer/drawer-api.ts | 50 ++- .../ui-kit/popup-ui/src/drawer/drawer.ts | 38 ++- .../ui-kit/popup-ui/src/drawer/drawer.vue | 36 ++- .../@core/ui-kit/popup-ui/src/drawer/index.ts | 2 +- .../ui-kit/popup-ui/src/drawer/use-drawer.ts | 40 ++- .../src/modal/__tests__/modal-api.test.ts | 19 +- .../@core/ui-kit/popup-ui/src/modal/index.ts | 2 +- .../ui-kit/popup-ui/src/modal/modal-api.ts | 41 ++- .../@core/ui-kit/popup-ui/src/modal/modal.ts | 24 +- .../@core/ui-kit/popup-ui/src/modal/modal.vue | 30 +- .../popup-ui/src/modal/use-modal-draggable.ts | 3 +- .../ui-kit/popup-ui/src/modal/use-modal.ts | 36 ++- .../@core/ui-kit/shadcn-ui/package.json | 2 +- .../src/components/avatar/avatar.vue | 5 +- .../src/components/back-top/back-top.vue | 2 +- .../components/breadcrumb/breadcrumb-view.vue | 2 +- .../src/components/breadcrumb/types.ts | 4 +- .../shadcn-ui/src/components/button/button.ts | 4 +- .../components/context-menu/context-menu.vue | 9 +- .../src/components/hover-card/hover-card.vue | 5 +- .../shadcn-ui/src/components/icon/icon.vue | 4 +- .../src/components/popover/popover.vue | 5 +- .../render-content/render-content.vue | 1 + .../components/segmented/tabs-indicator.vue | 2 +- .../src/components/select/select.vue | 6 + .../src/components/spinner/spinner.vue | 11 + .../src/components/tooltip/tooltip.vue | 3 +- .../shadcn-ui/src/ui/accordion/Accordion.vue | 9 +- .../src/ui/accordion/AccordionContent.vue | 6 +- .../src/ui/accordion/AccordionItem.vue | 10 +- .../src/ui/accordion/AccordionTrigger.vue | 10 +- .../ui-kit/shadcn-ui/src/ui/avatar/Avatar.vue | 4 +- .../src/ui/avatar/AvatarFallback.vue | 4 +- .../shadcn-ui/src/ui/avatar/AvatarImage.vue | 4 +- .../ui-kit/shadcn-ui/src/ui/avatar/avatar.ts | 4 +- .../ui-kit/shadcn-ui/src/ui/badge/Badge.vue | 4 +- .../ui-kit/shadcn-ui/src/ui/badge/badge.ts | 4 +- .../src/ui/breadcrumb/BreadcrumbLink.vue | 6 +- .../ui-kit/shadcn-ui/src/ui/button/Button.vue | 4 +- .../shadcn-ui/src/ui/checkbox/Checkbox.vue | 2 +- .../context-menu/ContextMenuCheckboxItem.vue | 9 +- .../ui/context-menu/ContextMenuContent.vue | 11 +- .../src/ui/context-menu/ContextMenuGroup.vue | 4 +- .../src/ui/context-menu/ContextMenuItem.vue | 11 +- .../src/ui/context-menu/ContextMenuLabel.vue | 6 +- .../src/ui/context-menu/ContextMenuPortal.vue | 4 +- .../ui/context-menu/ContextMenuRadioGroup.vue | 10 +- .../ui/context-menu/ContextMenuRadioItem.vue | 9 +- .../ui/context-menu/ContextMenuSeparator.vue | 9 +- .../src/ui/context-menu/ContextMenuSub.vue | 9 +- .../ui/context-menu/ContextMenuSubContent.vue | 14 +- .../ui/context-menu/ContextMenuSubTrigger.vue | 12 +- .../ui/context-menu/ContextMenuTrigger.vue | 8 +- .../ui-kit/shadcn-ui/src/ui/dialog/Dialog.vue | 9 +- .../shadcn-ui/src/ui/dialog/DialogClose.vue | 4 +- .../shadcn-ui/src/ui/dialog/DialogContent.vue | 24 +- .../src/ui/dialog/DialogDescription.vue | 10 +- .../shadcn-ui/src/ui/dialog/DialogOverlay.vue | 2 +- .../src/ui/dialog/DialogScrollContent.vue | 6 +- .../shadcn-ui/src/ui/dialog/DialogTitle.vue | 6 +- .../shadcn-ui/src/ui/dialog/DialogTrigger.vue | 4 +- .../src/ui/dropdown-menu/DropdownMenu.vue | 9 +- .../DropdownMenuCheckboxItem.vue | 9 +- .../ui/dropdown-menu/DropdownMenuContent.vue | 11 +- .../ui/dropdown-menu/DropdownMenuGroup.vue | 4 +- .../src/ui/dropdown-menu/DropdownMenuItem.vue | 10 +- .../ui/dropdown-menu/DropdownMenuLabel.vue | 10 +- .../dropdown-menu/DropdownMenuRadioGroup.vue | 10 +- .../dropdown-menu/DropdownMenuRadioItem.vue | 9 +- .../dropdown-menu/DropdownMenuSeparator.vue | 11 +- .../src/ui/dropdown-menu/DropdownMenuSub.vue | 9 +- .../dropdown-menu/DropdownMenuSubContent.vue | 14 +- .../dropdown-menu/DropdownMenuSubTrigger.vue | 10 +- .../ui/dropdown-menu/DropdownMenuTrigger.vue | 8 +- .../shadcn-ui/src/ui/form/FormLabel.vue | 2 +- .../ui-kit/shadcn-ui/src/ui/form/index.ts | 2 +- .../shadcn-ui/src/ui/hover-card/HoverCard.vue | 9 +- .../src/ui/hover-card/HoverCardContent.vue | 13 +- .../src/ui/hover-card/HoverCardTrigger.vue | 4 +- .../ui-kit/shadcn-ui/src/ui/label/Label.vue | 6 +- .../src/ui/number-field/NumberField.vue | 2 +- .../ui/number-field/NumberFieldDecrement.vue | 2 +- .../ui/number-field/NumberFieldIncrement.vue | 2 +- .../src/ui/pagination/PaginationEllipsis.vue | 6 +- .../src/ui/pagination/PaginationFirst.vue | 6 +- .../src/ui/pagination/PaginationLast.vue | 6 +- .../src/ui/pagination/PaginationNext.vue | 6 +- .../src/ui/pagination/PaginationPrev.vue | 6 +- .../shadcn-ui/src/ui/pagination/index.ts | 2 +- .../shadcn-ui/src/ui/pin-input/PinInput.vue | 11 +- .../src/ui/pin-input/PinInputGroup.vue | 6 +- .../src/ui/pin-input/PinInputInput.vue | 10 +- .../src/ui/pin-input/PinInputSeparator.vue | 4 +- .../src/ui/popover/PopoverContent.vue | 12 +- .../src/ui/popover/PopoverTrigger.vue | 4 +- .../src/ui/radio-group/RadioGroup.vue | 11 +- .../src/ui/radio-group/RadioGroupItem.vue | 5 +- .../src/ui/resizable/ResizableHandle.vue | 20 +- .../src/ui/resizable/ResizablePanelGroup.vue | 15 +- .../src/ui/scroll-area/ScrollArea.vue | 7 +- .../src/ui/scroll-area/ScrollBar.vue | 10 +- .../shadcn-ui/src/ui/select/SelectContent.vue | 8 +- .../shadcn-ui/src/ui/select/SelectGroup.vue | 6 +- .../shadcn-ui/src/ui/select/SelectItem.vue | 5 +- .../src/ui/select/SelectItemText.vue | 4 +- .../shadcn-ui/src/ui/select/SelectLabel.vue | 6 +- .../src/ui/select/SelectScrollDownButton.vue | 10 +- .../src/ui/select/SelectScrollUpButton.vue | 10 +- .../src/ui/select/SelectSeparator.vue | 6 +- .../shadcn-ui/src/ui/select/SelectTrigger.vue | 13 +- .../shadcn-ui/src/ui/select/SelectValue.vue | 4 +- .../shadcn-ui/src/ui/separator/Separator.vue | 6 +- .../ui-kit/shadcn-ui/src/ui/sheet/Sheet.vue | 9 +- .../shadcn-ui/src/ui/sheet/SheetClose.vue | 4 +- .../shadcn-ui/src/ui/sheet/SheetContent.vue | 52 ++- .../src/ui/sheet/SheetDescription.vue | 6 +- .../shadcn-ui/src/ui/sheet/SheetOverlay.vue | 2 +- .../shadcn-ui/src/ui/sheet/SheetTitle.vue | 6 +- .../shadcn-ui/src/ui/sheet/SheetTrigger.vue | 4 +- .../ui-kit/shadcn-ui/src/ui/sheet/sheet.ts | 4 +- .../ui-kit/shadcn-ui/src/ui/switch/Switch.vue | 12 +- .../shadcn-ui/src/ui/tabs/TabsContent.vue | 6 +- .../ui-kit/shadcn-ui/src/ui/tabs/TabsList.vue | 6 +- .../shadcn-ui/src/ui/tabs/TabsTrigger.vue | 6 +- .../src/ui/toggle-group/ToggleGroup.vue | 12 +- .../src/ui/toggle-group/ToggleGroupItem.vue | 11 +- .../ui-kit/shadcn-ui/src/ui/toggle/Toggle.vue | 17 +- .../ui-kit/shadcn-ui/src/ui/toggle/toggle.ts | 4 +- .../shadcn-ui/src/ui/tooltip/Tooltip.vue | 9 +- .../src/ui/tooltip/TooltipContent.vue | 14 +- .../src/ui/tooltip/TooltipProvider.vue | 4 +- .../src/ui/tooltip/TooltipTrigger.vue | 4 +- .../@core/ui-kit/tabs-ui/package.json | 2 +- .../ui-kit/tabs-ui/src/components/index.ts | 2 +- .../src/components/tabs-chrome/tabs.vue | 15 + .../tabs-ui/src/components/tabs/tabs.vue | 15 + .../@core/ui-kit/tabs-ui/src/types.ts | 7 +- .../@core/ui-kit/tabs-ui/src/use-tabs-drag.ts | 7 +- .../tabs-ui/src/use-tabs-view-scroll.ts | 2 +- apps/vben5/packages/constants/package.json | 2 +- .../packages/effects/access/package.json | 2 +- .../packages/effects/access/src/accessible.ts | 20 +- .../packages/effects/common-ui/package.json | 6 +- .../api-component/api-component.vue | 33 +- .../captcha/point-selection-captcha/index.vue | 1 + .../point-selection-captcha-card.vue | 1 + .../captcha/slider-captcha/index.vue | 1 + .../slider-captcha/slider-captcha-action.vue | 2 + .../slider-captcha/slider-captcha-bar.vue | 4 +- .../slider-captcha/slider-captcha-content.vue | 1 + .../common-ui/src/components/captcha/types.ts | 4 +- .../ellipsis-text/ellipsis-text.vue | 4 +- .../components/icon-picker/icon-picker.vue | 102 +++++- .../src/components/icon-picker/icons.ts | 56 ++++ .../effects/common-ui/src/components/index.ts | 1 + .../components/page/__tests__/page.test.ts | 1 + .../common-ui/src/components/page/page.vue | 11 +- .../src/components/tippy/directive.ts | 100 ++++++ .../common-ui/src/components/tippy/index.ts | 67 ++++ .../effects/common-ui/src/ui/about/about.vue | 1 + .../src/ui/authentication/code-login.vue | 2 + .../src/ui/authentication/forget-password.vue | 1 + .../common-ui/src/ui/authentication/index.ts | 2 +- .../common-ui/src/ui/authentication/login.vue | 2 + .../src/ui/authentication/qrcode-login.vue | 1 + .../src/ui/authentication/register.vue | 2 + .../ui/authentication/third-party-login.vue | 1 + .../common-ui/src/ui/fallback/fallback.vue | 1 + .../vben5/packages/effects/hooks/package.json | 2 +- .../effects/hooks/src/use-design-tokens.ts | 1 + .../effects/hooks/src/use-hover-toggle.ts | 3 +- .../effects/hooks/src/use-pagination.ts | 1 + .../packages/effects/hooks/src/use-tabs.ts | 4 +- .../packages/effects/layouts/package.json | 2 +- .../layouts/src/basic/content/content.vue | 2 +- .../layouts/src/basic/content/index.ts | 2 +- .../layouts/src/basic/header/header.vue | 19 +- .../effects/layouts/src/basic/layout.vue | 48 +-- .../layouts/src/basic/menu/extra-menu.vue | 1 + .../effects/layouts/src/basic/menu/menu.vue | 1 + .../layouts/src/basic/menu/mixed-menu.vue | 2 + .../layouts/src/basic/menu/use-extra-menu.ts | 54 ++-- .../layouts/src/basic/menu/use-mixed-menu.ts | 17 +- .../layouts/src/basic/menu/use-navigation.ts | 4 +- .../layouts/src/basic/tabbar/tabbar.vue | 2 + .../layouts/src/basic/tabbar/use-tabbar.ts | 4 +- .../layouts/src/iframe/iframe-router-view.vue | 1 + .../layouts/src/widgets/breadcrumb.vue | 2 + .../widgets/check-updates/check-updates.vue | 1 + .../layouts/src/widgets/color-toggle.vue | 1 + .../widgets/global-search/global-search.vue | 1 + .../widgets/global-search/search-panel.vue | 1 + .../layouts/src/widgets/language-toggle.vue | 1 + .../layouts/src/widgets/layout-toggle.vue | 2 + .../layouts/src/widgets/lock-screen/index.ts | 2 +- .../widgets/lock-screen/lock-screen-modal.vue | 1 + .../src/widgets/lock-screen/lock-screen.vue | 1 + .../src/widgets/notification/notification.vue | 1 + .../widgets/preferences/blocks/input-item.vue | 1 + .../preferences/blocks/layout/content.vue | 4 +- .../preferences/blocks/layout/header.vue | 31 +- .../preferences/blocks/layout/layout.vue | 19 +- .../preferences/blocks/layout/sidebar.vue | 2 +- .../preferences/blocks/layout/tabbar.vue | 18 ++ .../preferences/blocks/number-field-item.vue | 13 +- .../preferences/blocks/select-item.vue | 1 + .../preferences/blocks/switch-item.vue | 1 + .../preferences/blocks/theme/builtin.vue | 29 +- .../preferences/blocks/theme/theme.vue | 4 +- .../preferences/icons/header-mixed-nav.vue | 202 ++++++++++++ .../preferences/icons/header-sidebar-nav.vue | 177 ++++++++++ .../src/widgets/preferences/icons/index.ts | 2 + .../layouts/src/widgets/preferences/index.ts | 2 +- .../preferences/preferences-button.vue | 1 + .../preferences/preferences-drawer.vue | 16 +- .../src/widgets/preferences/preferences.vue | 1 + .../src/widgets/theme-toggle/theme-toggle.vue | 1 + .../widgets/user-dropdown/user-dropdown.vue | 4 +- .../packages/effects/plugins/package.json | 2 +- .../plugins/src/echarts/use-echarts.ts | 18 +- .../effects/plugins/src/vxe-table/api.ts | 11 +- .../effects/plugins/src/vxe-table/extends.ts | 3 +- .../effects/plugins/src/vxe-table/init.ts | 2 +- .../effects/plugins/src/vxe-table/types.ts | 14 +- .../plugins/src/vxe-table/use-vxe-grid.vue | 19 +- .../packages/effects/request/package.json | 2 +- .../request-client/modules/downloader.test.ts | 2 + .../src/request-client/modules/downloader.ts | 34 +- .../src/request-client/modules/uploader.ts | 13 +- .../src/request-client/preset-interceptors.ts | 39 +++ .../src/request-client/request-client.ts | 35 +- .../request/src/request-client/types.ts | 28 +- apps/vben5/packages/icons/package.json | 2 +- apps/vben5/packages/icons/src/svg/load.ts | 2 +- apps/vben5/packages/locales/package.json | 2 +- apps/vben5/packages/locales/src/i18n.ts | 3 +- .../locales/src/langs/en-US/preferences.json | 13 +- .../locales/src/langs/zh-CN/preferences.json | 15 +- apps/vben5/packages/preferences/package.json | 2 +- apps/vben5/packages/stores/package.json | 3 +- .../packages/stores/src/modules/access.ts | 3 +- .../packages/stores/src/modules/tabbar.ts | 13 +- apps/vben5/packages/styles/package.json | 5 +- apps/vben5/packages/styles/src/antd/index.css | 25 +- apps/vben5/packages/styles/src/ele/index.css | 4 + .../vben5/packages/styles/src/naive/index.css | 20 ++ apps/vben5/packages/types/package.json | 2 +- apps/vben5/packages/utils/package.json | 2 +- .../utils/src/helpers/find-menu-by-path.ts | 4 +- .../utils/src/helpers/generate-menus.ts | 3 +- .../src/helpers/generate-routes-backend.ts | 3 +- apps/vben5/playground/package.json | 2 +- .../playground/src/adapter/component/index.ts | 3 +- .../playground/src/api/examples/download.ts | 28 ++ apps/vben5/playground/src/api/request.ts | 31 +- apps/vben5/playground/src/bootstrap.ts | 13 + apps/vben5/playground/src/locales/index.ts | 4 +- .../playground/src/router/routes/core.ts | 10 +- .../src/router/routes/modules/dashboard.ts | 4 +- .../src/router/routes/modules/demos.ts | 3 +- .../src/router/routes/modules/examples.ts | 11 +- .../src/router/routes/modules/vben.ts | 24 +- .../dashboard/analytics/analytics-trends.vue | 8 +- .../analytics/analytics-visits-data.vue | 8 +- .../analytics/analytics-visits-sales.vue | 8 +- .../analytics/analytics-visits-source.vue | 8 +- .../dashboard/analytics/analytics-visits.vue | 8 +- .../src/views/dashboard/analytics/index.vue | 2 +- .../src/views/demos/badge/index.vue | 1 + .../demos/features/file-download/index.vue | 26 ++ .../src/views/demos/features/icons/index.vue | 25 +- .../features/vue-query/paginated-queries.vue | 4 +- .../src/views/examples/drawer/base-demo.vue | 3 + .../src/views/examples/drawer/index.vue | 50 +-- .../src/views/examples/form/basic.vue | 54 +++- .../src/views/examples/form/custom.vue | 31 +- .../examples/form/modules/two-fields.vue | 42 +++ .../src/views/examples/modal/blur-demo.vue | 23 ++ .../views/examples/modal/form-modal-demo.vue | 21 +- .../src/views/examples/modal/index.vue | 159 ++++++--- .../src/views/examples/modal/nested-demo.vue | 24 ++ .../src/views/examples/tippy/index.vue | 303 ++++++++++++++++++ .../src/views/examples/vxe-table/form.vue | 7 +- apps/vben5/pnpm-workspace.yaml | 148 ++++----- apps/vben5/scripts/turbo-run/package.json | 2 +- apps/vben5/scripts/vsh/package.json | 2 +- apps/vben5/scripts/vsh/src/publint/index.ts | 4 +- apps/vben5/vben-admin.code-workspace | 4 + 457 files changed, 3846 insertions(+), 1675 deletions(-) create mode 100644 apps/vben5/packages/effects/common-ui/src/components/icon-picker/icons.ts create mode 100644 apps/vben5/packages/effects/common-ui/src/components/tippy/directive.ts create mode 100644 apps/vben5/packages/effects/common-ui/src/components/tippy/index.ts create mode 100644 apps/vben5/packages/effects/layouts/src/widgets/preferences/icons/header-mixed-nav.vue create mode 100644 apps/vben5/packages/effects/layouts/src/widgets/preferences/icons/header-sidebar-nav.vue create mode 100644 apps/vben5/packages/styles/src/naive/index.css create mode 100644 apps/vben5/playground/src/api/examples/download.ts create mode 100644 apps/vben5/playground/src/views/examples/form/modules/two-fields.vue create mode 100644 apps/vben5/playground/src/views/examples/modal/blur-demo.vue create mode 100644 apps/vben5/playground/src/views/examples/modal/nested-demo.vue create mode 100644 apps/vben5/playground/src/views/examples/tippy/index.vue diff --git a/apps/vben5/.lintstagedrc.mjs b/apps/vben5/.lintstagedrc.mjs index e68d8a3e0..94b0192a7 100644 --- a/apps/vben5/.lintstagedrc.mjs +++ b/apps/vben5/.lintstagedrc.mjs @@ -1,4 +1,10 @@ export default { + '*.md': ['prettier --cache --ignore-unknown --write'], + '*.vue': [ + 'prettier --write', + 'eslint --cache --fix', + 'stylelint --fix --allow-empty-input', + ], '*.{js,jsx,ts,tsx}': [ 'prettier --cache --ignore-unknown --write', 'eslint --cache --fix', @@ -7,14 +13,8 @@ export default { 'prettier --cache --ignore-unknown --write', 'stylelint --fix --allow-empty-input', ], - '*.md': ['prettier --cache --ignore-unknown --write'], - '*.vue': [ - 'prettier --write', - 'eslint --cache --fix', - 'stylelint --fix --allow-empty-input', - ], + 'package.json': ['prettier --cache --write'], '{!(package)*.json,*.code-snippets,.!(browserslist)*rc}': [ 'prettier --cache --write--parser json', ], - 'package.json': ['prettier --cache --write'], }; diff --git a/apps/vben5/apps/app-antd/.env.development b/apps/vben5/apps/app-antd/.env.development index ea36fef54..d7204a13d 100644 --- a/apps/vben5/apps/app-antd/.env.development +++ b/apps/vben5/apps/app-antd/.env.development @@ -7,10 +7,10 @@ VITE_BASE=/ VITE_GLOB_API_URL=/ # 是否开启 Nitro Mock服务,true 为开启,false 为关闭 -VITE_NITRO_MOCK=true +VITE_NITRO_MOCK=false # 是否打开 devtools,true 为打开,false 为关闭 -VITE_DEVTOOLS=true +VITE_DEVTOOLS=false # 是否注入全局loading VITE_INJECT_APP_LOADING=true diff --git a/apps/vben5/apps/app-antd/package.json b/apps/vben5/apps/app-antd/package.json index 675f638eb..c49b42bd0 100644 --- a/apps/vben5/apps/app-antd/package.json +++ b/apps/vben5/apps/app-antd/package.json @@ -1,18 +1,18 @@ { - "name": "@vben/app-antd", - "version": "5.5.1", - "homepage": "https://vben.pro", - "bugs": "https://github.com/vbenjs/vue-vben-admin/issues", + "name": "@abp/app-antd", + "version": "8.3.4", + "homepage": "https://github.com/colinin/abp-next-admin", + "bugs": "https://github.com/colinin/abp-next-admin/issues", "repository": { "type": "git", - "url": "git+https://github.com/vbenjs/vue-vben-admin.git", + "url": "git+https://github.com/colinin/abp-next-admin.git", "directory": "apps/app-antd" }, "license": "MIT", "author": { - "name": "vben", - "email": "ann.vben@gmail.com", - "url": "https://github.com/anncwb" + "name": "colin", + "email": "colin.in@foxmail.com", + "url": "https://github.com/colinin" }, "type": "module", "scripts": { diff --git a/apps/vben5/apps/app-antd/src/bootstrap.ts b/apps/vben5/apps/app-antd/src/bootstrap.ts index a0af6fcfe..1967cea94 100644 --- a/apps/vben5/apps/app-antd/src/bootstrap.ts +++ b/apps/vben5/apps/app-antd/src/bootstrap.ts @@ -1,6 +1,7 @@ import { createApp, watchEffect } from 'vue'; import { registerAccessDirective } from '@vben/access'; +import { initTippy } from '@vben/common-ui'; import { preferences } from '@vben/preferences'; import { initStores } from '@vben/stores'; import '@vben/styles'; @@ -31,6 +32,9 @@ async function bootstrap(namespace: string) { // 安装权限指令 registerAccessDirective(app); + // 初始化 tippy + initTippy(app); + // 配置路由及路由守卫 app.use(router); diff --git a/apps/vben5/apps/app-antd/src/locales/index.ts b/apps/vben5/apps/app-antd/src/locales/index.ts index 60e61112a..d9d3c867e 100644 --- a/apps/vben5/apps/app-antd/src/locales/index.ts +++ b/apps/vben5/apps/app-antd/src/locales/index.ts @@ -1,7 +1,9 @@ -import type { LocaleSetupOptions, SupportedLanguagesType } from '@vben/locales'; import type { Locale } from 'ant-design-vue/es/locale'; import type { App } from 'vue'; + +import type { LocaleSetupOptions, SupportedLanguagesType } from '@vben/locales'; + import { ref } from 'vue'; import { @@ -15,6 +17,7 @@ import { useAbpStore } from '@abp/core'; import antdEnLocale from 'ant-design-vue/es/locale/en_US'; import antdDefaultLocale from 'ant-design-vue/es/locale/zh_CN'; import dayjs from 'dayjs'; +import localizedFormat from 'dayjs/plugin/localizedFormat'; import { useAbpConfigApi } from '#/api/core/useAbpConfigApi'; @@ -73,6 +76,7 @@ async function loadDayjsLocale(lang: SupportedLanguagesType) { } if (locale) { dayjs.locale(locale); + dayjs.extend(localizedFormat); } else { console.error(`Failed to load dayjs locale for ${lang}`); } @@ -119,8 +123,7 @@ async function setupI18n(app: App, options: LocaleSetupOptions = {}) { await coreSetup(app, { defaultLocale: preferences.app.locale, loadMessages, - // missingWarn: !import.meta.env.PROD, - missingWarn: false, + missingWarn: !import.meta.env.PROD, ...options, }); } diff --git a/apps/vben5/apps/app-antd/src/router/routes/core.ts b/apps/vben5/apps/app-antd/src/router/routes/core.ts index fe030a9a2..7218da228 100644 --- a/apps/vben5/apps/app-antd/src/router/routes/core.ts +++ b/apps/vben5/apps/app-antd/src/router/routes/core.ts @@ -2,7 +2,7 @@ import type { RouteRecordRaw } from 'vue-router'; import { DEFAULT_HOME_PATH, LOGIN_PATH } from '@vben/constants'; -import { AuthPageLayout } from '#/layouts'; +import { AuthPageLayout, BasicLayout } from '#/layouts'; import { $t } from '#/locales'; import Login from '#/views/_core/authentication/login.vue'; @@ -21,13 +21,21 @@ const fallbackNotFoundRoute: RouteRecordRaw = { /** 基本路由,这些路由是必须存在的 */ const coreRoutes: RouteRecordRaw[] = [ + /** + * 根路由 + * 使用基础布局,作为所有页面的父级容器,子级就不必配置BasicLayout。 + * 此路由必须存在,且不应修改 + */ { + component: BasicLayout, meta: { + hideInBreadcrumb: true, title: 'Root', }, name: 'Root', path: '/', redirect: DEFAULT_HOME_PATH, + children: [], }, { component: AuthPageLayout, diff --git a/apps/vben5/apps/app-antd/src/router/routes/modules/abp.ts b/apps/vben5/apps/app-antd/src/router/routes/modules/abp.ts index 1b7ec5c4f..0b3f7f404 100644 --- a/apps/vben5/apps/app-antd/src/router/routes/modules/abp.ts +++ b/apps/vben5/apps/app-antd/src/router/routes/modules/abp.ts @@ -1,11 +1,9 @@ import type { RouteRecordRaw } from 'vue-router'; -import { BasicLayout } from '#/layouts'; import { $t } from '#/locales'; const routes: RouteRecordRaw[] = [ { - component: BasicLayout, meta: { icon: 'https://abp.io/assets/favicon.ico/favicon-16x16.png', keepAlive: true, diff --git a/apps/vben5/apps/app-antd/src/router/routes/modules/dashboard.ts b/apps/vben5/apps/app-antd/src/router/routes/modules/dashboard.ts index 1bddab9db..5254dc65d 100644 --- a/apps/vben5/apps/app-antd/src/router/routes/modules/dashboard.ts +++ b/apps/vben5/apps/app-antd/src/router/routes/modules/dashboard.ts @@ -1,18 +1,16 @@ import type { RouteRecordRaw } from 'vue-router'; -import { BasicLayout } from '#/layouts'; import { $t } from '#/locales'; const routes: RouteRecordRaw[] = [ { - component: BasicLayout, meta: { icon: 'lucide:layout-dashboard', order: -1, title: $t('page.dashboard.title'), }, name: 'Dashboard', - path: '/', + path: '/dashboard', children: [ { name: 'Analytics', diff --git a/apps/vben5/apps/app-antd/src/router/routes/modules/demos.ts b/apps/vben5/apps/app-antd/src/router/routes/modules/demos.ts index 32bb338e0..55ade09c9 100644 --- a/apps/vben5/apps/app-antd/src/router/routes/modules/demos.ts +++ b/apps/vben5/apps/app-antd/src/router/routes/modules/demos.ts @@ -1,11 +1,9 @@ import type { RouteRecordRaw } from 'vue-router'; -import { BasicLayout } from '#/layouts'; import { $t } from '#/locales'; const routes: RouteRecordRaw[] = [ { - component: BasicLayout, meta: { icon: 'ic:baseline-view-in-ar', keepAlive: true, diff --git a/apps/vben5/apps/app-antd/src/router/routes/modules/vben.ts b/apps/vben5/apps/app-antd/src/router/routes/modules/vben.ts index 210e8610f..98acf5821 100644 --- a/apps/vben5/apps/app-antd/src/router/routes/modules/vben.ts +++ b/apps/vben5/apps/app-antd/src/router/routes/modules/vben.ts @@ -8,30 +8,20 @@ import { VBEN_NAIVE_PREVIEW_URL, } from '@vben/constants'; -import { BasicLayout, IFrameView } from '#/layouts'; +import { IFrameView } from '#/layouts'; import { $t } from '#/locales'; const routes: RouteRecordRaw[] = [ { - component: BasicLayout, meta: { badgeType: 'dot', icon: VBEN_LOGO_URL, - order: 9999, + order: 9998, title: $t('demos.vben.title'), }, name: 'VbenProject', path: '/vben-admin', children: [ - { - name: 'VbenAbout', - path: '/vben-admin/about', - component: () => import('#/views/_core/about/index.vue'), - meta: { - icon: 'lucide:copyright', - title: $t('demos.vben.about'), - }, - }, { name: 'VbenDocument', path: '/vben-admin/document', @@ -76,6 +66,16 @@ const routes: RouteRecordRaw[] = [ }, ], }, + { + name: 'VbenAbout', + path: '/vben-admin/about', + component: () => import('#/views/_core/about/index.vue'), + meta: { + icon: 'lucide:copyright', + title: $t('demos.vben.about'), + order: 9999, + }, + }, ]; export default routes; diff --git a/apps/vben5/apps/app-antd/src/views/dashboard/analytics/analytics-trends.vue b/apps/vben5/apps/app-antd/src/views/dashboard/analytics/analytics-trends.vue index fadfc917c..f1f0b232a 100644 --- a/apps/vben5/apps/app-antd/src/views/dashboard/analytics/analytics-trends.vue +++ b/apps/vben5/apps/app-antd/src/views/dashboard/analytics/analytics-trends.vue @@ -1,11 +1,9 @@ diff --git a/apps/vben5/docs/src/demos/vben-drawer/shared-data/index.vue b/apps/vben5/docs/src/demos/vben-drawer/shared-data/index.vue index 04885f157..fef6cb058 100644 --- a/apps/vben5/docs/src/demos/vben-drawer/shared-data/index.vue +++ b/apps/vben5/docs/src/demos/vben-drawer/shared-data/index.vue @@ -9,11 +9,12 @@ const [Drawer, drawerApi] = useVbenDrawer({ }); function open() { - drawerApi.setData({ - content: '外部传递的数据 content', - payload: '外部传递的数据 payload', - }); - drawerApi.open(); + drawerApi + .setData({ + content: '外部传递的数据 content', + payload: '外部传递的数据 payload', + }) + .open(); } diff --git a/apps/vben5/docs/src/demos/vben-modal/dynamic/index.vue b/apps/vben5/docs/src/demos/vben-modal/dynamic/index.vue index 718e532bc..1b0255459 100644 --- a/apps/vben5/docs/src/demos/vben-modal/dynamic/index.vue +++ b/apps/vben5/docs/src/demos/vben-modal/dynamic/index.vue @@ -13,8 +13,7 @@ function openModal() { } function handleUpdateTitle() { - modalApi.setState({ title: '外部动态标题' }); - modalApi.open(); + modalApi.setState({ title: '外部动态标题' }).open(); } diff --git a/apps/vben5/docs/src/demos/vben-modal/shared-data/index.vue b/apps/vben5/docs/src/demos/vben-modal/shared-data/index.vue index 58c35e24d..91afeb70d 100644 --- a/apps/vben5/docs/src/demos/vben-modal/shared-data/index.vue +++ b/apps/vben5/docs/src/demos/vben-modal/shared-data/index.vue @@ -9,11 +9,12 @@ const [Modal, modalApi] = useVbenModal({ }); function openModal() { - modalApi.setData({ - content: '外部传递的数据 content', - payload: '外部传递的数据 payload', - }); - modalApi.open(); + modalApi + .setData({ + content: '外部传递的数据 content', + payload: '外部传递的数据 payload', + }) + .open(); } diff --git a/apps/vben5/docs/src/en/guide/essentials/route.md b/apps/vben5/docs/src/en/guide/essentials/route.md index bef40d691..8fb0a6d1c 100644 --- a/apps/vben5/docs/src/en/guide/essentials/route.md +++ b/apps/vben5/docs/src/en/guide/essentials/route.md @@ -73,7 +73,6 @@ import { $t } from '#/locales'; const routes: RouteRecordRaw[] = [ { - component: BasicLayout, meta: { badgeType: 'dot', badgeVariants: 'destructive', @@ -124,7 +123,6 @@ import { $t } from '#/locales'; const routes: RouteRecordRaw[] = [ { - component: BasicLayout, meta: { icon: 'ic:baseline-view-in-ar', keepAlive: true, @@ -249,7 +247,6 @@ import { $t } from '#/locales'; const routes: RouteRecordRaw[] = [ { - component: BasicLayout, meta: { icon: 'mdi:home', title: $t('page.home.title'), diff --git a/apps/vben5/docs/src/guide/essentials/route.md b/apps/vben5/docs/src/guide/essentials/route.md index 0eb74aea4..d8a938dda 100644 --- a/apps/vben5/docs/src/guide/essentials/route.md +++ b/apps/vben5/docs/src/guide/essentials/route.md @@ -62,12 +62,10 @@ import type { RouteRecordRaw } from 'vue-router'; import { VBEN_LOGO_URL } from '@vben/constants'; -import { BasicLayout } from '#/layouts'; import { $t } from '#/locales'; const routes: RouteRecordRaw[] = [ { - component: BasicLayout, meta: { badgeType: 'dot', badgeVariants: 'destructive', @@ -103,7 +101,6 @@ export default routes; ::: tip -- 多级路由的父级路由无需设置 `component` 属性,只需设置 `children` 属性即可。除非你真的需要在父级路由嵌套下显示内容。 - 如果没有特殊情况,父级路由的 `redirect` 属性,不需要指定,默认会指向第一个子路由。 ::: @@ -113,12 +110,10 @@ export default routes; ```ts import type { RouteRecordRaw } from 'vue-router'; -import { BasicLayout } from '#/layouts'; import { $t } from '#/locales'; const routes: RouteRecordRaw[] = [ { - component: BasicLayout, meta: { icon: 'ic:baseline-view-in-ar', keepAlive: true, @@ -238,12 +233,10 @@ import type { RouteRecordRaw } from 'vue-router'; import { VBEN_LOGO_URL } from '@vben/constants'; -import { BasicLayout } from '#/layouts'; import { $t } from '#/locales'; const routes: RouteRecordRaw[] = [ { - component: BasicLayout, meta: { icon: 'mdi:home', title: $t('page.home.title'), @@ -400,6 +393,10 @@ interface RouteMeta { * 菜单可以看到,但是访问会被重定向到403 */ menuVisibleWithForbidden?: boolean; + /** + * 当前路由不使用基础布局(仅在顶级生效) + */ + noBasicLayout?: boolean; /** * 在新窗口打开 */ @@ -584,6 +581,13 @@ _注意:_ 排序仅针对一级菜单有效,二级菜单的排序需要在对 用于配置页面的菜单参数,会在菜单中传递给页面。 +### noBasicLayout + +- 类型:`boolean` +- 默认值:`false` + +用于配置当前路由不使用基础布局,仅在顶级时生效。默认情况下,所有的路由都会被包裹在基础布局中(包含顶部以及侧边等导航部件),如果你的页面不需要这些部件,可以设置 `noBasicLayout` 为 `true`。 + ## 路由刷新 路由刷新方式如下: diff --git a/apps/vben5/docs/src/guide/essentials/server.md b/apps/vben5/docs/src/guide/essentials/server.md index 74a45d2ee..fedfbae25 100644 --- a/apps/vben5/docs/src/guide/essentials/server.md +++ b/apps/vben5/docs/src/guide/essentials/server.md @@ -231,19 +231,17 @@ function createRequestClient(baseURL: string) { }, }); - // response数据解构 - client.addResponseInterceptor({ - fulfilled: (response) => { - const { data: responseData, status } = response; - - const { code, data } = responseData; - - if (status >= 200 && status < 400 && code === 0) { - return data; - } - throw Object.assign({}, response, { response }); - }, - }); + // 处理返回的响应数据格式。会根据responseReturn指定的类型返回对应的数据 + client.addResponseInterceptor( + defaultResponseInterceptor({ + // 指定接口返回的数据中的 code 字段名 + codeField: 'code', + // 指定接口返回的数据中装载了主要数据的字段名 + dataField: 'data', + // 请求成功的 code 值,如果接口返回的 code 等于 successCode 则会认为是成功的请求 + successCode: 0, + }), + ); // token过期的处理 client.addResponseInterceptor( diff --git a/apps/vben5/docs/src/guide/in-depth/access.md b/apps/vben5/docs/src/guide/in-depth/access.md index c0c4bc991..be7d2ba0a 100644 --- a/apps/vben5/docs/src/guide/in-depth/access.md +++ b/apps/vben5/docs/src/guide/in-depth/access.md @@ -296,7 +296,7 @@ const { hasAccessByRoles } = useAccess(); #### 指令方式 -> 指令支持绑定单个或多个权限码。单个时可以直接传入字符串或数组中包含一个权限码,多个权限码则传入数组。 +> 指令支持绑定单个或多个角色。单个时可以直接传入字符串或数组中包含一个角色,多个角色均可访问则传入数组。 ```vue