Skip to content

Commit

Permalink
feat: 修改Setting常量位置
Browse files Browse the repository at this point in the history
  • Loading branch information
WangJunZzz committed Jul 5, 2023
1 parent 2b3b364 commit d602a2a
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 40 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace Lion.AbpPro.Core;

public class AbpProSettingConsts
{
public const string Prefix = "setting_";

/// <summary>
/// 前端控件类型
/// </summary>
public static class ControlType
{
public const string Default = "Type";
public const string TypeText = "Text";
public const string TypeCheckBox = "CheckBox";
public const string Number = "Number";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public async Task<List<SettingOutput>> GetAsync()
{
var value = await SettingProvider.GetOrNullAsync(itemDefinition.Name);
var type = itemDefinition.Properties
.FirstOrDefault(f => f.Key == BasicManagementSettings.ControlType.Default).Value
.FirstOrDefault(f => f.Key == AbpProSettingConsts.ControlType.Default).Value
.ToString();

item.SettingItemOutput.Add(new SettingItemOutput(
Expand All @@ -62,12 +62,12 @@ public async Task UpdateAsync(UpdateSettingInput input)
{
// The key of the settingValues is in camel_Case, like "setting_Abp_Localization_DefaultLanguage",
// change it to "Abp.Localization.DefaultLanguage" form
if (!kv.Key.StartsWith(BasicManagementSettings.Prefix))
if (!kv.Key.StartsWith(AbpProSettingConsts.Prefix))
{
continue;
}

string name = kv.Key.RemovePreFix(BasicManagementSettings.Prefix);
string name = kv.Key.RemovePreFix(AbpProSettingConsts.Prefix);
var setting = _settingDefinitionManager.GetOrNull(name);
if (setting == null)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Guids;
using Volo.Abp.Localization;

namespace Lion.AbpPro.BasicManagement.Data.Seeds
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
using Lion.AbpPro.BasicManagement.Localization;
using Volo.Abp.Localization;
using Volo.Abp.Settings;
using Volo.Abp.Timing;

namespace Lion.AbpPro.BasicManagement.Settings;
namespace Lion.AbpPro.BasicManagement.Settings;

public class BasicManagementSettingDefinitionProvider : SettingDefinitionProvider
{
public override void Define(ISettingDefinitionContext context)
{
//Define your own settings here. Example:
//context.Add(new SettingDefinition(BasicManagementSettings.MySetting1));
//context.Add(new SettingDefinition(AbpProSettingConsts.MySetting1));
OverrideDefaultSettings(context);
}

Expand All @@ -22,7 +17,7 @@ private static void OverrideDefaultSettings(ISettingDefinitionContext context)

context.GetOrNull(LocalizationSettingNames.DefaultLanguage)
.WithProperty(BasicManagementSettings.Group.Default, BasicManagementSettings.Group.SystemManagement)
.WithProperty(BasicManagementSettings.ControlType.Default, BasicManagementSettings.ControlType.TypeText);
.WithProperty(AbpProSettingConsts.ControlType.Default, AbpProSettingConsts.ControlType.TypeText);

context.Add(
new SettingDefinition(TimingSettingNames.TimeZone,
Expand All @@ -31,50 +26,50 @@ private static void OverrideDefaultSettings(ISettingDefinitionContext context)
L("Description:Abp.Timing.Timezone"))
.WithProperty(BasicManagementSettings.Group.Default,
BasicManagementSettings.Group.SystemManagement)
.WithProperty(BasicManagementSettings.ControlType.Default,
BasicManagementSettings.ControlType.TypeText));
.WithProperty(AbpProSettingConsts.ControlType.Default,
AbpProSettingConsts.ControlType.TypeText));

context.GetOrNull("Abp.Identity.Password.RequiredLength")
.WithProperty(BasicManagementSettings.Group.Default,
BasicManagementSettings.Group.SystemManagement)
.WithProperty(BasicManagementSettings.ControlType.Default,
BasicManagementSettings.ControlType.Number);
.WithProperty(AbpProSettingConsts.ControlType.Default,
AbpProSettingConsts.ControlType.Number);

context.GetOrNull("Abp.Identity.Password.RequiredLength")
.WithProperty(BasicManagementSettings.Group.Default,
BasicManagementSettings.Group.SystemManagement)
.WithProperty(BasicManagementSettings.ControlType.Default,
BasicManagementSettings.ControlType.Number);
.WithProperty(AbpProSettingConsts.ControlType.Default,
AbpProSettingConsts.ControlType.Number);

context.GetOrNull("Abp.Identity.Password.RequiredUniqueChars")
.WithProperty(BasicManagementSettings.Group.Default,
BasicManagementSettings.Group.SystemManagement)
.WithProperty(BasicManagementSettings.ControlType.Default,
BasicManagementSettings.ControlType.Number);
.WithProperty(AbpProSettingConsts.ControlType.Default,
AbpProSettingConsts.ControlType.Number);

context.GetOrNull("Abp.Identity.Password.RequireNonAlphanumeric")
.WithProperty(BasicManagementSettings.Group.Default,
BasicManagementSettings.Group.SystemManagement)
.WithProperty(BasicManagementSettings.ControlType.Default,
BasicManagementSettings.ControlType.TypeCheckBox);
.WithProperty(AbpProSettingConsts.ControlType.Default,
AbpProSettingConsts.ControlType.TypeCheckBox);

context.GetOrNull("Abp.Identity.Password.RequireLowercase")
.WithProperty(BasicManagementSettings.Group.Default,
BasicManagementSettings.Group.SystemManagement)
.WithProperty(BasicManagementSettings.ControlType.Default,
BasicManagementSettings.ControlType.TypeCheckBox);
.WithProperty(AbpProSettingConsts.ControlType.Default,
AbpProSettingConsts.ControlType.TypeCheckBox);

context.GetOrNull("Abp.Identity.Password.RequireUppercase")
.WithProperty(BasicManagementSettings.Group.Default,
BasicManagementSettings.Group.SystemManagement)
.WithProperty(BasicManagementSettings.ControlType.Default,
BasicManagementSettings.ControlType.TypeCheckBox);
.WithProperty(AbpProSettingConsts.ControlType.Default,
AbpProSettingConsts.ControlType.TypeCheckBox);

context.GetOrNull("Abp.Identity.Password.RequireDigit")
.WithProperty(BasicManagementSettings.Group.Default,
BasicManagementSettings.Group.SystemManagement)
.WithProperty(BasicManagementSettings.ControlType.Default,
BasicManagementSettings.ControlType.TypeCheckBox);
.WithProperty(AbpProSettingConsts.ControlType.Default,
AbpProSettingConsts.ControlType.TypeCheckBox);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@

public static class BasicManagementSettings
{
public const string Prefix = "setting_";

/// <summary>
/// 前端控件类型
/// </summary>
public static class ControlType
{
public const string Default = "Type";
public const string TypeText = "Text";
public const string TypeCheckBox = "CheckBox";
public const string Number = "Number";
}

/// <summary>
/// 系统控制分组
Expand Down

0 comments on commit d602a2a

Please sign in to comment.