Browse Source

Merge pull request #12634 from abpframework/auto-merge/rel-5-3/1074

Merge branch dev with rel-5.3
pull/12644/head
Halil İbrahim Kalkan 4 years ago
committed by GitHub
parent
commit
b6718cbd84
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      docs/en/UI/AspNetCore/JavaScript-API/GlobalFeatures.md
  2. 1
      docs/en/UI/AspNetCore/JavaScript-API/Index.md
  3. 3
      framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationGlobalFeatureConfigurationDto.cs
  4. 6
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationAppService.cs
  5. 4
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs
  6. 10
      npm/packs/core/src/abp.js

24
docs/en/UI/AspNetCore/JavaScript-API/GlobalFeatures.md

@ -0,0 +1,24 @@
# ASP.NET Core MVC / Razor Pages UI: JavaScript Global Features API
`abp.globalFeatures` API allows you to get the enabled features of the [Global Features](../../../Global-Features.md) in the client side.
> This document only explains the JavaScript API. See the [Global Features](../../../Global-Features.md) document to understand the ABP Global Features system.
## Usage
````js
//Gets all enabled global features.
> abp.globalFeatures.enabledFeatures
[ 'Shopping.Payment', 'Ecommerce.Subscription' ]
//Check the global feature is enabled
> abp.globalFeatures.isEnabled('Ecommerce.Subscription')
true
> abp.globalFeatures.isEnabled('My.Subscription')
false
````

1
docs/en/UI/AspNetCore/JavaScript-API/Index.md

@ -10,6 +10,7 @@ ABP provides a set of JavaScript APIs for ASP.NET Core MVC / Razor Pages applica
* [DOM](DOM.md)
* [Events](Events.md)
* [Features](Features.md)
* [Global Features](GlobalFeatures.md)
* [Localization](Localization.md)
* [Logging](Logging.md)
* [ResourceLoader](ResourceLoader.md)

3
framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationGlobalFeatureConfigurationDto.cs

@ -8,11 +8,8 @@ public class ApplicationGlobalFeatureConfigurationDto
{
public HashSet<string> EnabledFeatures { get; set; }
public Dictionary<string, List<string>> ModuleEnabledFeatures { get; set; }
public ApplicationGlobalFeatureConfigurationDto()
{
EnabledFeatures = new HashSet<string>();
ModuleEnabledFeatures = new Dictionary<string, List<string>>();
}
}

6
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationAppService.cs

@ -295,15 +295,9 @@ public class AbpApplicationConfigurationAppService : ApplicationService, IAbpApp
result.EnabledFeatures.AddIfNotContains(enabledFeatureName);
}
foreach (var module in GlobalFeatureManager.Instance.Modules)
{
result.ModuleEnabledFeatures.AddIfNotContains(new KeyValuePair<string, List<string>>(module.Key, module.Value.GetFeatures().Select(x => x.FeatureName).ToList()));
}
return Task.FromResult(result);
}
protected virtual async Task<TimingDto> GetTimingConfigAsync()
{
var windowsTimeZoneId = await _settingProvider.GetOrNullAsync(TimingSettingNames.TimeZone);

4
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs

@ -100,8 +100,8 @@ public class AngularServiceProxyGenerator : ServiceProxyGeneratorBase<AngularSer
);
}
var parseError = SemanticVersion.TryParse(schematicsVersion.TrimStart('~', '^', 'v'), out var semanticSchematicsVersion);
if (parseError)
var parsed = SemanticVersion.TryParse(schematicsVersion.TrimStart('~', '^', 'v'), out var semanticSchematicsVersion);
if (!parsed)
{
Logger.LogWarning("Couldn't determinate version of \"@abp/ng.schematics\" package.");
return;

10
npm/packs/core/src/abp.js

@ -773,4 +773,14 @@ var abp = abp || {};
return abp.features.values[name];
};
/* GLOBAL FEATURES *************************************************/
abp.globalFeatures = abp.globalFeatures || {};
abp.globalFeatures.enabledFeatures = abp.globalFeatures.enabledFeatures || [];
abp.globalFeatures.isEnabled = function(name){
return abp.globalFeatures.enabledFeatures.indexOf(name) != -1;
}
})();

Loading…
Cancel
Save