Compare commits

...

2 Commits

Author SHA1 Message Date
Tania B.
e3c0e26022 Merge branch 'main' into undef1nd/ofrep-datagridedit 2026-01-13 17:01:31 +01:00
Tania B.
74639e90d2 Migrate enableDatagridEditing to OpenFeature 2026-01-12 18:20:13 +01:00
2 changed files with 13 additions and 4 deletions

View File

@@ -12,9 +12,11 @@ import (
"github.com/grafana/grafana/pkg/api/dtos"
"github.com/grafana/grafana/pkg/api/webassets"
"github.com/grafana/grafana/pkg/apimachinery/identity"
"github.com/grafana/grafana/pkg/login/social"
"github.com/grafana/grafana/pkg/plugins"
"github.com/grafana/grafana/pkg/services/accesscontrol"
"github.com/grafana/grafana/pkg/services/apiserver/endpoints/request"
"github.com/grafana/grafana/pkg/services/authn"
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
"github.com/grafana/grafana/pkg/services/datasources"
@@ -26,6 +28,7 @@ import (
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/tsdb/grafanads"
"github.com/grafana/grafana/pkg/util"
"github.com/open-feature/go-sdk/openfeature"
)
// GetBootdataAPI returns the same data we currently have rendered into index.html
@@ -150,8 +153,14 @@ func (hs *HTTPServer) getFrontendSettings(c *contextmodel.ReqContext) (*dtos.Fro
continue
}
//nolint:staticcheck // not yet migrated to OpenFeature
if panel.ID == "datagrid" && !hs.Features.IsEnabled(c.Req.Context(), featuremgmt.FlagEnableDatagridEditing) {
ns := request.GetNamespaceMapper(hs.Cfg)(1)
ctx := identity.WithServiceIdentityForSingleNamespaceContext(c.Req.Context(), ns)
evalCtx := openfeature.TransactionContext(ctx)
editingEnabled, err := openfeature.NewDefaultClient().BooleanValueDetails(ctx, featuremgmt.FlagEnableDatagridEditing, false, evalCtx)
if err != nil {
hs.log.Error("flag evaluation error", "flag", featuremgmt.FlagEnableDatagridEditing, "error", err)
}
if panel.ID == "datagrid" && !editingEnabled.Value {
continue
}

View File

@@ -1,5 +1,5 @@
import { config } from '@grafana/runtime';
import { evaluateBooleanFlag } from '@grafana/runtime/internal';
export const isDatagridEnabled = () => {
return config.featureToggles.enableDatagridEditing;
return evaluateBooleanFlag('enableDatagridEditing', false);
};