From 3f51bf5e9f3be53cba23a4bc55d658ec0c227ddd Mon Sep 17 00:00:00 2001 From: Nathan L Smith Date: Mon, 16 Nov 2020 09:23:28 -0600 Subject: [PATCH 01/21] 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. --- .../public/management_app/lib/get_category_name.ts | 6 ++++++ x-pack/plugins/apm/server/ui_settings.ts | 4 ++-- x-pack/plugins/ml/server/lib/register_settings.ts | 6 +++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/plugins/advanced_settings/public/management_app/lib/get_category_name.ts b/src/plugins/advanced_settings/public/management_app/lib/get_category_name.ts index 31df6875c97d9..c8fbe8009c9bb 100644 --- a/src/plugins/advanced_settings/public/management_app/lib/get_category_name.ts +++ b/src/plugins/advanced_settings/public/management_app/lib/get_category_name.ts @@ -25,6 +25,12 @@ const names: Record = { 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', }), diff --git a/x-pack/plugins/apm/server/ui_settings.ts b/x-pack/plugins/apm/server/ui_settings.ts index fe5b11d89d716..4932d9f79a383 100644 --- a/x-pack/plugins/apm/server/ui_settings.ts +++ b/x-pack/plugins/apm/server/ui_settings.ts @@ -17,7 +17,7 @@ import { */ export const uiSettings: Record> = { [enableCorrelations]: { - category: ['Observability'], + category: ['observability'], name: i18n.translate('xpack.apm.enableCorrelationsExperimentName', { defaultMessage: 'APM Correlations', }), @@ -32,7 +32,7 @@ export const uiSettings: Record> = { schema: schema.boolean(), }, [enableServiceOverview]: { - category: ['Observability'], + category: ['observability'], name: i18n.translate('xpack.apm.enableServiceOverviewExperimentName', { defaultMessage: 'APM Service overview', }), diff --git a/x-pack/plugins/ml/server/lib/register_settings.ts b/x-pack/plugins/ml/server/lib/register_settings.ts index a9ee24fbb5cea..0cdaaadf7f172 100644 --- a/x-pack/plugins/ml/server/lib/register_settings.ts +++ b/x-pack/plugins/ml/server/lib/register_settings.ts @@ -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'], }, }); } From b8b880662868e26c1264b6f68dcc968285436a08 Mon Sep 17 00:00:00 2001 From: Dan Panzarella Date: Mon, 16 Nov 2020 11:19:03 -0500 Subject: [PATCH 02/21] [Security Solution] Gracefully handle errors in detection rules install (#83306) --- .../routes/rules/add_prepackaged_rules_route.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/add_prepackaged_rules_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/add_prepackaged_rules_route.ts index f885445c29b04..a3b378a6ef04a 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/add_prepackaged_rules_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/add_prepackaged_rules_route.ts @@ -115,12 +115,15 @@ export const createPrepackagedRules = async ( ); } } - const result = await Promise.all([ - installPrepackagedRules(alertsClient, rulesToInstall, signalsIndex), - installPrepackagedTimelines(maxTimelineImportExportSize, frameworkRequest, true), - ]); + + await Promise.all(installPrepackagedRules(alertsClient, rulesToInstall, signalsIndex)); + const timeline = await installPrepackagedTimelines( + maxTimelineImportExportSize, + frameworkRequest, + true + ); const [prepackagedTimelinesResult, timelinesErrors] = validate( - result[1], + timeline, importTimelineResultSchema ); await updatePrepackagedRules(alertsClient, savedObjectsClient, rulesToUpdate, signalsIndex); From e1500bf86af5d4e1db0b2a8c92ea26504e138b98 Mon Sep 17 00:00:00 2001 From: Marco Liberati Date: Mon, 16 Nov 2020 17:22:35 +0100 Subject: [PATCH 03/21] [Lens] Make the dimension flyout panel stay close on outside click (#83059) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../definitions/filters/filter_popover.tsx | 20 +++++++++++------- .../definitions/ranges/advanced_editor.tsx | 21 +++++++++++++------ 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filter_popover.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filter_popover.tsx index b023a9a5a3ec5..b9d9d6306b9ae 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filter_popover.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filter_popover.tsx @@ -32,9 +32,13 @@ export const FilterPopover = ({ const [isPopoverOpen, setIsPopoverOpen] = useState(false); const inputRef = React.useRef(); - const setPopoverOpen = (isOpen: boolean) => { - setIsPopoverOpen(isOpen); - setIsOpenByCreation(isOpen); + const closePopover = () => { + if (isOpenByCreation) { + setIsOpenByCreation(false); + } + if (isPopoverOpen) { + setIsPopoverOpen(false); + } }; const setFilterLabel = (label: string) => setFilter({ ...filter, label }); @@ -57,14 +61,14 @@ export const FilterPopover = ({ panelClassName="lnsIndexPatternDimensionEditor__filtersEditor" isOpen={isOpenByCreation || isPopoverOpen} ownFocus - closePopover={() => { - setPopoverOpen(false); - }} + closePopover={() => closePopover()} button={