Feature highlights: add setting toggle (#43394)

* Feature highlights: add toggle setting

* Settings: Use provider for 'feature_highlights' section

* Fix frontendsettings API tests

* Document the toggle

Co-authored-by: Joan López de la Franca Beltran <5459617+joanlopez@users.noreply.github.com>
Co-authored-by: Joan López de la Franca Beltran <joanjan14@gmail.com>
This commit is contained in:
Alex Khomenko 2021-12-24 10:49:52 +02:00 committed by GitHub
parent e75edc810d
commit 3b4a4be3c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 7 deletions

View File

@ -1076,10 +1076,10 @@ grpc_port =
license_path =
[feature_toggles]
# there are currently two ways to enable feature toggles in the `grafana.ini`.
# you can either pass an array of feature you want to enable to the `enable` field or
# there are currently two ways to enable feature toggles in the `grafana.ini`.
# you can either pass an array of feature you want to enable to the `enable` field or
# configure each toggle by setting the name of the toggle to true/false. Toggles set to true/false
# will take presidence over toggles in the `enable` list.
# will take precedence over toggles in the `enable` list.
# enable = feature1,feature2
enable =

View File

@ -495,3 +495,9 @@ The org id of the datasource where the query data will be written.
If all `default_remote_write_*` properties are set, this information will be populated at startup. If a remote write target has
already been configured, nothing will happen.
## [feature_highlights]
### enabled
Whether the feature highlights feature is enabled

View File

@ -283,6 +283,9 @@ func (hs *HTTPServer) getFrontendSettingsMap(c *models.ReqContext) (map[string]i
"enabled": hs.Cfg.SectionWithEnvOverrides("recorded_queries").Key("enabled").MustBool(false),
},
"unifiedAlertingEnabled": hs.Cfg.UnifiedAlerting.Enabled,
"featureHighlights": map[string]bool{
"enabled": hs.SettingsProvider.Section("feature_highlights").KeyValue("enabled").MustBool(false),
},
}
if hs.Cfg.GeomapDefaultBaseLayerConfig != nil {

View File

@ -44,10 +44,11 @@ func setupTestEnvironment(t *testing.T, cfg *setting.Cfg) (*web.Mux, *HTTPServer
Cfg: cfg,
RendererPluginManager: &fakeRendererManager{},
},
SQLStore: sqlStore,
pluginStore: &fakePluginStore{},
updateChecker: &updatechecker.Service{},
AccessControl: accesscontrolmock.New().WithDisabled(),
SQLStore: sqlStore,
SettingsProvider: setting.ProvideProvider(cfg),
pluginStore: &fakePluginStore{},
updateChecker: &updatechecker.Service{},
AccessControl: accesscontrolmock.New().WithDisabled(),
}
m := web.New()