PublicDashboards: Add setting to disable the feature (#78894)
* Replace feature toggle with configuration setting * Fix permission alert * Update documentation * Add back feature toggle * revert unwanted commited changes * fix tests * run prettier * Update SharePublicDashboard.test.tsx * fix linter and frontend tests * Update api.go * Apply docs edit from code review Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com> * Update index.md * Update docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md Co-authored-by: Agnès Toulet <35176601+AgnesToulet@users.noreply.github.com> * Update docs/sources/setup-grafana/configure-grafana/_index.md Co-authored-by: Agnès Toulet <35176601+AgnesToulet@users.noreply.github.com> * add isPublicDashboardsEnabled + test * fix test * update ff description in registry * move isPublicDashboardsEnabled * revert getConfig() update --------- Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com> Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
This commit is contained in:
co-authored by
Isabel
Christopher Moyer
parent
ef60c90dfa
commit
fdaf6e3f2e
@@ -40,11 +40,12 @@ import (
|
||||
func setupTestServer(
|
||||
t *testing.T,
|
||||
cfg *setting.Cfg,
|
||||
features *featuremgmt.FeatureManager,
|
||||
service publicdashboards.Service,
|
||||
db db.DB,
|
||||
user *user.SignedInUser,
|
||||
ffEnabled bool,
|
||||
) *web.Mux {
|
||||
t.Helper()
|
||||
|
||||
// build router to register routes
|
||||
rr := routing.NewRouteRegister()
|
||||
|
||||
@@ -56,9 +57,18 @@ func setupTestServer(
|
||||
// set initial context
|
||||
m.Use(contextProvider(&testContext{user}))
|
||||
|
||||
// build api, this will mount the routes at the same time if
|
||||
// featuremgmt.FlagPublicDashboard is enabled
|
||||
ProvideApi(service, rr, ac, features, &Middleware{})
|
||||
features := featuremgmt.WithFeatures()
|
||||
if ffEnabled {
|
||||
features = featuremgmt.WithFeatures(featuremgmt.FlagPublicDashboards)
|
||||
}
|
||||
|
||||
if cfg == nil {
|
||||
cfg = setting.NewCfg()
|
||||
cfg.PublicDashboardsEnabled = true
|
||||
}
|
||||
|
||||
// build api, this will mount the routes at the same time if the feature is enabled
|
||||
ProvideApi(service, rr, ac, features, &Middleware{}, cfg)
|
||||
|
||||
// connect routes to mux
|
||||
rr.Register(m.Router)
|
||||
|
||||
Reference in New Issue
Block a user