-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a11af34
commit b2879e8
Showing
29 changed files
with
1,421 additions
and
24 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
...src/Lion.AbpPro.BasicManagement.Application.Contracts/Features/Dtos/DeleteFeatureInput.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
namespace Lion.AbpPro.BasicManagement.Features.Dtos; | ||
|
||
public class DeleteFeatureInput : IValidatableObject | ||
{ | ||
public string ProviderName { get; set; } | ||
|
||
public string ProviderKey { get; set; } | ||
|
||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) | ||
{ | ||
var localization = validationContext.GetRequiredService<IStringLocalizer<AbpProLocalizationResource>>(); | ||
if (ProviderName.IsNullOrWhiteSpace()) | ||
{ | ||
yield return new ValidationResult( | ||
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(ProviderName)], | ||
new[] { nameof(ProviderName) } | ||
); | ||
} | ||
|
||
if (ProviderKey.IsNullOrWhiteSpace()) | ||
{ | ||
yield return new ValidationResult( | ||
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(ProviderKey)], | ||
new[] { nameof(ProviderKey) } | ||
); | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...n.AbpPro.BasicManagement.Application.Contracts/Features/Dtos/GetFeatureListResultInput.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
namespace Lion.AbpPro.BasicManagement.Features.Dtos; | ||
|
||
public class GetFeatureListResultInput : IValidatableObject | ||
{ | ||
public string ProviderName { get; set; } | ||
|
||
public string ProviderKey { get; set; } | ||
|
||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) | ||
{ | ||
var localization = validationContext.GetRequiredService<IStringLocalizer<AbpProLocalizationResource>>(); | ||
if (ProviderName.IsNullOrWhiteSpace()) | ||
{ | ||
yield return new ValidationResult( | ||
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(ProviderName)], | ||
new[] { nameof(ProviderName) } | ||
); | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...src/Lion.AbpPro.BasicManagement.Application.Contracts/Features/Dtos/UpdateFeatureInput.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Volo.Abp.FeatureManagement; | ||
|
||
namespace Lion.AbpPro.BasicManagement.Features.Dtos; | ||
|
||
public class UpdateFeatureInput : IValidatableObject | ||
{ | ||
public string ProviderName { get; set; } | ||
|
||
public string ProviderKey { get; set; } | ||
|
||
public UpdateFeaturesDto UpdateFeaturesDto { get; set; } | ||
|
||
|
||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) | ||
{ | ||
var localization = validationContext.GetRequiredService<IStringLocalizer<AbpProLocalizationResource>>(); | ||
if (ProviderName.IsNullOrWhiteSpace()) | ||
{ | ||
yield return new ValidationResult( | ||
localization[AbpProLocalizationErrorCodes.ErrorCode100003, nameof(ProviderName)], | ||
new[] { nameof(ProviderName) } | ||
); | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
.../src/Lion.AbpPro.BasicManagement.Application.Contracts/Features/IVoloFeatureAppService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Lion.AbpPro.BasicManagement.Features.Dtos; | ||
using Volo.Abp.FeatureManagement; | ||
|
||
namespace Lion.AbpPro.BasicManagement.Features; | ||
|
||
public interface IVoloFeatureAppService : IApplicationService | ||
{ | ||
/// <summary> | ||
/// 获取Features | ||
/// </summary> | ||
Task<GetFeatureListResultDto> GetAsync(GetFeatureListResultInput input); | ||
|
||
/// <summary> | ||
/// 更新Features | ||
/// </summary> | ||
Task UpdateAsync(UpdateFeatureInput input); | ||
|
||
/// <summary> | ||
/// 删除Features | ||
/// </summary> | ||
Task DeleteAsync(DeleteFeatureInput input); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...cManagement/src/Lion.AbpPro.BasicManagement.Application/Features/VoloFeatureAppService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Lion.AbpPro.BasicManagement.Features.Dtos; | ||
using Volo.Abp.FeatureManagement; | ||
|
||
namespace Lion.AbpPro.BasicManagement.Features; | ||
|
||
[Authorize] | ||
public class VoloFeatureAppService : BasicManagementAppService, IVoloFeatureAppService | ||
{ | ||
private readonly IFeatureAppService _featureAppService; | ||
|
||
public VoloFeatureAppService(IFeatureAppService featureAppService) | ||
{ | ||
_featureAppService = featureAppService; | ||
} | ||
|
||
public virtual async Task<GetFeatureListResultDto> GetAsync(GetFeatureListResultInput input) | ||
{ | ||
var result = await _featureAppService.GetAsync(input.ProviderName, input.ProviderKey); | ||
// 过滤自带的SettingManagement设置 | ||
result.Groups = result.Groups.Where(e => e.Name != "SettingManagement").ToList(); | ||
return result; | ||
} | ||
|
||
public virtual async Task UpdateAsync(UpdateFeatureInput input) | ||
{ | ||
await _featureAppService.UpdateAsync(input.ProviderName, input.ProviderKey, input.UpdateFeaturesDto); | ||
} | ||
|
||
public virtual async Task DeleteAsync(DeleteFeatureInput input) | ||
{ | ||
await _featureAppService.DeleteAsync(input.ProviderName, input.ProviderKey); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...ules/BasicManagement/src/Lion.AbpPro.BasicManagement.HttpApi/Systems/FeatureController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using Lion.AbpPro.BasicManagement.Features; | ||
using Lion.AbpPro.BasicManagement.Features.Dtos; | ||
using Volo.Abp.FeatureManagement; | ||
|
||
namespace Lion.AbpPro.BasicManagement.Systems; | ||
|
||
[Route("Features")] | ||
public class FeatureController : BasicManagementController, IVoloFeatureAppService | ||
{ | ||
private readonly IVoloFeatureAppService _featureAppService; | ||
|
||
public FeatureController(IVoloFeatureAppService featureAppService) | ||
{ | ||
_featureAppService = featureAppService; | ||
} | ||
|
||
[HttpPost("list")] | ||
[SwaggerOperation(summary: "获取Features", Tags = new[] {"Features"})] | ||
public Task<GetFeatureListResultDto> GetAsync(GetFeatureListResultInput input) | ||
{ | ||
return _featureAppService.GetAsync(input); | ||
} | ||
|
||
[HttpPost("update")] | ||
[SwaggerOperation(summary: "更新Features", Tags = new[] {"Features"})] | ||
public Task UpdateAsync(UpdateFeatureInput input) | ||
{ | ||
return _featureAppService.UpdateAsync(input); | ||
} | ||
|
||
[HttpPost("delete")] | ||
[SwaggerOperation(summary: "删除Features", Tags = new[] {"Features"})] | ||
public Task DeleteAsync(DeleteFeatureInput input) | ||
{ | ||
return _featureAppService.DeleteAsync(input); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...t-core/services/src/Lion.AbpPro.Domain.Shared/Features/AbpProFeatureDefinitionProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Volo.Abp.Features; | ||
using Volo.Abp.Validation.StringValues; | ||
|
||
namespace Lion.AbpPro.Features; | ||
|
||
public class AbpProFeatureDefinitionProvider : FeatureDefinitionProvider | ||
{ | ||
public override void Define(IFeatureDefinitionContext context) | ||
{ | ||
|
||
var group = context.AddGroup(AbpProFeatures.GroupName,L("Feature:TestGroup")); | ||
|
||
// ToggleStringValueType bool类型 前端渲染为checkbox | ||
group.AddFeature(AbpProFeatures.TestEnable, | ||
"true", | ||
L("Feature:TestEnable"), | ||
L("Feature:TestEnable"), | ||
new ToggleStringValueType()); | ||
|
||
// ToggleStringValueType string类型 前端渲染为input | ||
group.AddFeature(AbpProFeatures.TestString, | ||
"输入需要设定的值", | ||
L("Feature:TestString"), | ||
L("Feature:TestString"), | ||
new FreeTextStringValueType()); | ||
|
||
// todo SelectionStringValueType select标签待定 | ||
} | ||
|
||
private static LocalizableString L(string name) | ||
{ | ||
return LocalizableString.Create<AbpProResource>(name); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Features/AbpProFeatures.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Lion.AbpPro.Features; | ||
|
||
public class AbpProFeatures | ||
{ | ||
public const string GroupName = "AbpPro"; | ||
|
||
public const string TestEnable = GroupName + ".TestEnable"; | ||
|
||
public const string TestString = GroupName + ".TestString"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.