GrafanaUI: feature toggle access in Grafana UI (#104500)

* add set/get feature toggles functions to grafana/ui

* configure grafana/ui feature toggle localeFormatPreference in app init

* revert more complex approach and use contained access to global
pull/104795/head^2
Luminessa Starlight 2 weeks ago committed by GitHub
parent 691c1bb0f2
commit 228fbcd495
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 13
      packages/grafana-ui/src/utils/featureToggle.ts

@ -0,0 +1,13 @@
import { FeatureToggles } from '@grafana/data';
type FeatureToggleName = keyof FeatureToggles;
/**
* Check a featureToggle
* @param featureName featureToggle name
* @param def default value if featureToggles aren't defined, false if not provided
* @returns featureToggle value or def.
*/
export function getFeatureToggle(featureName: FeatureToggleName, def = false) {
return window.grafanaBootData?.settings.featureToggles[featureName] ?? def;
}
Loading…
Cancel
Save