|
|
|
@ -2,7 +2,10 @@ import { Injectable } from '@angular/core'; |
|
|
|
import { Observable, Subject } from 'rxjs'; |
|
|
|
import { map, switchMap, take } from 'rxjs/operators'; |
|
|
|
import { AbpApplicationConfigurationService } from '../proxy/volo/abp/asp-net-core/mvc/application-configurations/abp-application-configuration.service'; |
|
|
|
import { ApplicationConfigurationDto, ApplicationGlobalFeatureConfigurationDto } from '../proxy/volo/abp/asp-net-core/mvc/application-configurations/models'; |
|
|
|
import { |
|
|
|
ApplicationConfigurationDto, |
|
|
|
ApplicationGlobalFeatureConfigurationDto, |
|
|
|
} from '../proxy/volo/abp/asp-net-core/mvc/application-configurations/models'; |
|
|
|
import { InternalStore } from '../utils/internal-store-utils'; |
|
|
|
|
|
|
|
@Injectable({ |
|
|
|
@ -15,7 +18,7 @@ export class ConfigStateService { |
|
|
|
return this.store.sliceUpdate; |
|
|
|
} |
|
|
|
|
|
|
|
private updateSubject = new Subject(); |
|
|
|
private updateSubject = new Subject<void>(); |
|
|
|
|
|
|
|
constructor(private abpConfigService: AbpApplicationConfigurationService) { |
|
|
|
this.initUpdateStream(); |
|
|
|
@ -147,8 +150,11 @@ export class ConfigStateService { |
|
|
|
return this.store.sliceState(state => state.globalFeatures); |
|
|
|
} |
|
|
|
|
|
|
|
private isGlobalFeatureEnabled(key: string, globalFeatures: ApplicationGlobalFeatureConfigurationDto) { |
|
|
|
const features = globalFeatures.enabledFeatures || [] |
|
|
|
private isGlobalFeatureEnabled( |
|
|
|
key: string, |
|
|
|
globalFeatures: ApplicationGlobalFeatureConfigurationDto, |
|
|
|
) { |
|
|
|
const features = globalFeatures.enabledFeatures || []; |
|
|
|
return features.some(f => key === f); |
|
|
|
} |
|
|
|
|
|
|
|
@ -159,9 +165,6 @@ export class ConfigStateService { |
|
|
|
getGlobalFeatureIsEnabled$(key: string) { |
|
|
|
return this.store.sliceState(state => this.isGlobalFeatureEnabled(key, state.globalFeatures)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
function splitKeys(keys: string[] | string): string[] { |
|
|
|
|