Correlations: Hide Correlations Page behind a feature toggle (#55224)

* Hide Correlations Page behind a toggle

* Remove redundant defaults

* Ensure top nav is rendered when correlations are disabled

This is for the case when:

[feature_toggles]
topnav = true
This commit is contained in:
Piotr Jamróz 2022-09-16 15:14:27 +02:00 committed by GitHub
parent 5c66c41220
commit 9b4cdfe652
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 38 additions and 3 deletions

View File

@ -46,6 +46,7 @@ export interface FeatureToggles {
exploreMixedDatasource?: boolean;
tracing?: boolean;
commandPalette?: boolean;
correlations?: boolean;
cloudWatchDynamicLabels?: boolean;
datasourceQueryMultiStatus?: boolean;
traceToMetrics?: boolean;

View File

@ -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",

View File

@ -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",

View File

@ -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"

View File

@ -0,0 +1,21 @@
import React from 'react';
import { Page } from 'app/core/components/Page/Page';
export default function FeatureTogglePage() {
return (
<Page navId="correlations">
<Page.Contents>
<h1>Correlations are disabled</h1>
To enable Correlations, add it in the Grafana config:
<div>
<pre>
{`[feature_toggles]
correlations = true
`}
</pre>
</div>
</Page.Contents>
</Page>
);
}

View File

@ -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'
)
),
},
{