|
|
|
@ -5,6 +5,7 @@ import { AbpApplicationConfigurationService } from '../proxy/volo/abp/asp-net-co |
|
|
|
import { AbpApplicationLocalizationService } from '../proxy/volo/abp/asp-net-core/mvc/application-configurations/abp-application-localization.service'; |
|
|
|
import { |
|
|
|
ApplicationConfigurationDto, |
|
|
|
ApplicationFeatureConfigurationDto, |
|
|
|
ApplicationGlobalFeatureConfigurationDto, |
|
|
|
} from '../proxy/volo/abp/asp-net-core/mvc/application-configurations/models'; |
|
|
|
import { INCUDE_LOCALIZATION_RESOURCES_TOKEN } from '../tokens/include-localization-resources.token'; |
|
|
|
@ -71,10 +72,10 @@ export class ConfigStateService { |
|
|
|
} |
|
|
|
|
|
|
|
refreshLocalization(lang: string): Observable<null> { |
|
|
|
if(this.includeLocalizationResources){ |
|
|
|
if (this.includeLocalizationResources) { |
|
|
|
return this.refreshAppState().pipe(map(() => null)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return this.getlocalizationResource(lang) |
|
|
|
.pipe( |
|
|
|
tap(result => |
|
|
|
@ -145,7 +146,7 @@ export class ConfigStateService { |
|
|
|
return keys.reduce((acc, key) => ({ ...acc, [key]: features.values[key] }), {}); |
|
|
|
} |
|
|
|
|
|
|
|
getFeatures$(keys: string[]): Observable<{ [key: string]: string; } | undefined> { |
|
|
|
getFeatures$(keys: string[]): Observable<{ [key: string]: string } | undefined> { |
|
|
|
return this.store.sliceState(({ features }) => { |
|
|
|
if (!features?.values) return; |
|
|
|
|
|
|
|
@ -153,6 +154,18 @@ export class ConfigStateService { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
private isFeatureEnabled(key: string, features: ApplicationFeatureConfigurationDto) { |
|
|
|
return features.values[key] === 'true'; |
|
|
|
} |
|
|
|
|
|
|
|
getFeatureIsEnabled(key: string) { |
|
|
|
return this.isFeatureEnabled(key, this.store.state.features); |
|
|
|
} |
|
|
|
|
|
|
|
getFeatureIsEnabled$(key: string) { |
|
|
|
return this.store.sliceState(state => this.isFeatureEnabled(key, state.features)); |
|
|
|
} |
|
|
|
|
|
|
|
getSetting(key: string) { |
|
|
|
return this.store.state.setting?.values?.[key]; |
|
|
|
} |
|
|
|
@ -168,10 +181,13 @@ export class ConfigStateService { |
|
|
|
|
|
|
|
const keysFound = Object.keys(settings).filter(key => key.indexOf(keyword) > -1); |
|
|
|
|
|
|
|
return keysFound.reduce((acc, key) => { |
|
|
|
acc[key] = settings[key]; |
|
|
|
return acc; |
|
|
|
}, {} as Record<string, string>); |
|
|
|
return keysFound.reduce( |
|
|
|
(acc, key) => { |
|
|
|
acc[key] = settings[key]; |
|
|
|
return acc; |
|
|
|
}, |
|
|
|
{} as Record<string, string>, |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
getSettings$(keyword?: string) { |
|
|
|
@ -183,10 +199,13 @@ export class ConfigStateService { |
|
|
|
|
|
|
|
const keysFound = Object.keys(settings).filter(key => key.indexOf(keyword) > -1); |
|
|
|
|
|
|
|
return keysFound.reduce((acc, key) => { |
|
|
|
acc[key] = settings[key]; |
|
|
|
return acc; |
|
|
|
}, {} as Record<string, string>); |
|
|
|
return keysFound.reduce( |
|
|
|
(acc, key) => { |
|
|
|
acc[key] = settings[key]; |
|
|
|
return acc; |
|
|
|
}, |
|
|
|
{} as Record<string, string>, |
|
|
|
); |
|
|
|
}), |
|
|
|
); |
|
|
|
} |
|
|
|
|