Fix advanced settings category sorting (#83394)

In the advanced settings categories, "Observability" and "Machine Learning" were using uppercase letters in their keys while everything else was using lowercase

This caused them both to show up before the rest of the options in the dropdown and in the sorting in the advanced settings UI.

Add keys for them to the get_category_name module in the advanced settings plugin and use those keys in the plugins that apply these categories.

This also makes it so i18n keys are available for these items.

Fixes #81974.
This commit is contained in:
Nathan L Smith 2020-11-16 09:23:28 -06:00 committed by GitHub
parent 3ba7758a4f
commit 3f51bf5e9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 5 deletions

View file

@ -25,6 +25,12 @@ const names: Record<string, string> = {
general: i18n.translate('advancedSettings.categoryNames.generalLabel', {
defaultMessage: 'General',
}),
machineLearning: i18n.translate('advancedSettings.categoryNames.machineLearningLabel', {
defaultMessage: 'Machine Learning',
}),
observability: i18n.translate('advancedSettings.categoryNames.observabilityLabel', {
defaultMessage: 'Observability',
}),
timelion: i18n.translate('advancedSettings.categoryNames.timelionLabel', {
defaultMessage: 'Timelion',
}),

View file

@ -17,7 +17,7 @@ import {
*/
export const uiSettings: Record<string, UiSettingsParams<boolean>> = {
[enableCorrelations]: {
category: ['Observability'],
category: ['observability'],
name: i18n.translate('xpack.apm.enableCorrelationsExperimentName', {
defaultMessage: 'APM Correlations',
}),
@ -32,7 +32,7 @@ export const uiSettings: Record<string, UiSettingsParams<boolean>> = {
schema: schema.boolean(),
},
[enableServiceOverview]: {
category: ['Observability'],
category: ['observability'],
name: i18n.translate('xpack.apm.enableServiceOverviewExperimentName', {
defaultMessage: 'APM Service overview',
}),

View file

@ -27,7 +27,7 @@ export function registerKibanaSettings(coreSetup: CoreSetup) {
defaultMessage:
'Sets the file size limit when importing data in the File Data Visualizer. The highest supported value for this setting is 1GB.',
}),
category: ['Machine Learning'],
category: ['machineLearning'],
schema: schema.string(),
validation: {
regexString: '\\d+[mMgG][bB]',
@ -49,7 +49,7 @@ export function registerKibanaSettings(coreSetup: CoreSetup) {
'Use the default time filter in the Single Metric Viewer and Anomaly Explorer. If not enabled, the results for the full time range of the job are displayed.',
}
),
category: ['Machine Learning'],
category: ['machineLearning'],
},
[ANOMALY_DETECTION_DEFAULT_TIME_RANGE]: {
name: i18n.translate('xpack.ml.advancedSettings.anomalyDetectionDefaultTimeRangeName', {
@ -69,7 +69,7 @@ export function registerKibanaSettings(coreSetup: CoreSetup) {
to: schema.string(),
}),
requiresPageReload: true,
category: ['Machine Learning'],
category: ['machineLearning'],
},
});
}