Feature Highlights: move setting to a feature toggle (#44780)

* Add toggle

* Use the toggle

* Cleanup
This commit is contained in:
Alex Khomenko 2022-02-03 13:53:23 +02:00 committed by GitHub
parent c23bc1e7b7
commit a79c048344
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 16 additions and 15 deletions

View File

@ -501,9 +501,3 @@ The org id of the datasource where the query data will be written.
If all `default_remote_write_*` properties are set, this information will be populated at startup. If a remote write target has
already been configured, nothing will happen.
## [feature_highlights]
### enabled
Whether the feature highlights feature is enabled

View File

@ -36,4 +36,5 @@ export interface FeatureToggles {
showFeatureFlagsInUI?: boolean;
disable_http_request_histogram?: boolean;
validatedQueries?: boolean;
featureHighlights?: boolean;
}

View File

@ -273,9 +273,6 @@ func (hs *HTTPServer) getFrontendSettingsMap(c *models.ReqContext) (map[string]i
"enabled": hs.Cfg.SectionWithEnvOverrides("recorded_queries").Key("enabled").MustBool(true),
},
"unifiedAlertingEnabled": hs.Cfg.UnifiedAlerting.Enabled,
"featureHighlights": map[string]bool{
"enabled": hs.SettingsProvider.Section("feature_highlights").KeyValue("enabled").MustBool(false),
},
}
if hs.Cfg.GeomapDefaultBaseLayerConfig != nil {

View File

@ -110,5 +110,10 @@ var (
State: FeatureStateAlpha,
RequiresDevMode: true,
},
{
Name: "featureHighlights",
Description: "Highlight Enterprise features",
State: FeatureStateStable,
},
}
)

View File

@ -82,4 +82,8 @@ const (
// FlagValidatedQueries
// only execute the query saved in a panel
FlagValidatedQueries = "validatedQueries"
// FlagFeatureHighlights
// Highlight Enterprise features
FlagFeatureHighlights = "featureHighlights"
)

View File

@ -8,7 +8,7 @@ import { GenericDataSourcePlugin } from '../settings/PluginSettings';
export function buildNavModel(dataSource: DataSourceSettings, plugin: GenericDataSourcePlugin): NavModelItem {
const pluginMeta = plugin.meta;
const highlightsEnabled = config.featureToggles.featureHighlights;
const navModel: NavModelItem = {
img: pluginMeta.info.logos.large,
id: 'datasource-' + dataSource.uid,
@ -61,7 +61,7 @@ export function buildNavModel(dataSource: DataSourceSettings, plugin: GenericDat
if (contextSrv.hasPermission(AccessControlAction.DataSourcesPermissionsRead)) {
navModel.children!.push(dsPermissions);
}
} else if (config.featureHighlights.enabled) {
} else if (highlightsEnabled) {
navModel.children!.push({
...dsPermissions,
url: dsPermissions.url + '/upgrade',
@ -79,7 +79,7 @@ export function buildNavModel(dataSource: DataSourceSettings, plugin: GenericDat
if (featureEnabled('analytics')) {
navModel.children!.push(analytics);
} else if (config.featureHighlights.enabled) {
} else if (highlightsEnabled) {
navModel.children!.push({
...analytics,
url: analytics.url + '/upgrade',
@ -98,7 +98,7 @@ export function buildNavModel(dataSource: DataSourceSettings, plugin: GenericDat
if (featureEnabled('caching')) {
navModel.children!.push(caching);
} else if (config.featureHighlights.enabled) {
} else if (highlightsEnabled) {
navModel.children!.push({
...caching,
url: caching.url + '/upgrade',

View File

@ -130,7 +130,7 @@ export class TeamPages extends PureComponent<Props, State> {
case PageTypes.GroupSync:
if (isSignedInUserTeamAdmin && isSyncEnabled) {
return <TeamGroupSync />;
} else if (config.featureHighlights.enabled) {
} else if (config.featureToggles.featureHighlights) {
return (
<UpgradeBox
text={

View File

@ -40,7 +40,7 @@ export function buildNavModel(team: Team): NavModelItem {
if (featureEnabled('teamsync')) {
navModel.children!.push(teamGroupSync);
} else if (config.featureHighlights.enabled) {
} else if (config.featureToggles.featureHighlights) {
navModel.children!.push({ ...teamGroupSync, tabSuffix: ProBadge });
}