From c8146768f28e9dc28eb7ad303ed57db25e4b9523 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Thu, 10 Apr 2025 08:33:55 +0300 Subject: [PATCH 01/31] added lepton-x version argument to update command (initial) --- .../Volo/Abp/Cli/Commands/UpdateCommand.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs index ad0992af4e..7d0248d4e0 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs @@ -38,6 +38,7 @@ public class UpdateCommand : IConsoleCommand, ITransientDependency var directory = commandLineArgs.Options.GetOrNull(Options.SolutionPath.Short, Options.SolutionPath.Long) ?? Directory.GetCurrentDirectory(); var version = commandLineArgs.Options.GetOrNull(Options.Version.Short, Options.Version.Long); + var leptonXVersion = commandLineArgs.Options.GetOrNull(Options.LeptonXVersion.Short, Options.LeptonXVersion.Long); if (updateNuget || !updateNpm) { @@ -120,6 +121,7 @@ public class UpdateCommand : IConsoleCommand, ITransientDependency sb.AppendLine("-sn|--solution-name (Specify the solution name)"); sb.AppendLine("--check-all (Check the new version of each package separately)"); sb.AppendLine("-v|--version (default: latest version)"); + sb.AppendLine("-lv|--leptonx-version (default: latest LeptonX version)"); sb.AppendLine(""); sb.AppendLine("Some examples:"); sb.AppendLine(""); @@ -167,5 +169,11 @@ public class UpdateCommand : IConsoleCommand, ITransientDependency public const string Short = "v"; public const string Long = "version"; } + + public static class LeptonXVersion + { + public const string Short = "lv"; + public const string Long = "leptonx-version"; + } } } From 67c5abb89060e072d55d98692303ea9a91b17dd0 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Thu, 10 Apr 2025 11:29:24 +0300 Subject: [PATCH 02/31] implementation of lepton-x version argument of update command --- .../Volo/Abp/Cli/Commands/UpdateCommand.cs | 14 +++--- .../ProjectModification/NpmPackagesUpdater.cs | 45 +++++++++++++----- .../VoloNugetPackagesVersionUpdater.cs | 47 +++++++++++++++---- 3 files changed, 79 insertions(+), 27 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs index 7d0248d4e0..8c6df3b0b9 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs @@ -42,21 +42,21 @@ public class UpdateCommand : IConsoleCommand, ITransientDependency if (updateNuget || !updateNpm) { - await UpdateNugetPackages(commandLineArgs, directory, version); + await UpdateNugetPackages(commandLineArgs, directory, version, leptonXVersion); } if (updateNpm || !updateNuget) { - await UpdateNpmPackages(directory, version); + await UpdateNpmPackages(directory, version, leptonXVersion); } } - private async Task UpdateNpmPackages(string directory, string version) + private async Task UpdateNpmPackages(string directory, string version, string leptonXVersion) { - await _npmPackagesUpdater.Update(directory, version: version); + await _npmPackagesUpdater.Update(directory, version: version, leptonXVersion: leptonXVersion); } - private async Task UpdateNugetPackages(CommandLineArgs commandLineArgs, string directory, string version) + private async Task UpdateNugetPackages(CommandLineArgs commandLineArgs, string directory, string version, string leptonXVersion) { var solutions = new List(); var givenSolution = commandLineArgs.Options.GetOrNull(Options.SolutionName.Short, Options.SolutionName.Long); @@ -78,7 +78,7 @@ public class UpdateCommand : IConsoleCommand, ITransientDependency { var solutionName = Path.GetFileName(solution).RemovePostFix(".sln"); - await _nugetPackagesVersionUpdater.UpdateSolutionAsync(solution, checkAll: checkAll, version: version); + await _nugetPackagesVersionUpdater.UpdateSolutionAsync(solution, checkAll: checkAll, version: version, leptonXVersion: leptonXVersion); Logger.LogInformation("Volo packages are updated in {SolutionName} solution", solutionName); } @@ -91,7 +91,7 @@ public class UpdateCommand : IConsoleCommand, ITransientDependency { var projectName = Path.GetFileName(project).RemovePostFix(".csproj"); - await _nugetPackagesVersionUpdater.UpdateProjectAsync(project, checkAll: checkAll, version: version); + await _nugetPackagesVersionUpdater.UpdateProjectAsync(project, checkAll: checkAll, version: version, leptonXVersion: leptonXVersion); Logger.LogInformation("Volo packages are updated in {ProjectName} project", projectName); return; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs index 2c88f1e8c5..11da78b6b7 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs @@ -50,7 +50,7 @@ public class NpmPackagesUpdater : ITransientDependency public async Task Update(string rootDirectory, bool includePreviews = false, bool includeReleaseCandidates = false, - bool switchToStable = false, string version = null, bool includePreRc = false) + bool switchToStable = false, string version = null, string leptonXVersion = null, bool includePreRc = false) { var fileList = _packageJsonFileFinder.Find(rootDirectory); @@ -80,6 +80,7 @@ public class NpmPackagesUpdater : ITransientDependency var updated = await UpdatePackagesInFile(file, includePreviews, includeReleaseCandidates, switchToStable, version, + leptonXVersion, includePreRc); packagesUpdated.TryAdd(file, updated); @@ -162,10 +163,11 @@ public class NpmPackagesUpdater : ITransientDependency bool includeReleaseCandidates = false, bool switchToStable = false, string specifiedVersion = null, + string specifiedLeptonXVersion = null, bool includePreRc = false) { var packagesUpdated = false; - var fileContent = File.ReadAllText(filePath); + var fileContent = await File.ReadAllTextAsync(filePath); var packageJson = JObject.Parse(fileContent); var abpPackages = GetAbpPackagesFromPackageJson(packageJson); @@ -177,7 +179,7 @@ public class NpmPackagesUpdater : ITransientDependency foreach (var abpPackage in abpPackages) { var updated = await TryUpdatingPackage(filePath, abpPackage, includePreviews, includeReleaseCandidates, - switchToStable, specifiedVersion, includePreRc); + switchToStable, specifiedVersion, specifiedLeptonXVersion, includePreRc); if (updated) { @@ -187,7 +189,7 @@ public class NpmPackagesUpdater : ITransientDependency var updatedContent = packageJson.ToString(Formatting.Indented); - File.WriteAllText(filePath, updatedContent); + await File.WriteAllTextAsync(filePath, updatedContent); return packagesUpdated; } @@ -199,6 +201,7 @@ public class NpmPackagesUpdater : ITransientDependency bool includeReleaseCandidates = false, bool switchToStable = false, string specifiedVersion = null, + string specifiedLeptonXVersion = null, bool includePreRc = false) { var currentVersion = (string)package.Value; @@ -207,18 +210,36 @@ public class NpmPackagesUpdater : ITransientDependency if (!specifiedVersion.IsNullOrWhiteSpace()) { - if (!SpecifiedVersionExists(specifiedVersion, package)) + if (package.Name.Contains("leptonx", StringComparison.InvariantCultureIgnoreCase) && !specifiedLeptonXVersion.IsNullOrWhiteSpace()) { - return false; - } + if (!SpecifiedVersionExists(specifiedLeptonXVersion, package)) + { + return false; + } - if (SemanticVersion.Parse(specifiedVersion) <= - SemanticVersion.Parse(currentVersion.RemovePreFix("~", "^"))) - { - return false; + if (SemanticVersion.Parse(specifiedLeptonXVersion) <= + SemanticVersion.Parse(currentVersion.RemovePreFix("~", "^"))) + { + return false; + } + + version = specifiedLeptonXVersion.EnsureStartsWith('^'); } + else + { + if (!SpecifiedVersionExists(specifiedVersion, package)) + { + return false; + } - version = specifiedVersion.EnsureStartsWith('^'); + if (SemanticVersion.Parse(specifiedVersion) <= + SemanticVersion.Parse(currentVersion.RemovePreFix("~", "^"))) + { + return false; + } + + version = specifiedVersion.EnsureStartsWith('^'); + } } else { diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs index 4ece393913..924d6041b1 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs @@ -27,7 +27,14 @@ public class VoloNugetPackagesVersionUpdater : ITransientDependency Logger = NullLogger.Instance; } - public async Task UpdateSolutionAsync(string solutionPath, bool includePreviews = false, bool includeReleaseCandidates = false, bool switchToStable = false, bool checkAll = false, string version = null) + public async Task UpdateSolutionAsync( + string solutionPath, + bool includePreviews = false, + bool includeReleaseCandidates = false, + bool switchToStable = false, + bool checkAll = false, + string version = null, + string leptonXVersion = null) { var projectPaths = ProjectFinder.GetProjectFiles(solutionPath); @@ -58,6 +65,7 @@ public class VoloNugetPackagesVersionUpdater : ITransientDependency latestReleaseCandidateVersionInfo.Version, latestVersionFromMyGet, version, + leptonXVersion, latestStableVersions: latestStableVersions); fs.Seek(0, SeekOrigin.Begin); @@ -75,7 +83,14 @@ public class VoloNugetPackagesVersionUpdater : ITransientDependency } } - public async Task UpdateProjectAsync(string projectPath, bool includeNightlyPreviews = false, bool includeReleaseCandidates = false, bool switchToStable = false, bool checkAll = false, string version = null) + public async Task UpdateProjectAsync( + string projectPath, + bool includeNightlyPreviews = false, + bool includeReleaseCandidates = false, + bool switchToStable = false, + bool checkAll = false, + string version = null, + string leptonXVersion = null) { if (checkAll && version.IsNullOrWhiteSpace()) { @@ -102,6 +117,7 @@ public class VoloNugetPackagesVersionUpdater : ITransientDependency latestReleaseCandidateVersionInfo.Version, latestVersionFromMyGet, version, + leptonXVersion, latestStableVersions: latestStableVersions); fs.Seek(0, SeekOrigin.Begin); @@ -166,6 +182,7 @@ public class VoloNugetPackagesVersionUpdater : ITransientDependency SemanticVersion latestNugetReleaseCandidateVersion = null, string latestMyGetVersion = null, string specifiedVersion = null, + string specifiedLeptonXVersion = null, List latestStableVersions = null) { string packageId = null; @@ -222,21 +239,35 @@ public class VoloNugetPackagesVersionUpdater : ITransientDependency var leptonXPackageVersion = latestStableVersions? .FirstOrDefault(v => v.Version.Equals(specifiedVersion, StringComparison.InvariantCultureIgnoreCase))?.LeptonX?.Version; - if ((isLeptonXPackage && string.IsNullOrWhiteSpace(leptonXPackageVersion)) || isStudioPackage) + if ((isLeptonXPackage && string.IsNullOrWhiteSpace(leptonXPackageVersion) && specifiedLeptonXVersion.IsNullOrWhiteSpace()) || isStudioPackage) { Logger.LogWarning("Package: {PackageId} could not be updated. Please manually update the package version yourself to prevent version mismatches!", packageId); continue; } - var isLeptonXPackageWithVersion = isLeptonXPackage && !string.IsNullOrWhiteSpace(leptonXPackageVersion); - - if (isLeptonXPackageWithVersion || await SpecifiedVersionExists(specifiedVersion, packageId)) + if (isLeptonXPackage) { - TryUpdatingPackage(isLeptonXPackageWithVersion ? leptonXPackageVersion : specifiedVersion); + var isLeptonXPackageWithVersion = isLeptonXPackage && !string.IsNullOrWhiteSpace(leptonXPackageVersion); + + if (isLeptonXPackageWithVersion || await SpecifiedVersionExists(specifiedLeptonXVersion, packageId)) + { + TryUpdatingPackage(specifiedLeptonXVersion ?? leptonXPackageVersion); + } + else + { + Logger.LogWarning($"Package \"{packageId}\" specified version v{specifiedLeptonXVersion} does not exist!"); + } } else { - Logger.LogWarning("Package \"{PackageId}\" specified version v{SpecifiedVersion} does not exist!", packageId, specifiedVersion); + if (await SpecifiedVersionExists(specifiedVersion, packageId)) + { + TryUpdatingPackage(specifiedVersion); + } + else + { + Logger.LogWarning($"Package \"{packageId}\" specified version v{specifiedVersion} does not exist!"); + } } void TryUpdatingPackage(string versionToUpdate) From a859835b17141dc49283531cda67436797843509 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Thu, 10 Apr 2025 11:34:14 +0300 Subject: [PATCH 03/31] Update index.md --- docs/en/cli/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/en/cli/index.md b/docs/en/cli/index.md index 38503b73be..a9caa0b6bb 100644 --- a/docs/en/cli/index.md +++ b/docs/en/cli/index.md @@ -342,6 +342,7 @@ Note that this command can upgrade your solution from a previous version, and al * `--solution-name` or `-sn`: Specify the solution name. Search `*.sln` files in the directory by default. * `--check-all`: Check the new version of each package separately. Default is `false`. * `--version` or `-v`: Specifies the version to use for update. If not specified, latest version is used. +* * `--leptonx-version` or `-lv`: Specifies the LeptonX version to use for update. If not specified, latest version or the version that is compatible with `--version` argument is used. ### clean From 4fc2f0b5b91bb8a48550011478aaf235a4102d2a Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Thu, 10 Apr 2025 18:14:43 +0800 Subject: [PATCH 04/31] Add account layout for account routes --- .../packages/account/config/src/providers/route.provider.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/npm/ng-packs/packages/account/config/src/providers/route.provider.ts b/npm/ng-packs/packages/account/config/src/providers/route.provider.ts index b152237503..15baeae9f8 100644 --- a/npm/ng-packs/packages/account/config/src/providers/route.provider.ts +++ b/npm/ng-packs/packages/account/config/src/providers/route.provider.ts @@ -24,12 +24,14 @@ export function configureRoutes() { path: '/account/login', name: eAccountRouteNames.Login, parentName: eAccountRouteNames.Account, + layout: eLayoutType.account, order: 1, }, { path: '/account/register', name: eAccountRouteNames.Register, parentName: eAccountRouteNames.Account, + layout: eLayoutType.account, order: 2, }, { @@ -45,12 +47,14 @@ export function configureRoutes() { path: '/account/forgot-password', parentName: eAccountRouteNames.Account, name: eAccountRouteNames.ForgotPassword, + layout: eLayoutType.account, invisible: true, }, { path: '/account/reset-password', parentName: eAccountRouteNames.Account, name: eAccountRouteNames.ResetPassword, + layout: eLayoutType.account, invisible: true, }, ]); From 5669092d4e78a507e440c8e541b24c574d73d538 Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 11 Apr 2025 11:06:14 +0800 Subject: [PATCH 05/31] Make `AddBlazorWebAppServices` method as obsolete. --- .../AbpBlazorWebAppServiceCollectionExtensions.cs | 5 +++++ .../WebApp/RemoteAuthenticationStateProvider.cs | 15 +++++++++++---- ...RemoteAuthenticationStateProviderCompatible.cs | 8 ++++++++ 3 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebApp/RemoteAuthenticationStateProviderCompatible.cs diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Microsoft/Extensions/DependencyInjection/AbpBlazorWebAppServiceCollectionExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Microsoft/Extensions/DependencyInjection/AbpBlazorWebAppServiceCollectionExtensions.cs index 1bcc1c1f45..2027ac1e69 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Microsoft/Extensions/DependencyInjection/AbpBlazorWebAppServiceCollectionExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Microsoft/Extensions/DependencyInjection/AbpBlazorWebAppServiceCollectionExtensions.cs @@ -1,3 +1,4 @@ +using System; using JetBrains.Annotations; using Microsoft.AspNetCore.Components.Authorization; using Microsoft.Extensions.DependencyInjection.Extensions; @@ -19,10 +20,14 @@ public static class AbpBlazorWebAppServiceCollectionExtensions return services; } + [Obsolete("Use AddBlazorWebAppServices instead. See https://github.com/abpframework/abp/issues/22622")] public static IServiceCollection AddBlazorWebAppTieredServices([NotNull] this IServiceCollection services) { Check.NotNull(services, nameof(services)); + // Compatibility with old template code + services.AddTransient(); + services.AddScoped(); services.Replace(ServiceDescriptor.Singleton()); diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebApp/RemoteAuthenticationStateProvider.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebApp/RemoteAuthenticationStateProvider.cs index b35960f071..d3f05820b0 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebApp/RemoteAuthenticationStateProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebApp/RemoteAuthenticationStateProvider.cs @@ -1,5 +1,7 @@ +using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Security.Claims; namespace Volo.Abp.AspNetCore.Components.WebAssembly.WebApp; @@ -8,21 +10,26 @@ public class RemoteAuthenticationStateProvider : AuthenticationStateProvider { protected ICurrentPrincipalAccessor CurrentPrincipalAccessor { get; } protected WebAssemblyCachedApplicationConfigurationClient WebAssemblyCachedApplicationConfigurationClient { get; } + protected IServiceProvider ServiceProvider { get; } public RemoteAuthenticationStateProvider( ICurrentPrincipalAccessor currentPrincipalAccessor, - WebAssemblyCachedApplicationConfigurationClient webAssemblyCachedApplicationConfigurationClient) + WebAssemblyCachedApplicationConfigurationClient webAssemblyCachedApplicationConfigurationClient, + IServiceProvider serviceProvider) { CurrentPrincipalAccessor = currentPrincipalAccessor; WebAssemblyCachedApplicationConfigurationClient = webAssemblyCachedApplicationConfigurationClient; + ServiceProvider = serviceProvider; } public async override Task GetAuthenticationStateAsync() { - if (CurrentPrincipalAccessor.Principal.Identity == null || - !CurrentPrincipalAccessor.Principal.Identity.IsAuthenticated) + if (ServiceProvider.GetService() != null) { - await WebAssemblyCachedApplicationConfigurationClient.InitializeAsync(); + if (CurrentPrincipalAccessor.Principal.Identity == null || !CurrentPrincipalAccessor.Principal.Identity.IsAuthenticated) + { + await WebAssemblyCachedApplicationConfigurationClient.InitializeAsync(); + } } return new AuthenticationState(CurrentPrincipalAccessor.Principal); diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebApp/RemoteAuthenticationStateProviderCompatible.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebApp/RemoteAuthenticationStateProviderCompatible.cs new file mode 100644 index 0000000000..780f96c631 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebApp/RemoteAuthenticationStateProviderCompatible.cs @@ -0,0 +1,8 @@ +namespace Volo.Abp.AspNetCore.Components.WebAssembly.WebApp; + +/// +/// This class is used to indicate that the AddBlazorWebAppTieredServices method has been called for compatibility with the old template code +/// +internal sealed class AddBlazorWebAppTieredServicesHasBeenCalled +{ +} From fca2c99457779f1ee0a96d43b83362d86c66787d Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 11 Apr 2025 18:06:38 +0800 Subject: [PATCH 06/31] Disable features if the value is not from the current provider. --- .../Components/FeatureManagementModal.razor | 4 +- .../Abp/FeatureManagement/FeatureManager.cs | 2 +- .../FeatureManagementModal.cshtml | 86 ++++++++++--------- .../FeatureManagementModal.cshtml.cs | 10 ++- .../feature-management-modal.css | 14 ++- .../Abp/SettingManagement/SettingManager.cs | 2 +- 6 files changed, 70 insertions(+), 48 deletions(-) diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor/Components/FeatureManagementModal.razor b/modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor/Components/FeatureManagementModal.razor index 77f5018e10..7e00ecf3c3 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor/Components/FeatureManagementModal.razor +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor/Components/FeatureManagementModal.razor @@ -57,7 +57,7 @@ var selectedValue = SelectionStringValues[feature.Name]; @feature.DisplayName - @foreach (var item in items) { @@ -75,7 +75,7 @@ if (feature.ValueType is ToggleStringValueType) { - + @feature.DisplayName @if (feature.Description != null) diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManager.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManager.cs index 9805f03752..7227d8d82d 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManager.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManager.cs @@ -152,7 +152,7 @@ public class FeatureManager : IFeatureManager, ISingletonDependency await using (await providers[0].HandleContextAsync(providerName, providerKey)) { var fallbackValue = await GetOrNullInternalAsync(name, providers[1].Name, null); - if (fallbackValue.Value == value) + if (fallbackValue.Value.Equals(value, StringComparison.OrdinalIgnoreCase)) { //Clear the value if it's same as it's fallback value value = null; diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml index c55399d582..f8372a2ed8 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml @@ -51,20 +51,21 @@ @if (feature.ValueType is ToggleStringValueType) { - - - @if (feature.Description != null) - { -
@feature.Description
- } +
+ + @if (feature.Description != null) + { +
@feature.Description
+ } +
} @if (feature.ValueType is FreeTextStringValueType) @@ -74,42 +75,45 @@ { type = "number"; } - - - @if (feature.Description != null) - { -
@feature.Description
- } +
+ + @if (feature.Description != null) + { +
@feature.Description
+ } +
} @if (feature.ValueType is SelectionStringValueType selectType) { -
- +
+
+ - + @foreach (var item in selectType.ItemSource.Items) { - + if (item.Value == feature.Value) + { + + } + else + { + + } } + + @if (feature.Description != null) + { +
@feature.Description
} - - @if (feature.Description != null) - { -
@feature.Description
- } +
} diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs index f08d42cfd2..edebca2fa0 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs @@ -25,9 +25,9 @@ public class FeatureManagementModal : AbpPageModel [HiddenInput] [BindProperty(SupportsGet = true)] public string ProviderKey { get; set; } - + [HiddenInput] - [BindProperty(SupportsGet = true)] + [BindProperty(SupportsGet = true)] public string ProviderKeyDisplayName { get; set; } [BindProperty] @@ -85,6 +85,12 @@ public class FeatureManagementModal : AbpPageModel return NoContent(); } + public bool IsDisabled(FeatureDto featureDto) + { + return featureDto.Provider.Name != ProviderName && + featureDto.Provider.Name != DefaultValueFeatureValueProvider.ProviderName; + } + public class FeatureGroupViewModel { public List Features { get; set; } diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/feature-management-modal.css b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/feature-management-modal.css index 615db50fb4..bcd176ce51 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/feature-management-modal.css +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/feature-management-modal.css @@ -5,4 +5,16 @@ .custom-scroll-container > .col-md-4 { max-height: 500px; -} \ No newline at end of file +} + +.disabled-container { + pointer-events: none; + opacity: 0.5; +} + +.disabled-container input, +.disabled-container select, +.disabled-container button { + background-color: #e9ecef; + color: #6c757d; +} diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManager.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManager.cs index ddf451154d..f0c9df17fd 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManager.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManager.cs @@ -136,7 +136,7 @@ public class SettingManager : ISettingManager, ISingletonDependency if (providers.Count > 1 && !forceToSet && setting.IsInherited && value != null) { var fallbackValue = await GetOrNullInternalAsync(name, providers[1].Name, null); - if (fallbackValue == value) + if (fallbackValue.Equals(value, StringComparison.OrdinalIgnoreCase)) { //Clear the value if it's same as it's fallback value value = null; From 36cb1f54cebb0a72b1b4aebd773af4b00fd70551 Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 11 Apr 2025 18:15:12 +0800 Subject: [PATCH 07/31] Update FeatureManagementModal.cshtml.cs --- .../Pages/FeatureManagement/FeatureManagementModal.cshtml.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs index edebca2fa0..4d20c41602 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs @@ -87,8 +87,7 @@ public class FeatureManagementModal : AbpPageModel public bool IsDisabled(FeatureDto featureDto) { - return featureDto.Provider.Name != ProviderName && - featureDto.Provider.Name != DefaultValueFeatureValueProvider.ProviderName; + return featureDto.Provider.Name != ProviderName && featureDto.Provider.Name != DefaultValueFeatureValueProvider.ProviderName; } public class FeatureGroupViewModel From 51c85c98672c981fc25a370496f5ec1a320424c5 Mon Sep 17 00:00:00 2001 From: sumeyye Date: Fri, 11 Apr 2025 14:06:41 +0300 Subject: [PATCH 08/31] add: `LazyTranslatePipe` for theme basic --- .../theme-basic/src/lib/pipes/index.ts | 1 + .../src/lib/pipes/lazy-translate.pipe.ts | 20 +++++++++++++++++++ .../theme-basic/src/lib/theme-basic.module.ts | 2 ++ .../packages/theme-basic/src/public-api.ts | 1 + 4 files changed, 24 insertions(+) create mode 100644 npm/ng-packs/packages/theme-basic/src/lib/pipes/index.ts create mode 100644 npm/ng-packs/packages/theme-basic/src/lib/pipes/lazy-translate.pipe.ts diff --git a/npm/ng-packs/packages/theme-basic/src/lib/pipes/index.ts b/npm/ng-packs/packages/theme-basic/src/lib/pipes/index.ts new file mode 100644 index 0000000000..0bde64d742 --- /dev/null +++ b/npm/ng-packs/packages/theme-basic/src/lib/pipes/index.ts @@ -0,0 +1 @@ +export * from './lazy-translate.pipe'; diff --git a/npm/ng-packs/packages/theme-basic/src/lib/pipes/lazy-translate.pipe.ts b/npm/ng-packs/packages/theme-basic/src/lib/pipes/lazy-translate.pipe.ts new file mode 100644 index 0000000000..d7b36a0c32 --- /dev/null +++ b/npm/ng-packs/packages/theme-basic/src/lib/pipes/lazy-translate.pipe.ts @@ -0,0 +1,20 @@ +import { LocalizationService, ConfigStateService } from '@abp/ng.core'; +import { inject, Pipe, PipeTransform } from '@angular/core'; +import { Observable, filter, take, switchMap, shareReplay } from 'rxjs'; + +@Pipe({ + name: 'abpLazyTranslate', +}) +export class LazyTranslatePipe implements PipeTransform { + private localizationService = inject(LocalizationService); + private configStateService = inject(ConfigStateService); + + transform(key: string): Observable { + return this.configStateService.getAll$().pipe( + filter(config => !!config.localization), + take(1), + switchMap(() => this.localizationService.get(key)), + shareReplay({ bufferSize: 1, refCount: true }), + ); + } +} diff --git a/npm/ng-packs/packages/theme-basic/src/lib/theme-basic.module.ts b/npm/ng-packs/packages/theme-basic/src/lib/theme-basic.module.ts index d959509dfd..d68d112ac5 100644 --- a/npm/ng-packs/packages/theme-basic/src/lib/theme-basic.module.ts +++ b/npm/ng-packs/packages/theme-basic/src/lib/theme-basic.module.ts @@ -16,6 +16,7 @@ import { PageAlertContainerComponent } from './components/page-alert-container/p import { RoutesComponent } from './components/routes/routes.component'; import { ValidationErrorComponent } from './components/validation-error/validation-error.component'; import { provideThemeBasicConfig } from './providers'; +import { LazyTranslatePipe } from './pipes'; export const LAYOUTS = [ApplicationLayoutComponent, AccountLayoutComponent, EmptyLayoutComponent]; @@ -48,6 +49,7 @@ export const LAYOUTS = [ApplicationLayoutComponent, AccountLayoutComponent, Empt NgbCollapseModule, NgbDropdownModule, NgxValidateCoreModule, + LazyTranslatePipe, ], }) export class BaseThemeBasicModule {} diff --git a/npm/ng-packs/packages/theme-basic/src/public-api.ts b/npm/ng-packs/packages/theme-basic/src/public-api.ts index 5c607ca06d..ec57cc892e 100644 --- a/npm/ng-packs/packages/theme-basic/src/public-api.ts +++ b/npm/ng-packs/packages/theme-basic/src/public-api.ts @@ -6,6 +6,7 @@ export * from './lib/components'; export * from './lib/enums'; export * from './lib/handlers'; export * from './lib/models'; +export * from './lib/pipes'; export * from './lib/providers'; export * from './lib/theme-basic.module'; export * from './lib/tokens'; From 3065b5d2da2cf6daf811f75690d6f4b31ddf0aa6 Mon Sep 17 00:00:00 2001 From: sumeyye Date: Fri, 11 Apr 2025 14:07:59 +0300 Subject: [PATCH 09/31] update: refactor routes component --- .../lib/components/routes/routes.component.html | 15 ++++++--------- .../src/lib/components/routes/routes.component.ts | 9 ++++----- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/npm/ng-packs/packages/theme-basic/src/lib/components/routes/routes.component.html b/npm/ng-packs/packages/theme-basic/src/lib/components/routes/routes.component.html index e537c26f34..77e190957f 100644 --- a/npm/ng-packs/packages/theme-basic/src/lib/components/routes/routes.component.html +++ b/npm/ng-packs/packages/theme-basic/src/lib/components/routes/routes.component.html @@ -3,8 +3,7 @@ - + /> } @@ -13,7 +12,7 @@ @if (route.iconClass) { } - {{ route.name | abpLocalization }} + {{ route.name | abpLazyTranslate | async }} @@ -40,7 +39,7 @@ @if (route.iconClass) { } - {{ route.name | abpLocalization }} + {{ route.name | abpLazyTranslate | async }}
- +
} @@ -61,7 +58,7 @@ + /> } @@ -105,7 +102,7 @@ class="dropdown-menu dropdown-menu-start border-0 shadow-sm" [class.d-block]="smallScreen && dropdownSubmenu.isOpen()" > - +
diff --git a/npm/ng-packs/packages/theme-basic/src/lib/components/routes/routes.component.ts b/npm/ng-packs/packages/theme-basic/src/lib/components/routes/routes.component.ts index dfdca734a6..dc6b797446 100644 --- a/npm/ng-packs/packages/theme-basic/src/lib/components/routes/routes.component.ts +++ b/npm/ng-packs/packages/theme-basic/src/lib/components/routes/routes.component.ts @@ -2,6 +2,7 @@ import { ABP, RoutesService, TreeNode } from '@abp/ng.core'; import { Component, ElementRef, + inject, Input, QueryList, Renderer2, @@ -15,6 +16,9 @@ import { templateUrl: 'routes.component.html', }) export class RoutesComponent { + public readonly routesService = inject(RoutesService); + protected renderer = inject(Renderer2); + @Input() smallScreen?: boolean; @ViewChildren('childrenContainer') childrenContainers!: QueryList>; @@ -23,11 +27,6 @@ export class RoutesComponent { trackByFn: TrackByFunction> = (_, item) => item.name; - constructor( - public readonly routesService: RoutesService, - protected renderer: Renderer2, - ) {} - isDropdown(node: TreeNode) { return !node?.isLeaf || this.routesService.hasChildren(node.name); } From c0b68f53ff105fe168155652dfd6b54128c8bb41 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Fri, 11 Apr 2025 15:19:41 +0300 Subject: [PATCH 10/31] fix build errors --- .../Abp/Cli/ProjectModification/NpmPackagesUpdater.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs index 11da78b6b7..d543b43d65 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs @@ -167,7 +167,7 @@ public class NpmPackagesUpdater : ITransientDependency bool includePreRc = false) { var packagesUpdated = false; - var fileContent = await File.ReadAllTextAsync(filePath); + var fileContent = File.ReadAllText(filePath); var packageJson = JObject.Parse(fileContent); var abpPackages = GetAbpPackagesFromPackageJson(packageJson); @@ -189,8 +189,8 @@ public class NpmPackagesUpdater : ITransientDependency var updatedContent = packageJson.ToString(Formatting.Indented); - await File.WriteAllTextAsync(filePath, updatedContent); - + File.WriteAllText(filePath, updatedContent); + return packagesUpdated; } @@ -210,7 +210,7 @@ public class NpmPackagesUpdater : ITransientDependency if (!specifiedVersion.IsNullOrWhiteSpace()) { - if (package.Name.Contains("leptonx", StringComparison.InvariantCultureIgnoreCase) && !specifiedLeptonXVersion.IsNullOrWhiteSpace()) + if (package.Name.IndexOf("leptonx", StringComparison.InvariantCultureIgnoreCase) > 0 && !specifiedLeptonXVersion.IsNullOrWhiteSpace()) { if (!SpecifiedVersionExists(specifiedLeptonXVersion, package)) { From 022873f85917212f47e7697f28efe4300a9f1fa2 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Sat, 12 Apr 2025 14:34:14 +0800 Subject: [PATCH 11/31] Enhance permission modal to align all UI --- .../Components/PermissionManagementModal.razor | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor/Components/PermissionManagementModal.razor b/modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor/Components/PermissionManagementModal.razor index 87c2c0db91..49dfdb24c6 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor/Components/PermissionManagementModal.razor +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor/Components/PermissionManagementModal.razor @@ -37,7 +37,12 @@ @if (_groups != null && _groups.Any()) {
- + @foreach (var group in _groups) { From 6991515d6d2dde457e24e2d5d9c55cf49e916e3a Mon Sep 17 00:00:00 2001 From: maliming Date: Sat, 12 Apr 2025 15:09:38 +0800 Subject: [PATCH 12/31] Refactor feature management modal to simplify disabled state handling and remove unused CSS styles --- .../FeatureManagementModal.cshtml | 78 +++++++++---------- .../feature-management-modal.css | 15 +--- 2 files changed, 38 insertions(+), 55 deletions(-) diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml index f8372a2ed8..9b8aeaef5c 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml @@ -51,21 +51,20 @@ @if (feature.ValueType is ToggleStringValueType) { -
- + - @if (feature.Description != null) - { -
@feature.Description
- } -
+ @if (feature.Description != null) + { +
@feature.Description
+ } } @if (feature.ValueType is FreeTextStringValueType) @@ -75,45 +74,42 @@ { type = "number"; } -
- - @if (feature.Description != null) - { -
@feature.Description
- } -
+ group-style="margin-inline-start: @(feature.Depth * 25)px"/> + @if (feature.Description != null) + { +
@feature.Description
+ } } @if (feature.ValueType is SelectionStringValueType selectType) { -
-
- - - + @foreach (var item in selectType.ItemSource.Items) + { + if (item.Value == feature.Value) { - if (item.Value == feature.Value) - { - - } - else - { - - } + + } + else + { + } - - @if (feature.Description != null) - { -
@feature.Description
} -
+ + @if (feature.Description != null) + { +
@feature.Description
+ }
} diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/feature-management-modal.css b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/feature-management-modal.css index bcd176ce51..091315b6d5 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/feature-management-modal.css +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/feature-management-modal.css @@ -2,19 +2,6 @@ max-height: 400px; } - .custom-scroll-container > .col-md-4 { max-height: 500px; -} - -.disabled-container { - pointer-events: none; - opacity: 0.5; -} - -.disabled-container input, -.disabled-container select, -.disabled-container button { - background-color: #e9ecef; - color: #6c757d; -} +} \ No newline at end of file From a4b730fb4efa1c909f2b85e26a8e4aec7b31cb51 Mon Sep 17 00:00:00 2001 From: maliming Date: Sat, 12 Apr 2025 15:19:29 +0800 Subject: [PATCH 13/31] Update feature management modal to filter features based on value presence and change BoolValue to nullable --- .../Pages/FeatureManagement/FeatureManagementModal.cshtml.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs index 4d20c41602..a96a0c0f88 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs @@ -69,7 +69,7 @@ public class FeatureManagementModal : AbpPageModel { var features = new UpdateFeaturesDto { - Features = FeatureGroups.SelectMany(g => g.Features).Select(f => new UpdateFeatureDto + Features = FeatureGroups.SelectMany(g => g.Features).Where(x => !x.Value.IsNullOrWhiteSpace() || x.BoolValue.HasValue).Select(f => new UpdateFeatureDto { Name = f.Name, Value = f.Type == nameof(ToggleStringValueType) ? f.BoolValue.ToString() : f.Value @@ -101,7 +101,7 @@ public class FeatureManagementModal : AbpPageModel public string Value { get; set; } - public bool BoolValue { get; set; } + public bool? BoolValue { get; set; } public string Type { get; set; } } From 7304a0555b335170cb48ac5eb7b02fa538fd86ec Mon Sep 17 00:00:00 2001 From: maliming Date: Sat, 12 Apr 2025 16:44:55 +0800 Subject: [PATCH 14/31] Refactor feature management modal to improve disabled state handling and update feature selection logic --- .../FeatureManagementModal.cshtml | 63 ++++++++----------- .../FeatureManagementModal.cshtml.cs | 6 +- 2 files changed, 30 insertions(+), 39 deletions(-) diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml index 9b8aeaef5c..b6782249ab 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml @@ -45,23 +45,23 @@ @for (var j = 0; j < featureGroup.Features.Count; j++) { var feature = featureGroup.Features[j]; + var disabled = Model.IsDisabled(feature);
+ - @if (feature.ValueType is ToggleStringValueType) { - - - @if (feature.Description != null) + + if (feature.Description != null) {
@feature.Description
} @@ -69,20 +69,16 @@ @if (feature.ValueType is FreeTextStringValueType) { - var type = "text"; - if(feature.ValueType.Validator is NumericValueValidator) - { - type = "number"; - } - - @if (feature.Description != null) + var type = feature.ValueType.Validator is NumericValueValidator ? "number" : "text"; + + if (feature.Description != null) {
@feature.Description
} @@ -90,20 +86,13 @@ @if (feature.ValueType is SelectionStringValueType selectType) { - var disabled = Model.IsDisabled(feature) ? "disabled" : "";
- @foreach (var item in selectType.ItemSource.Items) { - if (item.Value == feature.Value) - { - - } - else - { - - } + var selected = item.Value == feature.Value ? "selected=\"selected\"" : ""; + @CreateHtmlLocalizer(item.DisplayText.ResourceName).GetString(item.DisplayText.Name) } @if (feature.Description != null) @@ -112,8 +101,8 @@ }
} - +
}
diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs index a96a0c0f88..a9366da30e 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs @@ -69,7 +69,7 @@ public class FeatureManagementModal : AbpPageModel { var features = new UpdateFeaturesDto { - Features = FeatureGroups.SelectMany(g => g.Features).Where(x => !x.Value.IsNullOrWhiteSpace() || x.BoolValue.HasValue).Select(f => new UpdateFeatureDto + Features = FeatureGroups.SelectMany(g => g.Features).Where(x => !x.IsDisabled).Select(f => new UpdateFeatureDto { Name = f.Name, Value = f.Type == nameof(ToggleStringValueType) ? f.BoolValue.ToString() : f.Value @@ -97,11 +97,13 @@ public class FeatureManagementModal : AbpPageModel public class FeatureViewModel { + public bool IsDisabled { get; set; } + public string Name { get; set; } public string Value { get; set; } - public bool? BoolValue { get; set; } + public bool BoolValue { get; set; } public string Type { get; set; } } From 102de58ac3229844f6e967637bb4bbd183cd2e5f Mon Sep 17 00:00:00 2001 From: maliming Date: Sat, 12 Apr 2025 17:10:28 +0800 Subject: [PATCH 15/31] Refactor comparison logic in FeatureManager and SettingManager to use string.Equals for fallback value checks --- .../Volo/Abp/FeatureManagement/FeatureManager.cs | 2 +- .../Volo/Abp/SettingManagement/SettingManager.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManager.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManager.cs index 7227d8d82d..c105779546 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManager.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManager.cs @@ -152,7 +152,7 @@ public class FeatureManager : IFeatureManager, ISingletonDependency await using (await providers[0].HandleContextAsync(providerName, providerKey)) { var fallbackValue = await GetOrNullInternalAsync(name, providers[1].Name, null); - if (fallbackValue.Value.Equals(value, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(fallbackValue.Value, value, StringComparison.OrdinalIgnoreCase)) { //Clear the value if it's same as it's fallback value value = null; diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManager.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManager.cs index f0c9df17fd..b3fd120f38 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManager.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManager.cs @@ -136,7 +136,7 @@ public class SettingManager : ISettingManager, ISingletonDependency if (providers.Count > 1 && !forceToSet && setting.IsInherited && value != null) { var fallbackValue = await GetOrNullInternalAsync(name, providers[1].Name, null); - if (fallbackValue.Equals(value, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(fallbackValue, value, StringComparison.OrdinalIgnoreCase)) { //Clear the value if it's same as it's fallback value value = null; From 38f5b912635ab7fc01690793b8be9b5c2b545b2a Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Sat, 12 Apr 2025 19:47:43 +0800 Subject: [PATCH 16/31] Hide dropdown menu when datatable scrolling horizontally --- .../datatables/datatables-styles.css | 5 +++++ .../datatables/datatables-styles.min.css | 2 +- .../datatables/datatables-styles.scss | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.css b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.css index 08bdc5d283..de679b468a 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.css +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.css @@ -10,3 +10,8 @@ .dataTable tbody tr td div.dropdown ul.dropdown-menu li { cursor: pointer; } + +.abp-action-button ui.dropdown-menu[data-popper-reference-hidden]{ + visibility: hidden; + pointer-events: none; +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.min.css b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.min.css index ffc3d272a3..cd5ab5591b 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.min.css +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.min.css @@ -1 +1 @@ -.dataTable{width:100% !important;border-spacing:0 !important;}.table td,.table th{padding:8px 10px;}.dataTable tbody tr td button{cursor:pointer;}.dataTable tbody tr td div.dropdown ul.dropdown-menu li{cursor:pointer;} +.dataTable{width:100%!important;border-spacing:0!important}.table td,.table th{padding:8px 10px}.dataTable tbody tr td button{cursor:pointer}.dataTable tbody tr td div.dropdown ul.dropdown-menu li{cursor:pointer}.abp-action-button ui.dropdown-menu[data-popper-reference-hidden]{visibility:hidden;pointer-events:none} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.scss b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.scss index 0ca0771faf..d2498b3cc7 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.scss +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.scss @@ -27,3 +27,10 @@ } } } + +.abp-action-button { + ui.dropdown-menu[data-popper-reference-hidden] { + visibility: hidden; + pointer-events: none; + } +} \ No newline at end of file From 803c04730a470e6e4aec46b66c500d73a84f82db Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Sun, 13 Apr 2025 18:14:51 +0800 Subject: [PATCH 17/31] Sort ABP CLI commands in HelpCommand --- .../src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs index 9fb647806b..cc13e9d187 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs @@ -68,7 +68,7 @@ public class HelpCommand : IConsoleCommand, ITransientDependency sb.AppendLine("Command List:"); sb.AppendLine(""); - foreach (var command in AbpCliOptions.Commands.ToArray().Where(NotHiddenFromCommandList)) + foreach (var command in AbpCliOptions.Commands.ToArray().Where(NotHiddenFromCommandList).OrderBy(x => x.Key)) { var method = command.Value.GetMethod("GetShortDescription", BindingFlags.Static | BindingFlags.Public); if (method == null) From 7df23740f76fd9e5641d4e921cbaaaaddce00912 Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 14 Apr 2025 13:54:08 +0800 Subject: [PATCH 18/31] Make basic demo apps works. --- .../Program.cs | 37 ++++++++++--------- .../Properties/launchSettings.json | 21 ++--------- .../Startup.cs | 18 --------- ...bp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj | 4 +- .../AbpAspNetCoreMvcUiThemeBasicDemoModule.cs | 2 +- .../Program.cs | 32 ++++++++-------- .../Properties/launchSettings.json | 17 +-------- .../Startup.cs | 18 --------- 8 files changed, 43 insertions(+), 106 deletions(-) delete mode 100644 modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Startup.cs delete mode 100644 modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Startup.cs diff --git a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Program.cs b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Program.cs index ad3a39c746..ac9601cda3 100644 --- a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Program.cs +++ b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Program.cs @@ -1,31 +1,42 @@ using System; -using System.IO; -using Microsoft.AspNetCore.Hosting; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Serilog; -using Serilog.Events; namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo; public class Program { - public static int Main(string[] args) + public async static Task Main(string[] args) { Log.Logger = new LoggerConfiguration() - .MinimumLevel.Debug() //TODO: Should be configurable! - .MinimumLevel.Override("Microsoft", LogEventLevel.Information) + .MinimumLevel.Debug() .Enrich.FromLogContext() - .WriteTo.File("Logs/logs.txt") + .WriteTo.Async(c => c.Console()) .CreateLogger(); try { Log.Information("Starting web host."); - CreateHostBuilder(args).Build().Run(); + var builder = WebApplication.CreateBuilder(args); + builder.Host.AddAppSettingsSecretsJson() + .UseAutofac() + .UseSerilog(); + await builder.AddApplicationAsync(); + var app = builder.Build(); + await app.InitializeApplicationAsync(); + await app.RunAsync(); return 0; } catch (Exception ex) { + if (ex is HostAbortedException) + { + throw; + } + Log.Fatal(ex, "Host terminated unexpectedly!"); return 1; } @@ -34,14 +45,4 @@ public class Program Log.CloseAndFlush(); } } - - - internal static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureWebHostDefaults(webBuilder => - { - webBuilder.UseStartup(); - }) - .UseAutofac() - .UseSerilog(); } diff --git a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Properties/launchSettings.json b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Properties/launchSettings.json index 07a310a660..7ad9d24119 100644 --- a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Properties/launchSettings.json +++ b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Properties/launchSettings.json @@ -1,27 +1,12 @@ { - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:51339", - "sslPort": 0 - } - }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "Volo.AbpIo.Commercial.Web": { + "Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo": { "commandName": "Project", "launchBrowser": true, - "applicationUrl": "http://localhost:5000", + "applicationUrl": "https://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } } } -} \ No newline at end of file +} diff --git a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Startup.cs b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Startup.cs deleted file mode 100644 index 838cf43402..0000000000 --- a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Startup.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; - -namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo; - -public class Startup -{ - public void ConfigureServices(IServiceCollection services) - { - services.AddApplication(); - } - - public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) - { - app.InitializeApplication(); - } -} diff --git a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj index f8202b97ec..9aa8142fda 100644 --- a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj +++ b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj @@ -10,7 +10,7 @@ - + @@ -23,5 +23,5 @@ Always - + diff --git a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/AbpAspNetCoreMvcUiThemeBasicDemoModule.cs b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/AbpAspNetCoreMvcUiThemeBasicDemoModule.cs index 4ebeb18498..c887825b2b 100644 --- a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/AbpAspNetCoreMvcUiThemeBasicDemoModule.cs +++ b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/AbpAspNetCoreMvcUiThemeBasicDemoModule.cs @@ -55,8 +55,8 @@ public class AbpAspNetCoreMvcUiThemeBasicDemoModule : AbpModule app.UseDeveloperExceptionPage(); } - app.MapAbpStaticAssets(); app.UseRouting(); + app.MapAbpStaticAssets(); app.UseConfiguredEndpoints(); } } diff --git a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Program.cs b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Program.cs index a27f797715..d2ca3053b8 100644 --- a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Program.cs +++ b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Program.cs @@ -1,30 +1,42 @@ using System; -using Microsoft.AspNetCore.Hosting; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Serilog; -using Serilog.Events; namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo; public class Program { - public static int Main(string[] args) + public async static Task Main(string[] args) { Log.Logger = new LoggerConfiguration() .MinimumLevel.Debug() .Enrich.FromLogContext() - .WriteTo.Async(c => c.File("Logs/logs.txt")) .WriteTo.Async(c => c.Console()) .CreateLogger(); try { Log.Information("Starting web host."); - CreateHostBuilder(args).Build().Run(); + var builder = WebApplication.CreateBuilder(args); + builder.Host.AddAppSettingsSecretsJson() + .UseAutofac() + .UseSerilog(); + await builder.AddApplicationAsync(); + var app = builder.Build(); + await app.InitializeApplicationAsync(); + await app.RunAsync(); return 0; } catch (Exception ex) { + if (ex is HostAbortedException) + { + throw; + } + Log.Fatal(ex, "Host terminated unexpectedly!"); return 1; } @@ -33,14 +45,4 @@ public class Program Log.CloseAndFlush(); } } - - - internal static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureWebHostDefaults(webBuilder => - { - webBuilder.UseStartup(); - }) - .UseAutofac() - .UseSerilog(); } diff --git a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Properties/launchSettings.json b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Properties/launchSettings.json index 9bee4298ff..4ae3999794 100644 --- a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Properties/launchSettings.json +++ b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Properties/launchSettings.json @@ -1,24 +1,9 @@ { - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:61659", - "sslPort": 0 - } - }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, "Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo": { "commandName": "Project", "launchBrowser": true, - "applicationUrl": "http://localhost:5000", + "applicationUrl": "https://localhost:5001", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Startup.cs b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Startup.cs deleted file mode 100644 index a11ca855da..0000000000 --- a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Startup.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; - -namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo; - -public class Startup -{ - public void ConfigureServices(IServiceCollection services) - { - services.AddApplication(); - } - - public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) - { - app.InitializeApplication(); - } -} From d3e35cea97798bf8187b685e006c71d655fb7402 Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 14 Apr 2025 18:17:35 +0800 Subject: [PATCH 19/31] Upgrade MongoDB.Driver to 3.3.0 and add `AbpCustomGuidMapper`. --- Directory.Packages.props | 2 +- .../Volo/Abp/MongoDB/AbpCustomGuidMapper.cs | 13 +++++++++++++ .../Volo/Abp/MongoDB/AbpMongoDbModule.cs | 11 ++++++++--- .../MongoDB/Repositories/Repository_Basic_Tests.cs | 7 +++++-- 4 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpCustomGuidMapper.cs diff --git a/Directory.Packages.props b/Directory.Packages.props index 65e51cbf91..4532f427a9 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -119,7 +119,7 @@ - + diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpCustomGuidMapper.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpCustomGuidMapper.cs new file mode 100644 index 0000000000..58ef742a3d --- /dev/null +++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpCustomGuidMapper.cs @@ -0,0 +1,13 @@ +using System; +using MongoDB.Bson; + +namespace Volo.Abp.MongoDB; + +public class AbpCustomGuidMapper : ICustomBsonTypeMapper +{ + public bool TryMapToBsonValue(object value, out BsonValue bsonValue) + { + bsonValue = new BsonBinaryData((Guid)value, GuidRepresentation.Standard); + return true; + } +} diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpMongoDbModule.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpMongoDbModule.cs index 8e8ad345fc..7563a062f2 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpMongoDbModule.cs +++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpMongoDbModule.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.DependencyInjection; +using System; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using MongoDB.Bson; using MongoDB.Bson.Serialization; @@ -16,6 +17,12 @@ namespace Volo.Abp.MongoDB; [DependsOn(typeof(AbpDddDomainModule))] public class AbpMongoDbModule : AbpModule { + static AbpMongoDbModule() + { + BsonSerializer.TryRegisterSerializer(new GuidSerializer(GuidRepresentation.Standard)); + BsonTypeMapper.RegisterCustomTypeMapper(typeof(Guid), new AbpCustomGuidMapper()); + } + public override void PreConfigureServices(ServiceConfigurationContext context) { context.Services.AddConventionalRegistrar(new AbpMongoDbConventionalRegistrar()); @@ -23,8 +30,6 @@ public class AbpMongoDbModule : AbpModule public override void ConfigureServices(ServiceConfigurationContext context) { - BsonSerializer.TryRegisterSerializer(new GuidSerializer(GuidRepresentation.Standard)); - context.Services.TryAddTransient( typeof(IMongoDbContextProvider<>), typeof(UnitOfWorkMongoDbContextProvider<>) diff --git a/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs b/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs index e2ad9088cb..ca434e989f 100644 --- a/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs +++ b/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Threading.Tasks; using MongoDB.Driver.Linq; using Shouldly; +using Volo.Abp.Data; using Volo.Abp.Domain.Repositories; using Volo.Abp.TestApp; using Volo.Abp.TestApp.Domain; @@ -56,6 +57,7 @@ public class Repository_Basic_Tests : Repository_Basic_Tests p.PersonId == person.Id && p.Number == "1234567890").ShouldBeTrue(); + person.GetProperty("test-guid-property").ShouldBe(person.Id); } - + [Fact] public async Task Filter_Case_Insensitive() { (await CityRepository.GetQueryableAsync()).FirstOrDefault(c => c.Name == "ISTANBUL").ShouldBeNull(); (await CityRepository.GetQueryableAsync()).FirstOrDefault(c => c.Name == "istanbul").ShouldBeNull(); (await CityRepository.GetQueryableAsync()).FirstOrDefault(c => c.Name == "Istanbul").ShouldNotBeNull(); - + (await PersonRepository.GetQueryableAsync()).FirstOrDefault(p => p.Name == "douglas").ShouldNotBeNull(); (await PersonRepository.GetQueryableAsync()).FirstOrDefault(p => p.Name == "DOUGLAS").ShouldNotBeNull(); (await PersonRepository.GetQueryableAsync()).FirstOrDefault(p => p.Name == "Douglas").ShouldNotBeNull(); From 507aee72af291ccb4f96e5fe269fe11d71aa5450 Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 14 Apr 2025 20:30:40 +0800 Subject: [PATCH 20/31] Refactor InsertAsync test to include nullable GUID property validation --- .../Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs b/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs index ca434e989f..3df8699f6d 100644 --- a/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs +++ b/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs @@ -53,11 +53,12 @@ public class Repository_Basic_Tests : Repository_Basic_Tests p.PersonId == person.Id && p.Number == "1234567890").ShouldBeTrue(); person.GetProperty("test-guid-property").ShouldBe(person.Id); + person.GetProperty("test-nullable-guid-property").ShouldBe(person.Id); } [Fact] From f229f807d83da0ad017e7eaa92e267a32ed205a1 Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 14 Apr 2025 20:35:38 +0800 Subject: [PATCH 21/31] Rename AbpCustomGuidMapper to AbpGuidCustomBsonTypeMapper for consistency --- .../Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpCustomGuidMapper.cs | 2 +- .../src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpMongoDbModule.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpCustomGuidMapper.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpCustomGuidMapper.cs index 58ef742a3d..4cfacc39fd 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpCustomGuidMapper.cs +++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpCustomGuidMapper.cs @@ -3,7 +3,7 @@ using MongoDB.Bson; namespace Volo.Abp.MongoDB; -public class AbpCustomGuidMapper : ICustomBsonTypeMapper +public class AbpGuidCustomBsonTypeMapper : ICustomBsonTypeMapper { public bool TryMapToBsonValue(object value, out BsonValue bsonValue) { diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpMongoDbModule.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpMongoDbModule.cs index 7563a062f2..195491d989 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpMongoDbModule.cs +++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpMongoDbModule.cs @@ -20,7 +20,7 @@ public class AbpMongoDbModule : AbpModule static AbpMongoDbModule() { BsonSerializer.TryRegisterSerializer(new GuidSerializer(GuidRepresentation.Standard)); - BsonTypeMapper.RegisterCustomTypeMapper(typeof(Guid), new AbpCustomGuidMapper()); + BsonTypeMapper.RegisterCustomTypeMapper(typeof(Guid), new AbpGuidCustomBsonTypeMapper()); } public override void PreConfigureServices(ServiceConfigurationContext context) From f794ff4543b12eb8d9bfef4137bf95e672b7c974 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Tue, 15 Apr 2025 00:46:58 +0800 Subject: [PATCH 22/31] Enhance css styles --- .../Components/PermissionManagementModal.razor | 10 ++++------ .../PermissionManagementModal.razor.cs | 2 +- .../PermissionManagementModal.razor.css | 17 +++++++++++++---- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor/Components/PermissionManagementModal.razor b/modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor/Components/PermissionManagementModal.razor index 49dfdb24c6..7992764c00 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor/Components/PermissionManagementModal.razor +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor/Components/PermissionManagementModal.razor @@ -49,15 +49,13 @@ @if (group.Permissions.Any(x => x.IsGranted)) { - - @group.DisplayName ( @(group.Permissions.Count(x => x.IsGranted)) ) - + @group.DisplayName (@(group.Permissions.Count(x => x.IsGranted))) } else { - - @group.DisplayName ( @(group.Permissions.Count(x => x.IsGranted)) ) - + + @group.DisplayName (@(group.Permissions.Count(x => x.IsGranted))) + } } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor/Components/PermissionManagementModal.razor.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor/Components/PermissionManagementModal.razor.cs index d2c2e092d5..cd3be870a1 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor/Components/PermissionManagementModal.razor.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor/Components/PermissionManagementModal.razor.cs @@ -58,7 +58,7 @@ public partial class PermissionManagementModal var result = await PermissionAppService.GetAsync(_providerName, _providerKey); _entityDisplayName = entityDisplayName ?? result.EntityDisplayName; - _allGroups = result.Groups; + _allGroups = result.Groups.OrderBy(x => x.DisplayName).ToList(); _groups = _allGroups.ToList(); NormalizePermissionGroup(); diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor/Components/PermissionManagementModal.razor.css b/modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor/Components/PermissionManagementModal.razor.css index f6870a7a16..a0b6579faf 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor/Components/PermissionManagementModal.razor.css +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor/Components/PermissionManagementModal.razor.css @@ -15,7 +15,7 @@ fieldset legend { } ::deep .lpx-scroll-pills-container ul li { - border: 1px solid #e8eef3; + border: 1px solid var(--lpx-border-color); margin-bottom: 10px; border-radius: 10px; } @@ -26,6 +26,15 @@ fieldset legend { background-color: #6c5dd3 !important; } -::deep .lpx-theme-dark .lpx-scroll-pills-container ul li { - border: 1px solid #23262a; -} \ No newline at end of file +::deep .nav-pills .nav-link { + background: none; + border: 0; + border-radius: var(--bs-nav-pills-border-radius); +} + +::deep .nav-pills .nav-link:disabled { + color: var(--bs-nav-link-disabled-color); + background-color: transparent; + border-color: transparent; +} + From dae6124592c9a2f839668fc9833e096cd7438e12 Mon Sep 17 00:00:00 2001 From: maliming Date: Tue, 15 Apr 2025 08:41:27 +0800 Subject: [PATCH 23/31] Rename AbpCustomGuidMapper.cs to AbpGuidCustomBsonTypeMapper.cs --- .../{AbpCustomGuidMapper.cs => AbpGuidCustomBsonTypeMapper.cs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/{AbpCustomGuidMapper.cs => AbpGuidCustomBsonTypeMapper.cs} (100%) diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpCustomGuidMapper.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpGuidCustomBsonTypeMapper.cs similarity index 100% rename from framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpCustomGuidMapper.cs rename to framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpGuidCustomBsonTypeMapper.cs From 3f098f2dfc4e144b846b1b500fa9e9e7240deac1 Mon Sep 17 00:00:00 2001 From: maliming Date: Tue, 15 Apr 2025 11:19:34 +0800 Subject: [PATCH 24/31] Update obsolete attribute message for UseAbpClaimsMap method --- .../AspNetCore/Builder/AbpApplicationBuilderExtensions.cs | 2 +- .../Abp/AspNetCore/Security/Claims/AbpClaimsMapMiddleware.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs index d042bb6026..b9142b5aed 100644 --- a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs @@ -115,7 +115,7 @@ public static class AbpApplicationBuilderExtensions return app.UseMiddleware(); } - [Obsolete("Replace with AbpClaimsTransformation")] + [Obsolete("Use the TransformAbpClaims extension method from IServiceCollection instead.")] public static IApplicationBuilder UseAbpClaimsMap(this IApplicationBuilder app) { return app.UseMiddleware(); diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/Claims/AbpClaimsMapMiddleware.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/Claims/AbpClaimsMapMiddleware.cs index 2104edab0a..70fad0d19e 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/Claims/AbpClaimsMapMiddleware.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/Claims/AbpClaimsMapMiddleware.cs @@ -11,7 +11,7 @@ using Volo.Abp.Security.Claims; namespace Volo.Abp.AspNetCore.Security.Claims; -[Obsolete("Replace with AbpClaimsTransformation")] +[Obsolete("Use the TransformAbpClaims extension method from IServiceCollection instead.")] public class AbpClaimsMapMiddleware : AbpMiddlewareBase, ITransientDependency { public async override Task InvokeAsync(HttpContext context, RequestDelegate next) From 548d4d46d7200db0d7881d4c42837a54447b04c7 Mon Sep 17 00:00:00 2001 From: Masum ULU <49063256+masum-ulu@users.noreply.github.com> Date: Tue, 15 Apr 2025 11:47:28 +0300 Subject: [PATCH 25/31] Update angular.yml --- .github/workflows/angular.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/angular.yml b/.github/workflows/angular.yml index ee66fbcf2c..6b411d0726 100644 --- a/.github/workflows/angular.yml +++ b/.github/workflows/angular.yml @@ -27,7 +27,7 @@ jobs: with: fetch-depth: 0 - - uses: actions/cache@v2 + - uses: actions/cache@v4 with: path: 'npm/ng-packs/node_modules' key: ${{ runner.os }}-${{ hashFiles('npm/ng-packs/yarn.lock') }} From 4ecc7f616f6179c63e05a5e38705524555d77fbf Mon Sep 17 00:00:00 2001 From: Masum ULU <49063256+masum-ulu@users.noreply.github.com> Date: Tue, 15 Apr 2025 11:59:37 +0300 Subject: [PATCH 26/31] Update angular.yml --- .github/workflows/angular.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/angular.yml b/.github/workflows/angular.yml index 6b411d0726..cd48c0448a 100644 --- a/.github/workflows/angular.yml +++ b/.github/workflows/angular.yml @@ -32,7 +32,7 @@ jobs: path: 'npm/ng-packs/node_modules' key: ${{ runner.os }}-${{ hashFiles('npm/ng-packs/yarn.lock') }} - - uses: actions/cache@v2 + - uses: actions/cache@v4 with: path: 'templates/app/angular/node_modules' key: ${{ runner.os }}-${{ hashFiles('templates/app/angular/yarn.lock') }} From 5d1c9851e1cc56349d6520ef8839d9d65059ffb5 Mon Sep 17 00:00:00 2001 From: maliming Date: Wed, 16 Apr 2025 09:43:54 +0800 Subject: [PATCH 27/31] Set `PropertyNamingPolicy` to `null` to keep original property name and dictionary key. --- .../AbpSystemTextJsonSerializer.cs | 17 ++---- .../AbpNewtonsoftSerializerProviderTests.cs | 52 +++++++++++++++++++ ...pSystemTextJsonSerializerProvider_Tests.cs | 37 +++++++++++++ 3 files changed, 92 insertions(+), 14 deletions(-) create mode 100644 framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpNewtonsoftSerializerProviderTests.cs diff --git a/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonSerializer.cs b/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonSerializer.cs index 6f433ce918..7f72f0de71 100644 --- a/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonSerializer.cs +++ b/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonSerializer.cs @@ -40,21 +40,10 @@ public class AbpSystemTextJsonSerializer : IJsonSerializer, ITransientDependency camelCase, indented, Options.JsonSerializerOptions - }, _ => + }, _ => new JsonSerializerOptions(Options.JsonSerializerOptions) { - var settings = new JsonSerializerOptions(Options.JsonSerializerOptions); - - if (camelCase) - { - settings.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; - } - - if (indented) - { - settings.WriteIndented = true; - } - - return settings; + PropertyNamingPolicy = camelCase ? JsonNamingPolicy.CamelCase : null, + WriteIndented = indented }); } } diff --git a/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpNewtonsoftSerializerProviderTests.cs b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpNewtonsoftSerializerProviderTests.cs new file mode 100644 index 0000000000..74a639904d --- /dev/null +++ b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpNewtonsoftSerializerProviderTests.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Shouldly; +using Volo.Abp.Json.Newtonsoft; +using Xunit; + +namespace Volo.Abp.Json; + +public class AbpNewtonsoftSerializerProviderTests : AbpJsonNewtonsoftJsonTestBase +{ + protected AbpNewtonsoftJsonSerializer JsonSerializer; + + public AbpNewtonsoftSerializerProviderTests() + { + JsonSerializer = GetRequiredService(); + } + + public class File + { + public string FileName { get; set; } + + public Dictionary ExtraProperties { get; set; } + } + + [Fact] + public void Serialize_Deserialize_Test() + { + var defaultIndent = " "; // Default indent is 2 spaces + var newLine = Environment.NewLine; + var file = new File() + { + FileName = "abp", + ExtraProperties = new Dictionary() + { + { "One", 1 }, + { "Two", 2 } + } + }; + + var json = JsonSerializer.Serialize(file, camelCase: true); + json.ShouldBe("{\"fileName\":\"abp\",\"extraProperties\":{\"One\":1,\"Two\":2}}"); + + json = JsonSerializer.Serialize(file, camelCase: true, indented: true); + json.ShouldBe($"{{{newLine}{defaultIndent}\"fileName\": \"abp\",{newLine}{defaultIndent}\"extraProperties\": {{{newLine}{defaultIndent}{defaultIndent}\"One\": 1,{newLine}{defaultIndent}{defaultIndent}\"Two\": 2{newLine}{defaultIndent}}}{newLine}}}"); + + json = JsonSerializer.Serialize(file, camelCase: false); + json.ShouldBe("{\"FileName\":\"abp\",\"ExtraProperties\":{\"One\":1,\"Two\":2}}"); + + json = JsonSerializer.Serialize(file, camelCase: false, indented: true); + json.ShouldBe($"{{{newLine}{defaultIndent}\"FileName\": \"abp\",{newLine}{defaultIndent}\"ExtraProperties\": {{{newLine}{defaultIndent}{defaultIndent}\"One\": 1,{newLine}{defaultIndent}{defaultIndent}\"Two\": 2{newLine}{defaultIndent}}}{newLine}}}"); + } +} diff --git a/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpSystemTextJsonSerializerProvider_Tests.cs b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpSystemTextJsonSerializerProvider_Tests.cs index e32df85d7f..a492b7ad7c 100644 --- a/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpSystemTextJsonSerializerProvider_Tests.cs +++ b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpSystemTextJsonSerializerProvider_Tests.cs @@ -1,4 +1,6 @@ using System; +using System.Collections.Generic; +using System.Text.Json; using Microsoft.Extensions.DependencyInjection; using Shouldly; using Volo.Abp.Data; @@ -23,6 +25,13 @@ public abstract class AbpSystemTextJsonSerializerProviderTestBase : AbpJsonSyste public string Name { get; set; } } + public class File + { + public string FileName { get; set; } + + public Dictionary ExtraProperties { get; set; } + } + public class FileWithBoolean { public string Name { get; set; } @@ -74,6 +83,34 @@ public abstract class AbpSystemTextJsonSerializerProviderTestBase : AbpJsonSyste public class AbpSystemTextJsonSerializerProviderTests : AbpSystemTextJsonSerializerProviderTestBase { + [Fact] + public void Serialize_Deserialize_Test() + { + var defaultIndent = " "; // Default indent is 2 spaces + var newLine = Environment.NewLine; + var file = new File() + { + FileName = "abp", + ExtraProperties = new Dictionary() + { + { "One", 1 }, + { "Two", 2 } + } + }; + + var json = JsonSerializer.Serialize(file, camelCase: true); + json.ShouldBe("{\"fileName\":\"abp\",\"extraProperties\":{\"One\":1,\"Two\":2}}"); + + json = JsonSerializer.Serialize(file, camelCase: true, indented: true); + json.ShouldBe($"{{{newLine}{defaultIndent}\"fileName\": \"abp\",{newLine}{defaultIndent}\"extraProperties\": {{{newLine}{defaultIndent}{defaultIndent}\"One\": 1,{newLine}{defaultIndent}{defaultIndent}\"Two\": 2{newLine}{defaultIndent}}}{newLine}}}"); + + json = JsonSerializer.Serialize(file, camelCase: false); + json.ShouldBe("{\"FileName\":\"abp\",\"ExtraProperties\":{\"One\":1,\"Two\":2}}"); + + json = JsonSerializer.Serialize(file, camelCase: false, indented: true); + json.ShouldBe($"{{{newLine}{defaultIndent}\"FileName\": \"abp\",{newLine}{defaultIndent}\"ExtraProperties\": {{{newLine}{defaultIndent}{defaultIndent}\"One\": 1,{newLine}{defaultIndent}{defaultIndent}\"Two\": 2{newLine}{defaultIndent}}}{newLine}}}"); + } + [Fact] public void Serialize_Deserialize_With_Boolean() { From 391b16d240db9282de9030ad4f02a13cd419e38a Mon Sep 17 00:00:00 2001 From: maliming Date: Wed, 16 Apr 2025 10:59:24 +0800 Subject: [PATCH 28/31] Refactor feature display logic to use GetShownName method for improved clarity and consistency --- .../Components/FeatureManagementModal.razor | 8 ++++---- .../Components/FeatureManagementModal.razor.cs | 11 +++++++++-- .../FeatureManagement/FeatureManagementModal.cshtml | 6 +++--- .../FeatureManagementModal.cshtml.cs | 7 +++++++ 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor/Components/FeatureManagementModal.razor b/modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor/Components/FeatureManagementModal.razor index 7e00ecf3c3..321a4774b8 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor/Components/FeatureManagementModal.razor +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor/Components/FeatureManagementModal.razor @@ -35,12 +35,12 @@ {
@{ - var disabled = IsDisabled(feature.Provider.Name); + var disabled = IsDisabled(feature); if (feature.ValueType is FreeTextStringValueType) { - @feature.DisplayName + @GetShownName(feature) @@ -56,7 +56,7 @@ var items = ((SelectionStringValueType)feature.ValueType).ItemSource.Items; var selectedValue = SelectionStringValues[feature.Name]; - @feature.DisplayName + @GetShownName(feature) @foreach (var item in selectType.ItemSource.Items) { diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs index a9366da30e..39bb3ad4f0 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs @@ -90,6 +90,13 @@ public class FeatureManagementModal : AbpPageModel return featureDto.Provider.Name != ProviderName && featureDto.Provider.Name != DefaultValueFeatureValueProvider.ProviderName; } + public string GetShownName(FeatureDto featureDto) + { + return !IsDisabled(featureDto) + ? featureDto.DisplayName + : $"{featureDto.DisplayName} ({featureDto.Provider.Name})"; + } + public class FeatureGroupViewModel { public List Features { get; set; } From bb1a7df7cabae7c51eaf11e404e8f0e4b170fce7 Mon Sep 17 00:00:00 2001 From: maliming Date: Wed, 16 Apr 2025 13:04:10 +0800 Subject: [PATCH 29/31] Fix unit test. --- .../Abp/Json/AbpJsonSystemTextJsonTestBase.cs | 17 ++++++++++++++++- .../AbpNewtonsoftSerializerProviderTests.cs | 6 +++--- ...AbpSystemTextJsonSerializerProvider_Tests.cs | 10 ++++++++-- .../Json/InputAndOutputDateTimeFormat_Tests.cs | 5 +++++ 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpJsonSystemTextJsonTestBase.cs b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpJsonSystemTextJsonTestBase.cs index ebae706aca..e442ce48ad 100644 --- a/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpJsonSystemTextJsonTestBase.cs +++ b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpJsonSystemTextJsonTestBase.cs @@ -1,4 +1,9 @@ -using Volo.Abp.Testing; +using System; +using System.Collections.Concurrent; +using System.Reflection; +using Newtonsoft.Json; +using Volo.Abp.Json.Newtonsoft; +using Volo.Abp.Testing; namespace Volo.Abp.Json; @@ -12,6 +17,16 @@ public abstract class AbpJsonSystemTextJsonTestBase : AbpIntegratedTest { + protected AbpJsonNewtonsoftJsonTestBase() + { + var cache = typeof(AbpNewtonsoftJsonSerializer).GetField("JsonSerializerOptionsCache", BindingFlags.NonPublic | BindingFlags.Static); + if (cache != null) + { + var cacheValue = cache.GetValue(null)?.As>(); + cacheValue?.Clear(); + } + } + protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options) { options.UseAutofac(); diff --git a/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpNewtonsoftSerializerProviderTests.cs b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpNewtonsoftSerializerProviderTests.cs index 74a639904d..9dc0c0afd3 100644 --- a/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpNewtonsoftSerializerProviderTests.cs +++ b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpNewtonsoftSerializerProviderTests.cs @@ -1,18 +1,18 @@ using System; using System.Collections.Generic; using Shouldly; -using Volo.Abp.Json.Newtonsoft; using Xunit; namespace Volo.Abp.Json; +[Collection("AbpJsonNewtonsoftJsonTest")] public class AbpNewtonsoftSerializerProviderTests : AbpJsonNewtonsoftJsonTestBase { - protected AbpNewtonsoftJsonSerializer JsonSerializer; + protected IJsonSerializer JsonSerializer; public AbpNewtonsoftSerializerProviderTests() { - JsonSerializer = GetRequiredService(); + JsonSerializer = GetRequiredService(); } public class File diff --git a/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpSystemTextJsonSerializerProvider_Tests.cs b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpSystemTextJsonSerializerProvider_Tests.cs index a492b7ad7c..49b321d46d 100644 --- a/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpSystemTextJsonSerializerProvider_Tests.cs +++ b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpSystemTextJsonSerializerProvider_Tests.cs @@ -13,11 +13,11 @@ namespace Volo.Abp.Json; public abstract class AbpSystemTextJsonSerializerProviderTestBase : AbpJsonSystemTextJsonTestBase { - protected AbpSystemTextJsonSerializer JsonSerializer; + protected IJsonSerializer JsonSerializer; public AbpSystemTextJsonSerializerProviderTestBase() { - JsonSerializer = GetRequiredService(); + JsonSerializer = GetRequiredService(); } public class TestExtensibleObjectClass : ExtensibleObject @@ -260,6 +260,8 @@ public class AbpSystemTextJsonSerializerProviderDateTimeFormatTests : AbpSystemT options.InputDateTimeFormats.Add("yyyy*MM*dd"); options.OutputDateTimeFormat = "yyyy*MM*dd HH*mm*ss"; }); + + base.AfterAddApplication(services); } [Fact] @@ -326,6 +328,8 @@ public class AbpSystemTextJsonSerializerProviderDatetimeKindUtcTests : AbpSystem { Kind = DateTimeKind.Utc; services.Configure(x => x.Kind = Kind); + + base.AfterAddApplication(services); } } @@ -335,6 +339,8 @@ public class AbpSystemTextJsonSerializerProviderDatetimeKindLocalTests : AbpSyst { Kind = DateTimeKind.Local; services.Configure(x => x.Kind = Kind); + + base.AfterAddApplication(services); } } diff --git a/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/InputAndOutputDateTimeFormat_Tests.cs b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/InputAndOutputDateTimeFormat_Tests.cs index cf6356477d..189a82cae0 100644 --- a/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/InputAndOutputDateTimeFormat_Tests.cs +++ b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/InputAndOutputDateTimeFormat_Tests.cs @@ -31,6 +31,8 @@ public class InputAndOutputDateTimeFormatSystemTextJsonTests : AbpJsonSystemText { options.Kind = DateTimeKind.Utc; }); + + base.AfterAddApplication(services); } [Fact] @@ -59,6 +61,7 @@ public class InputAndOutputDateTimeFormatSystemTextJsonTests : AbpJsonSystemText } } +[Collection("AbpJsonNewtonsoftJsonTest")] public class InputAndOutputDateTimeFormatNewtonsoftTests : AbpJsonNewtonsoftJsonTestBase { private readonly IJsonSerializer _jsonSerializer; @@ -83,6 +86,8 @@ public class InputAndOutputDateTimeFormatNewtonsoftTests : AbpJsonNewtonsoftJson { options.Kind = DateTimeKind.Utc; }); + + base.AfterAddApplication(services); } [Fact] From 17e9bafb5f40fed96fddaedabe2afe1a8a53e83f Mon Sep 17 00:00:00 2001 From: maliming Date: Wed, 16 Apr 2025 13:47:53 +0800 Subject: [PATCH 30/31] refactor: change const to static string in CliConsts and CliUrls --- .../Volo/Abp/Cli/CliConsts.cs | 20 +++++++-------- .../Volo.Abp.Cli.Core/Volo/Abp/Cli/CliUrls.cs | 25 +++++++++---------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliConsts.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliConsts.cs index 8d77675c3c..d968ae6b12 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliConsts.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliConsts.cs @@ -2,24 +2,24 @@ public static class CliConsts { - public const string Command = "AbpCliCommand"; + public static string Command = "AbpCliCommand"; - public const string BranchPrefix = "branch@"; + public static string BranchPrefix = "branch@"; - public const string DocsLink = "https://abp.io/docs"; + public static string DocsLink = "https://abp.io/docs"; - public const string HttpClientName = "AbpHttpClient"; + public static string HttpClientName = "AbpHttpClient"; - public const string GithubHttpClientName = "GithubHttpClient"; + public static string GithubHttpClientName = "GithubHttpClient"; - public const string LogoutUrl = CliUrls.WwwAbpIo + "api/license/logout"; + public static string LogoutUrl = CliUrls.WwwAbpIo + "api/license/logout"; - public const string LicenseCodePlaceHolder = @""; + public static string LicenseCodePlaceHolder = @""; - public const string AppSettingsJsonFileName = "appsettings.json"; + public static string AppSettingsJsonFileName = "appsettings.json"; + + public static string AppSettingsSecretJsonFileName = "appsettings.secrets.json"; - public const string AppSettingsSecretJsonFileName = "appsettings.secrets.json"; - public static class MemoryKeys { public const string LatestCliVersionCheckDate = "LatestCliVersionCheckDate"; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliUrls.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliUrls.cs index 35ae34b895..28cf42c2a2 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliUrls.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliUrls.cs @@ -5,19 +5,18 @@ namespace Volo.Abp.Cli; public static class CliUrls { - public const string WwwAbpIo = WwwAbpIoProduction; - public const string AccountAbpIo = AccountAbpIoProduction; - public const string NuGetRootPath = NuGetRootPathProduction; - public const string LatestVersionCheckFullPath = - "https://raw.githubusercontent.com/abpframework/abp/dev/latest-versions.json"; - - public const string WwwAbpIoProduction = "https://abp.io/"; - public const string AccountAbpIoProduction = "https://account.abp.io/"; - public const string NuGetRootPathProduction = "https://nuget.abp.io/"; - - public const string WwwAbpIoDevelopment = "https://localhost:44328/"; - public const string AccountAbpIoDevelopment = "https://localhost:44333/"; - public const string NuGetRootPathDevelopment = "https://localhost:44373/"; + public static string WwwAbpIo = WwwAbpIoProduction; + public static string AccountAbpIo = AccountAbpIoProduction; + public static string NuGetRootPath = NuGetRootPathProduction; + public static string LatestVersionCheckFullPath = "https://raw.githubusercontent.com/abpframework/abp/dev/latest-versions.json"; + + public static string WwwAbpIoProduction = "https://abp.io/"; + public static string AccountAbpIoProduction = "https://account.abp.io/"; + public static string NuGetRootPathProduction = "https://nuget.abp.io/"; + + public static string WwwAbpIoDevelopment = "https://localhost:44328/"; + public static string AccountAbpIoDevelopment = "https://localhost:44333/"; + public static string NuGetRootPathDevelopment = "https://localhost:44373/"; public static string GetNuGetServiceIndexUrl(string apiKey) { From 03192eaae165b347d8ce848426ecea8e7c54fc30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SAL=C4=B0H=20=C3=96ZKARA?= Date: Wed, 16 Apr 2025 15:29:20 +0300 Subject: [PATCH 31/31] Fix date problem --- .../Pages/Docs/Admin/Documents/index.js | 47 ++++++++++--------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js index 6dd0e1bde2..91b3770c6f 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js @@ -2,7 +2,11 @@ $(function () { var l = abp.localization.getResource('Docs'); var service = window.volo.docs.admin.documentsAdmin; - moment.localeData().preparse = (s)=>s; + var getFormattedDate = function ($datePicker) { + return $datePicker.data('date'); + }; + + moment.localeData().preparse = (s)=>s; moment.localeData().postformat = (s)=>s; var singleDatePicker = $('#DocumentsContainer .singledatepicker'); @@ -26,7 +30,7 @@ $(function () { var comboboxItems = []; - + service.getFilterItems() .then(function (result) { comboboxItems = result; @@ -41,13 +45,13 @@ $(function () { $projectId.on('change', function () { fillOptions(); }); - + var comboboxs = { version: $('#Version'), languageCode: $('#LanguageCode'), format: $('#Format') }; - + for (var key in comboboxs) { comboboxs[key].on('change', function () { fillOptions(); @@ -62,7 +66,7 @@ $(function () { comboboxs[key].empty(); } } - + function getSelectedItem() { var item = {}; for (var key in comboboxs) { @@ -70,13 +74,13 @@ $(function () { } return item; } - + function SetComboboxsValues(item) { for (var key in comboboxs) { comboboxs[key].val(item[key]); } } - + function addComboboxsEmptyItem() { for (var key in comboboxs) { comboboxs[key].append($('