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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with
37 additions and
11 deletions
docs/en/UI/AspNetCore/JavaScript-API/GlobalFeatures.md
docs/en/UI/AspNetCore/JavaScript-API/Index.md
framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationGlobalFeatureConfigurationDto.cs
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationAppService.cs
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs
npm/packs/core/src/abp.js
@ -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
````
@ -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 )
@ -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 > > ( ) ;
}
}
@ -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 ) ;
@ -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 ;
@ -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 ;
}
} ) ( ) ;