Feature Toggle Management: allow editing PublicPreview toggles (#81562)

* Feature Toggle Management: allow editing PublicPreview toggles

* lint

* fix a bunch of tests

* tests are passing

* add permissions unit tests back

* fix display

* close dialog after submit

* use reload method after submit

* make local development easier

* always show editing alert in the UI

* fix readme

---------

Co-authored-by: Michael Mandrus <michael.mandrus@grafana.com>
This commit is contained in:
João Calisto
2024-02-09 18:48:56 +02:00
committed by GitHub
co-authored by Michael Mandrus
parent f60b5ecec4
commit 42d6e176bc
11 changed files with 587 additions and 22 deletions
@@ -79,6 +79,7 @@ func (p *DummyAPIFactory) MakeAPIServer(gv schema.GroupVersion) (builder.APIGrou
return featuretoggle.NewFeatureFlagAPIBuilder(
featuremgmt.WithFeatureManager(setting.FeatureMgmtSettings{}, nil), // none... for now
&actest.FakeAccessControl{ExpectedEvaluate: false},
&setting.Cfg{},
), nil
case "testdata.datasource.grafana.app":
+1
View File
@@ -151,6 +151,7 @@ func (fm *FeatureManager) IsEditableFromAdminPage(key string) bool {
return false
}
return flag.Stage == FeatureStageGeneralAvailability ||
flag.Stage == FeatureStagePublicPreview ||
flag.Stage == FeatureStageDeprecated
}
+1 -1
View File
@@ -119,7 +119,7 @@ type FeatureFlag struct {
Owner codeowner `json:"-"` // Owner person or team that owns this feature flag
// Recommended properties - control behavior of the feature toggle management page in the UI
AllowSelfServe bool `json:"allowSelfServe,omitempty"` // allow users with the right privileges to toggle this from the UI (GeneralAvailability and Deprecated toggles only)
AllowSelfServe bool `json:"allowSelfServe,omitempty"` // allow users with the right privileges to toggle this from the UI (GeneralAvailability, PublicPreview, and Deprecated toggles only)
HideFromAdminPage bool `json:"hideFromAdminPage,omitempty"` // GA, Deprecated, and PublicPreview toggles only: don't display this feature in the UI; if this is a GA toggle, add a comment with the reasoning
// CEL-GO expression. Using the value "true" will mean this is on by default