|
|
|
@ -153,7 +153,27 @@ export class GrafanaBootConfig implements GrafanaConfig { |
|
|
|
|
if (this.dateFormats) { |
|
|
|
|
systemDateFormats.update(this.dateFormats); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
overrideFeatureTogglesFromUrl(this); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function overrideFeatureTogglesFromUrl(config: GrafanaBootConfig) { |
|
|
|
|
if (window.location.href.indexOf('__feature') === -1) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const params = new URLSearchParams(window.location.search); |
|
|
|
|
params.forEach((value, key) => { |
|
|
|
|
if (key.startsWith('__feature.')) { |
|
|
|
|
const featureName = key.substring(10); |
|
|
|
|
const toggleState = value === 'true'; |
|
|
|
|
if (toggleState !== config.featureToggles[key]) { |
|
|
|
|
config.featureToggles[featureName] = toggleState; |
|
|
|
|
console.log(`Setting feature toggle ${featureName} = ${toggleState}`); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const bootData = (window as any).grafanaBootData || { |
|
|
|
|