diff --git a/packages/grafana-data/src/types/featureToggles.gen.ts b/packages/grafana-data/src/types/featureToggles.gen.ts index 1d01c4bf423..3a8f8306097 100644 --- a/packages/grafana-data/src/types/featureToggles.gen.ts +++ b/packages/grafana-data/src/types/featureToggles.gen.ts @@ -46,6 +46,7 @@ export interface FeatureToggles { exploreMixedDatasource?: boolean; tracing?: boolean; commandPalette?: boolean; + correlations?: boolean; cloudWatchDynamicLabels?: boolean; datasourceQueryMultiStatus?: boolean; traceToMetrics?: boolean; diff --git a/pkg/api/index.go b/pkg/api/index.go index e054aac9fff..97f8b7d7240 100644 --- a/pkg/api/index.go +++ b/pkg/api/index.go @@ -356,7 +356,7 @@ func (hs *HTTPServer) setupConfigNodes(c *models.ReqContext) ([]*dtos.NavLink, e }) } - if hasAccess(ac.ReqOrgAdmin, correlations.ConfigurationPageAccess) { + if hs.Features.IsEnabled(featuremgmt.FlagCorrelations) && hasAccess(ac.ReqOrgAdmin, correlations.ConfigurationPageAccess) { configNodes = append(configNodes, &dtos.NavLink{ Text: "Correlations", Icon: "gf-glue", diff --git a/pkg/services/featuremgmt/registry.go b/pkg/services/featuremgmt/registry.go index 781ef89aef6..a475957440c 100644 --- a/pkg/services/featuremgmt/registry.go +++ b/pkg/services/featuremgmt/registry.go @@ -172,6 +172,11 @@ var ( Description: "Enable command palette", State: FeatureStateAlpha, }, + { + Name: "correlations", + Description: "Correlations page", + State: FeatureStateAlpha, + }, { Name: "cloudWatchDynamicLabels", Description: "Use dynamic labels instead of alias patterns in CloudWatch datasource", diff --git a/pkg/services/featuremgmt/toggles_gen.go b/pkg/services/featuremgmt/toggles_gen.go index d055159894a..c98d7cdee2f 100644 --- a/pkg/services/featuremgmt/toggles_gen.go +++ b/pkg/services/featuremgmt/toggles_gen.go @@ -127,6 +127,10 @@ const ( // Enable command palette FlagCommandPalette = "commandPalette" + // FlagCorrelations + // Correlations page + FlagCorrelations = "correlations" + // FlagCloudWatchDynamicLabels // Use dynamic labels instead of alias patterns in CloudWatch datasource FlagCloudWatchDynamicLabels = "cloudWatchDynamicLabels" diff --git a/public/app/features/correlations/CorrelationsFeatureToggle.tsx b/public/app/features/correlations/CorrelationsFeatureToggle.tsx new file mode 100644 index 00000000000..a2cc7e5ec91 --- /dev/null +++ b/public/app/features/correlations/CorrelationsFeatureToggle.tsx @@ -0,0 +1,21 @@ +import React from 'react'; + +import { Page } from 'app/core/components/Page/Page'; + +export default function FeatureTogglePage() { + return ( + + +

Correlations are disabled

+ To enable Correlations, add it in the Grafana config: +
+
+            {`[feature_toggles]
+correlations = true
+`}
+          
+
+
+
+ ); +} diff --git a/public/app/routes/routes.tsx b/public/app/routes/routes.tsx index 009f784a511..2555cac9131 100644 --- a/public/app/routes/routes.tsx +++ b/public/app/routes/routes.tsx @@ -147,8 +147,12 @@ export function getAppRoutes(): RouteDescriptor[] { }, { path: '/datasources/correlations', - component: SafeDynamicImport( - () => import(/* webpackChunkName: "CorrelationsPage" */ 'app/features/correlations/CorrelationsPage') + component: SafeDynamicImport(() => + config.featureToggles.correlations + ? import(/* webpackChunkName: "CorrelationsPage" */ 'app/features/correlations/CorrelationsPage') + : import( + /* webpackChunkName: "CorrelationsFeatureToggle" */ 'app/features/correlations/CorrelationsFeatureToggle' + ) ), }, {