From 05d1e326a4680fb55347396a7b0053c576726b18 Mon Sep 17 00:00:00 2001 From: Marshall Main <55718608+marshallmain@users.noreply.github.com> Date: Wed, 18 Aug 2021 07:37:14 -0700 Subject: [PATCH 1/8] [RAC][Security Solution] Remove ALERT_RULE_ID in favor of ALERT_RULE_UUID (#108922) * Remove ALERT_RULE_ID in favor of ALERT_RULE_UUID * Update snapshot * KEVINNN * fix test * Add back home.disableWelcomeScreen=true * Only disable welcome screen in security solution cypress tests Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../src/technical_field_names.ts | 3 --- .../assets/field_maps/technical_rule_field_map.ts | 5 ----- .../components/alerts_table/default_config.tsx | 2 -- .../get_signals_template.test.ts.snap | 8 ++++---- .../routes/index/signal_aad_mapping.json | 2 +- .../rule_registry_log_client.ts | 14 +++++++------- .../timeline/cases/add_to_case_action.test.tsx | 5 +++-- .../timelines/public/hooks/use_add_to_case.ts | 7 ++----- x-pack/test/security_solution_cypress/config.ts | 1 + 9 files changed, 18 insertions(+), 29 deletions(-) diff --git a/packages/kbn-rule-data-utils/src/technical_field_names.ts b/packages/kbn-rule-data-utils/src/technical_field_names.ts index 4b3f3fbb6f370..2aa23195df899 100644 --- a/packages/kbn-rule-data-utils/src/technical_field_names.ts +++ b/packages/kbn-rule-data-utils/src/technical_field_names.ts @@ -49,7 +49,6 @@ const ALERT_RULE_CREATED_BY = `${ALERT_RULE_NAMESPACE}.created_by` as const; const ALERT_RULE_DESCRIPTION = `${ALERT_RULE_NAMESPACE}.description` as const; const ALERT_RULE_ENABLED = `${ALERT_RULE_NAMESPACE}.enabled` as const; const ALERT_RULE_FROM = `${ALERT_RULE_NAMESPACE}.from` as const; -const ALERT_RULE_ID = `${ALERT_RULE_NAMESPACE}.id` as const; const ALERT_RULE_INTERVAL = `${ALERT_RULE_NAMESPACE}.interval` as const; const ALERT_RULE_LICENSE = `${ALERT_RULE_NAMESPACE}.license` as const; const ALERT_RULE_CATEGORY = `${ALERT_RULE_NAMESPACE}.category` as const; @@ -108,7 +107,6 @@ const fields = { ALERT_RULE_DESCRIPTION, ALERT_RULE_ENABLED, ALERT_RULE_FROM, - ALERT_RULE_ID, ALERT_RULE_INTERVAL, ALERT_RULE_LICENSE, ALERT_RULE_NAME, @@ -166,7 +164,6 @@ export { ALERT_RULE_DESCRIPTION, ALERT_RULE_ENABLED, ALERT_RULE_FROM, - ALERT_RULE_ID, ALERT_RULE_INTERVAL, ALERT_RULE_LICENSE, ALERT_RULE_NAME, diff --git a/x-pack/plugins/rule_registry/common/assets/field_maps/technical_rule_field_map.ts b/x-pack/plugins/rule_registry/common/assets/field_maps/technical_rule_field_map.ts index eb8d88cf697b9..f6566ee75920f 100644 --- a/x-pack/plugins/rule_registry/common/assets/field_maps/technical_rule_field_map.ts +++ b/x-pack/plugins/rule_registry/common/assets/field_maps/technical_rule_field_map.ts @@ -95,11 +95,6 @@ export const technicalRuleFieldMap = { array: false, required: false, }, - [Fields.ALERT_RULE_ID]: { - type: 'keyword', - array: false, - required: false, - }, [Fields.ALERT_RULE_CREATED_AT]: { type: 'date', array: false, diff --git a/x-pack/plugins/security_solution/public/detections/components/alerts_table/default_config.tsx b/x-pack/plugins/security_solution/public/detections/components/alerts_table/default_config.tsx index 0519e3f2d4a75..75bd41037934b 100644 --- a/x-pack/plugins/security_solution/public/detections/components/alerts_table/default_config.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/alerts_table/default_config.tsx @@ -13,7 +13,6 @@ import { ALERT_STATUS, ALERT_UUID, ALERT_RULE_UUID, - ALERT_RULE_ID, ALERT_RULE_NAME, ALERT_RULE_CATEGORY, } from '@kbn/rule-data-utils'; @@ -190,7 +189,6 @@ export const requiredFieldMappingsForActionsRuleRegistry = { 'alert.status': ALERT_STATUS, 'alert.duration.us': ALERT_DURATION, 'rule.uuid': ALERT_RULE_UUID, - 'rule.id': ALERT_RULE_ID, 'rule.name': ALERT_RULE_NAME, 'rule.category': ALERT_RULE_CATEGORY, producer: ALERT_RULE_PRODUCER, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/__snapshots__/get_signals_template.test.ts.snap b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/__snapshots__/get_signals_template.test.ts.snap index b93fec8e99ca5..833a9084fdac6 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/__snapshots__/get_signals_template.test.ts.snap +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/__snapshots__/get_signals_template.test.ts.snap @@ -1838,10 +1838,6 @@ Object { "path": "signal.rule.from", "type": "alias", }, - "kibana.alert.rule.id": Object { - "path": "signal.rule.id", - "type": "alias", - }, "kibana.alert.rule.immutable": Object { "path": "signal.rule.immutable", "type": "alias", @@ -2034,6 +2030,10 @@ Object { "path": "signal.rule.updated_by", "type": "alias", }, + "kibana.alert.rule.uuid": Object { + "path": "signal.rule.id", + "type": "alias", + }, "kibana.alert.rule.version": Object { "path": "signal.rule.version", "type": "alias", diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/signal_aad_mapping.json b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/signal_aad_mapping.json index 68c184b66c562..8391d490162df 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/signal_aad_mapping.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/signal_aad_mapping.json @@ -35,7 +35,7 @@ "signal.rule.enabled": "kibana.alert.rule.enabled", "signal.rule.false_positives": "kibana.alert.rule.false_positives", "signal.rule.from": "kibana.alert.rule.from", - "signal.rule.id": "kibana.alert.rule.id", + "signal.rule.id": "kibana.alert.rule.uuid", "signal.rule.immutable": "kibana.alert.rule.immutable", "signal.rule.index": "kibana.alert.rule.index", "signal.rule.interval": "kibana.alert.rule.interval", diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_execution_log/rule_registry_log_client/rule_registry_log_client.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_execution_log/rule_registry_log_client/rule_registry_log_client.ts index 3f2f34c17679f..5445184c450fe 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_execution_log/rule_registry_log_client/rule_registry_log_client.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_execution_log/rule_registry_log_client/rule_registry_log_client.ts @@ -13,7 +13,7 @@ import { EVENT_KIND, SPACE_IDS, TIMESTAMP, - ALERT_RULE_ID, + ALERT_RULE_UUID, } from '@kbn/rule-data-utils'; import moment from 'moment'; @@ -98,7 +98,7 @@ export class RuleRegistryLogClient implements IRuleRegistryLogClient { } const filter: estypes.QueryDslQueryContainer[] = [ - { terms: { [ALERT_RULE_ID]: ruleIds } }, + { terms: { [ALERT_RULE_UUID]: ruleIds } }, { terms: { [SPACE_IDS]: [spaceId] } }, ]; @@ -117,7 +117,7 @@ export class RuleRegistryLogClient implements IRuleRegistryLogClient { aggs: { rules: { terms: { - field: ALERT_RULE_ID, + field: ALERT_RULE_UUID, size: ruleIds.length, }, aggs: { @@ -151,7 +151,7 @@ export class RuleRegistryLogClient implements IRuleRegistryLogClient { bucket.most_recent_logs.hits.hits.map((event) => { const logEntry = parseRuleExecutionLog(event._source); invariant( - logEntry[ALERT_RULE_ID] ?? '', + logEntry[ALERT_RULE_UUID] ?? '', 'Malformed execution log entry: rule.id field not found' ); @@ -185,7 +185,7 @@ export class RuleRegistryLogClient implements IRuleRegistryLogClient { ] : undefined; - const alertId = logEntry[ALERT_RULE_ID] ?? ''; + const alertId = logEntry[ALERT_RULE_UUID] ?? ''; const statusDate = logEntry[TIMESTAMP]; const lastFailureAt = lastFailure?.[TIMESTAMP]; const lastFailureMessage = lastFailure?.[MESSAGE]; @@ -232,7 +232,7 @@ export class RuleRegistryLogClient implements IRuleRegistryLogClient { [EVENT_ACTION]: metric, [EVENT_KIND]: 'metric', [getMetricField(metric)]: value, - [ALERT_RULE_ID]: ruleId ?? '', + [ALERT_RULE_UUID]: ruleId ?? '', [TIMESTAMP]: new Date().toISOString(), [ALERT_RULE_CONSUMER]: SERVER_APP_ID, [ALERT_RULE_TYPE_ID]: SERVER_APP_ID, @@ -255,7 +255,7 @@ export class RuleRegistryLogClient implements IRuleRegistryLogClient { [EVENT_KIND]: 'event', [EVENT_SEQUENCE]: this.sequence++, [MESSAGE]: message, - [ALERT_RULE_ID]: ruleId ?? '', + [ALERT_RULE_UUID]: ruleId ?? '', [RULE_STATUS_SEVERITY]: statusSeverityDict[newStatus], [RULE_STATUS]: newStatus, [TIMESTAMP]: new Date().toISOString(), diff --git a/x-pack/plugins/timelines/public/components/actions/timeline/cases/add_to_case_action.test.tsx b/x-pack/plugins/timelines/public/components/actions/timeline/cases/add_to_case_action.test.tsx index fb7899165bb3d..19206c40d18c2 100644 --- a/x-pack/plugins/timelines/public/components/actions/timeline/cases/add_to_case_action.test.tsx +++ b/x-pack/plugins/timelines/public/components/actions/timeline/cases/add_to_case_action.test.tsx @@ -11,6 +11,7 @@ import { TestProviders, mockGetAllCasesSelectorModal } from '../../../../mock'; import { AddToCaseAction } from './add_to_case_action'; import { SECURITY_SOLUTION_OWNER } from '../../../../../../cases/common'; import { AddToCaseActionButton } from './add_to_case_action_button'; +import { ALERT_RULE_UUID } from '@kbn/rule-data-utils'; jest.mock('react-router-dom', () => ({ useLocation: () => ({ @@ -100,7 +101,7 @@ describe('AddToCaseAction', () => { {...props} event={{ _id: 'test-id', - data: [{ field: 'kibana.alert.rule.id', value: ['rule-id'] }], + data: [{ field: ALERT_RULE_UUID, value: ['rule-id'] }], ecs: { _id: 'test-id', _index: 'test-index', @@ -112,7 +113,7 @@ describe('AddToCaseAction', () => { {...props} event={{ _id: 'test-id', - data: [{ field: 'kibana.alert.rule.id', value: ['rule-id'] }], + data: [{ field: ALERT_RULE_UUID, value: ['rule-id'] }], ecs: { _id: 'test-id', _index: 'test-index', diff --git a/x-pack/plugins/timelines/public/hooks/use_add_to_case.ts b/x-pack/plugins/timelines/public/hooks/use_add_to_case.ts index a519c4869fa32..f5bb27b3a5614 100644 --- a/x-pack/plugins/timelines/public/hooks/use_add_to_case.ts +++ b/x-pack/plugins/timelines/public/hooks/use_add_to_case.ts @@ -8,7 +8,7 @@ import { isEmpty } from 'lodash'; import { useState, useCallback, useMemo, SyntheticEvent } from 'react'; import { useLocation } from 'react-router-dom'; import { useDispatch } from 'react-redux'; -import { ALERT_RULE_ID, ALERT_RULE_NAME, ALERT_RULE_UUID } from '@kbn/rule-data-utils'; +import { ALERT_RULE_NAME, ALERT_RULE_UUID } from '@kbn/rule-data-utils'; import { useKibana } from '../../../../../src/plugins/kibana_react/public'; import { Case, SubCase } from '../../../cases/common'; import { TimelinesStartServices } from '../types'; @@ -243,15 +243,12 @@ export const useAddToCase = ({ }; export function normalizedEventFields(event?: TimelineItem) { - const ruleId = event && event.data.find(({ field }) => field === ALERT_RULE_ID); const ruleUuid = event && event.data.find(({ field }) => field === ALERT_RULE_UUID); const ruleName = event && event.data.find(({ field }) => field === ALERT_RULE_NAME); - const ruleIdValue = ruleId && ruleId.value && ruleId.value[0]; const ruleUuidValue = ruleUuid && ruleUuid.value && ruleUuid.value[0]; const ruleNameValue = ruleName && ruleName.value && ruleName.value[0]; - const idToUse = ruleIdValue ? ruleIdValue : ruleUuidValue; return { - ruleId: idToUse ?? null, + ruleId: ruleUuidValue ?? null, ruleName: ruleNameValue ?? null, }; } diff --git a/x-pack/test/security_solution_cypress/config.ts b/x-pack/test/security_solution_cypress/config.ts index 0026f5897019e..d22ff564beb2c 100644 --- a/x-pack/test/security_solution_cypress/config.ts +++ b/x-pack/test/security_solution_cypress/config.ts @@ -40,6 +40,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { // retrieve rules from the filesystem but not from fleet for Cypress tests '--xpack.securitySolution.prebuiltRulesFromFileSystem=true', '--xpack.securitySolution.prebuiltRulesFromSavedObjects=false', + `--home.disableWelcomeScreen=true`, ], }, }; From 92dcef9f26719602800bbc875ec274b24613bdb8 Mon Sep 17 00:00:00 2001 From: Tim Roes Date: Wed, 18 Aug 2021 17:04:58 +0200 Subject: [PATCH 2/8] Hide "Manage Searches" if insufficient permissions (#109099) --- .../open_search_panel.test.tsx.snap | 3 +- .../top_nav/open_search_panel.test.tsx | 26 +++++++++-- .../components/top_nav/open_search_panel.tsx | 45 +++++++++++-------- 3 files changed, 51 insertions(+), 23 deletions(-) diff --git a/src/plugins/discover/public/application/apps/main/components/top_nav/__snapshots__/open_search_panel.test.tsx.snap b/src/plugins/discover/public/application/apps/main/components/top_nav/__snapshots__/open_search_panel.test.tsx.snap index 2c2674b158bfc..6043a5d382598 100644 --- a/src/plugins/discover/public/application/apps/main/components/top_nav/__snapshots__/open_search_panel.test.tsx.snap +++ b/src/plugins/discover/public/application/apps/main/components/top_nav/__snapshots__/open_search_panel.test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`render 1`] = ` +exports[`OpenSearchPanel render 1`] = ` { return { getServices: () => ({ core: { uiSettings: {}, savedObjects: {} }, addBasePath: (path: string) => path, + capabilities: mockCapabilities(), }), }; }); import { OpenSearchPanel } from './open_search_panel'; -test('render', () => { - const component = shallow(); - expect(component).toMatchSnapshot(); +describe('OpenSearchPanel', () => { + test('render', () => { + const component = shallow(); + expect(component).toMatchSnapshot(); + }); + + test('should not render manage searches button without permissions', () => { + mockCapabilities.mockReturnValue({ + savedObjectsManagement: { + edit: false, + delete: false, + }, + }); + const component = shallow(); + expect(component.find('[data-test-subj="manageSearches"]').exists()).toBe(false); + }); }); diff --git a/src/plugins/discover/public/application/apps/main/components/top_nav/open_search_panel.tsx b/src/plugins/discover/public/application/apps/main/components/top_nav/open_search_panel.tsx index e63f010a8dffc..31026a1e0ab59 100644 --- a/src/plugins/discover/public/application/apps/main/components/top_nav/open_search_panel.tsx +++ b/src/plugins/discover/public/application/apps/main/components/top_nav/open_search_panel.tsx @@ -34,8 +34,12 @@ export function OpenSearchPanel(props: OpenSearchPanelProps) { const { core: { uiSettings, savedObjects }, addBasePath, + capabilities, } = getServices(); + const hasSavedObjectPermission = + capabilities.savedObjectsManagement?.edit || capabilities.savedObjectsManagement?.delete; + return ( @@ -73,25 +77,28 @@ export function OpenSearchPanel(props: OpenSearchPanelProps) { savedObjects={savedObjects} /> - - - - {/* eslint-disable-next-line @elastic/eui/href-or-on-click */} - - - - - - + {hasSavedObjectPermission && ( + + + + {/* eslint-disable-next-line @elastic/eui/href-or-on-click */} + + + + + + + )} ); } From 6a1a1afd3a891d8b7a9dc53e3fd29fc2ebac9241 Mon Sep 17 00:00:00 2001 From: Liza Katz Date: Wed, 18 Aug 2021 17:08:42 +0200 Subject: [PATCH 3/8] [Data cleanup] Remove geo filters (#109097) * Remove geo bounding box and geo polygon filters * delete geo filters * delete geo filters * geo * remove geo docs --- ...na-plugin-plugins-data-public.esfilters.md | 2 +- .../geo_bounding_box_filter.test.ts | 36 -------- .../build_filters/geo_bounding_box_filter.ts | 41 --------- .../build_filters/geo_polygon_filter.test.ts | 34 -------- .../build_filters/geo_polygon_filter.ts | 39 --------- .../filters/build_filters/get_filter_field.ts | 8 -- .../src/filters/build_filters/index.ts | 2 - .../src/filters/build_filters/types.ts | 6 -- packages/kbn-es-query/src/filters/index.ts | 4 - src/plugins/data/common/es_query/index.ts | 32 ------- src/plugins/data/public/public.api.md | 2 +- .../query/filter_manager/lib/map_filter.ts | 4 - .../lib/mappers/map_geo_bounding_box.test.ts | 85 ------------------- .../lib/mappers/map_geo_bounding_box.ts | 47 ---------- .../lib/mappers/map_geo_polygon.test.ts | 77 ----------------- .../lib/mappers/map_geo_polygon.ts | 40 --------- .../filter_editor/lib/filter_label.tsx | 14 --- 17 files changed, 2 insertions(+), 471 deletions(-) delete mode 100644 packages/kbn-es-query/src/filters/build_filters/geo_bounding_box_filter.test.ts delete mode 100644 packages/kbn-es-query/src/filters/build_filters/geo_bounding_box_filter.ts delete mode 100644 packages/kbn-es-query/src/filters/build_filters/geo_polygon_filter.test.ts delete mode 100644 packages/kbn-es-query/src/filters/build_filters/geo_polygon_filter.ts delete mode 100644 src/plugins/data/public/query/filter_manager/lib/mappers/map_geo_bounding_box.test.ts delete mode 100644 src/plugins/data/public/query/filter_manager/lib/mappers/map_geo_bounding_box.ts delete mode 100644 src/plugins/data/public/query/filter_manager/lib/mappers/map_geo_polygon.test.ts delete mode 100644 src/plugins/data/public/query/filter_manager/lib/mappers/map_geo_polygon.ts diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md index b5d5c5cfee5ad..2500ed9b2bc05 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md @@ -28,7 +28,7 @@ esFilters: { isPhraseFilter: (filter: import("@kbn/es-query").FieldFilter) => filter is import("@kbn/es-query").PhraseFilter; isExistsFilter: (filter: import("@kbn/es-query").FieldFilter) => filter is import("@kbn/es-query").ExistsFilter; isPhrasesFilter: (filter: import("@kbn/es-query").FieldFilter) => filter is import("@kbn/es-query").PhrasesFilter; - isRangeFilter: (filter?: import("@kbn/es-query").ExistsFilter | import("@kbn/es-query").GeoPolygonFilter | import("@kbn/es-query").PhrasesFilter | import("@kbn/es-query").PhraseFilter | import("@kbn/es-query").MatchAllFilter | import("@kbn/es-query").MissingFilter | import("@kbn/es-query").RangeFilter | import("@kbn/es-query").GeoBoundingBoxFilter | undefined) => filter is import("@kbn/es-query").RangeFilter; + isRangeFilter: (filter?: import("@kbn/es-query").ExistsFilter | import("@kbn/es-query").PhrasesFilter | import("@kbn/es-query").PhraseFilter | import("@kbn/es-query").MatchAllFilter | import("@kbn/es-query").MissingFilter | import("@kbn/es-query").RangeFilter | undefined) => filter is import("@kbn/es-query").RangeFilter; isMatchAllFilter: (filter: import("@kbn/es-query").FieldFilter) => filter is import("@kbn/es-query").MatchAllFilter; isMissingFilter: (filter: import("@kbn/es-query").FieldFilter) => filter is import("@kbn/es-query").MissingFilter; isQueryStringFilter: (filter: import("@kbn/es-query").FieldFilter) => filter is import("@kbn/es-query/target_types/filters/build_filters").QueryStringFilter; diff --git a/packages/kbn-es-query/src/filters/build_filters/geo_bounding_box_filter.test.ts b/packages/kbn-es-query/src/filters/build_filters/geo_bounding_box_filter.test.ts deleted file mode 100644 index af42e3f2c73fb..0000000000000 --- a/packages/kbn-es-query/src/filters/build_filters/geo_bounding_box_filter.test.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { getGeoBoundingBoxFilterField } from './geo_bounding_box_filter'; - -describe('geo_bounding_box filter', function () { - describe('getGeoBoundingBoxFilterField', function () { - it('should return the name of the field a geo_bounding_box query is targeting', () => { - const filter = { - geo_bounding_box: { - geoPointField: { - bottom_right: { lat: 1, lon: 1 }, - top_left: { lat: 1, lon: 1 }, - }, - ignore_unmapped: true, - }, - meta: { - disabled: false, - negate: false, - alias: null, - params: { - bottom_right: { lat: 1, lon: 1 }, - top_left: { lat: 1, lon: 1 }, - }, - }, - }; - const result = getGeoBoundingBoxFilterField(filter); - expect(result).toBe('geoPointField'); - }); - }); -}); diff --git a/packages/kbn-es-query/src/filters/build_filters/geo_bounding_box_filter.ts b/packages/kbn-es-query/src/filters/build_filters/geo_bounding_box_filter.ts deleted file mode 100644 index 9066b695c17fc..0000000000000 --- a/packages/kbn-es-query/src/filters/build_filters/geo_bounding_box_filter.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { has } from 'lodash'; -import type { FieldFilter, Filter, FilterMeta, LatLon } from './types'; - -export type GeoBoundingBoxFilterMeta = FilterMeta & { - params: { - bottom_right: LatLon; - top_left: LatLon; - }; -}; - -export type GeoBoundingBoxFilter = Filter & { - meta: GeoBoundingBoxFilterMeta; - geo_bounding_box: any; -}; - -/** - * @param filter - * @returns `true` if a filter is an `GeoBoundingBoxFilter` - * - * @public - */ -export const isGeoBoundingBoxFilter = (filter: FieldFilter): filter is GeoBoundingBoxFilter => - has(filter, 'geo_bounding_box'); - -/** - * @internal - */ -export const getGeoBoundingBoxFilterField = (filter: GeoBoundingBoxFilter) => { - return ( - filter.geo_bounding_box && - Object.keys(filter.geo_bounding_box).find((key) => key !== 'ignore_unmapped') - ); -}; diff --git a/packages/kbn-es-query/src/filters/build_filters/geo_polygon_filter.test.ts b/packages/kbn-es-query/src/filters/build_filters/geo_polygon_filter.test.ts deleted file mode 100644 index 919ccbe427cd6..0000000000000 --- a/packages/kbn-es-query/src/filters/build_filters/geo_polygon_filter.test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { getGeoPolygonFilterField } from './geo_polygon_filter'; - -describe('geo_polygon filter', function () { - describe('getGeoPolygonFilterField', function () { - it('should return the name of the field a geo_polygon query is targeting', () => { - const filter = { - geo_polygon: { - geoPointField: { - points: [{ lat: 1, lon: 1 }], - }, - ignore_unmapped: true, - }, - meta: { - disabled: false, - negate: false, - alias: null, - params: { - points: [{ lat: 1, lon: 1 }], - }, - }, - }; - const result = getGeoPolygonFilterField(filter); - expect(result).toBe('geoPointField'); - }); - }); -}); diff --git a/packages/kbn-es-query/src/filters/build_filters/geo_polygon_filter.ts b/packages/kbn-es-query/src/filters/build_filters/geo_polygon_filter.ts deleted file mode 100644 index edeccdcf28b26..0000000000000 --- a/packages/kbn-es-query/src/filters/build_filters/geo_polygon_filter.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { has } from 'lodash'; -import type { FieldFilter, Filter, FilterMeta, LatLon } from './types'; - -export type GeoPolygonFilterMeta = FilterMeta & { - params: { - points: LatLon[]; - }; -}; - -export type GeoPolygonFilter = Filter & { - meta: GeoPolygonFilterMeta; - geo_polygon: any; -}; - -/** - * @param filter - * @returns `true` if a filter is an `GeoPolygonFilter` - * - * @public - */ -export const isGeoPolygonFilter = (filter: FieldFilter): filter is GeoPolygonFilter => - has(filter, 'geo_polygon'); - -/** - * @internal - */ -export const getGeoPolygonFilterField = (filter: GeoPolygonFilter) => { - return ( - filter.geo_polygon && Object.keys(filter.geo_polygon).find((key) => key !== 'ignore_unmapped') - ); -}; diff --git a/packages/kbn-es-query/src/filters/build_filters/get_filter_field.ts b/packages/kbn-es-query/src/filters/build_filters/get_filter_field.ts index 4ebed12e1237e..70949be18a61f 100644 --- a/packages/kbn-es-query/src/filters/build_filters/get_filter_field.ts +++ b/packages/kbn-es-query/src/filters/build_filters/get_filter_field.ts @@ -7,8 +7,6 @@ */ import { getExistsFilterField, isExistsFilter } from './exists_filter'; -import { getGeoBoundingBoxFilterField, isGeoBoundingBoxFilter } from './geo_bounding_box_filter'; -import { getGeoPolygonFilterField, isGeoPolygonFilter } from './geo_polygon_filter'; import { getMissingFilterField, isMissingFilter } from './missing_filter'; import { getPhrasesFilterField, isPhrasesFilter } from './phrases_filter'; import { getPhraseFilterField, isPhraseFilter } from './phrase_filter'; @@ -20,12 +18,6 @@ export const getFilterField = (filter: Filter) => { if (isExistsFilter(filter)) { return getExistsFilterField(filter); } - if (isGeoBoundingBoxFilter(filter)) { - return getGeoBoundingBoxFilterField(filter); - } - if (isGeoPolygonFilter(filter)) { - return getGeoPolygonFilterField(filter); - } if (isPhraseFilter(filter)) { return getPhraseFilterField(filter); } diff --git a/packages/kbn-es-query/src/filters/build_filters/index.ts b/packages/kbn-es-query/src/filters/build_filters/index.ts index c8b96d8b8efc9..7f81d83e6627d 100644 --- a/packages/kbn-es-query/src/filters/build_filters/index.ts +++ b/packages/kbn-es-query/src/filters/build_filters/index.ts @@ -11,8 +11,6 @@ export * from './build_filters'; export * from './build_empty_filter'; export * from './custom_filter'; export * from './exists_filter'; -export * from './geo_bounding_box_filter'; -export * from './geo_polygon_filter'; export * from './get_filter_field'; export * from './get_filter_params'; export * from './match_all_filter'; diff --git a/packages/kbn-es-query/src/filters/build_filters/types.ts b/packages/kbn-es-query/src/filters/build_filters/types.ts index 4bf53303c1544..5aad7d8735f8c 100644 --- a/packages/kbn-es-query/src/filters/build_filters/types.ts +++ b/packages/kbn-es-query/src/filters/build_filters/types.ts @@ -7,8 +7,6 @@ */ import { ExistsFilter } from './exists_filter'; -import { GeoBoundingBoxFilter } from './geo_bounding_box_filter'; -import { GeoPolygonFilter } from './geo_polygon_filter'; import { PhrasesFilter } from './phrases_filter'; import { PhraseFilter } from './phrase_filter'; import { RangeFilter } from './range_filter'; @@ -21,8 +19,6 @@ import { MissingFilter } from './missing_filter'; **/ export type FieldFilter = | ExistsFilter - | GeoBoundingBoxFilter - | GeoPolygonFilter | PhraseFilter | PhrasesFilter | RangeFilter @@ -49,8 +45,6 @@ export enum FILTERS { QUERY_STRING = 'query_string', RANGE = 'range', RANGE_FROM_VALUE = 'range_from_value', - GEO_BOUNDING_BOX = 'geo_bounding_box', - GEO_POLYGON = 'geo_polygon', SPATIAL_FILTER = 'spatial_filter', } diff --git a/packages/kbn-es-query/src/filters/index.ts b/packages/kbn-es-query/src/filters/index.ts index 61ee6ce6f0da6..6e82c21b6a529 100644 --- a/packages/kbn-es-query/src/filters/index.ts +++ b/packages/kbn-es-query/src/filters/index.ts @@ -30,8 +30,6 @@ export { export { isExistsFilter, isMatchAllFilter, - isGeoBoundingBoxFilter, - isGeoPolygonFilter, isMissingFilter, isPhraseFilter, isPhrasesFilter, @@ -67,11 +65,9 @@ export { PhraseFilter, PhrasesFilter, RangeFilterMeta, - GeoPolygonFilter, MatchAllFilter, CustomFilter, MissingFilter, - GeoBoundingBoxFilter, RangeFilterParams, } from './build_filters'; diff --git a/src/plugins/data/common/es_query/index.ts b/src/plugins/data/common/es_query/index.ts index ee98a9ecf8892..6d84b3fd6eab4 100644 --- a/src/plugins/data/common/es_query/index.ts +++ b/src/plugins/data/common/es_query/index.ts @@ -29,8 +29,6 @@ import { isFilters as oldIsFilters, isExistsFilter as oldIsExistsFilter, isMatchAllFilter as oldIsMatchAllFilter, - isGeoBoundingBoxFilter as oldIsGeoBoundingBoxFilter, - isGeoPolygonFilter as oldIsGeoPolygonFilter, isMissingFilter as oldIsMissingFilter, isPhraseFilter as oldIsPhraseFilter, isPhrasesFilter as oldIsPhrasesFilter, @@ -49,14 +47,12 @@ import { RangeFilterMeta as oldRangeFilterMeta, RangeFilterParams as oldRangeFilterParams, ExistsFilter as oldExistsFilter, - GeoPolygonFilter as oldGeoPolygonFilter, PhrasesFilter as oldPhrasesFilter, PhraseFilter as oldPhraseFilter, MatchAllFilter as oldMatchAllFilter, CustomFilter as oldCustomFilter, MissingFilter as oldMissingFilter, RangeFilter as oldRangeFilter, - GeoBoundingBoxFilter as oldGeoBoundingBoxFilter, KueryNode as oldKueryNode, FilterMeta as oldFilterMeta, FILTERS as oldFILTERS, @@ -176,18 +172,6 @@ const isExistsFilter = oldIsExistsFilter; */ const isMatchAllFilter = oldIsMatchAllFilter; -/** - * @deprecated Import from the "@kbn/es-query" package directly instead. - * @removeBy 8.1 - */ -const isGeoBoundingBoxFilter = oldIsGeoBoundingBoxFilter; - -/** - * @deprecated Import from the "@kbn/es-query" package directly instead. - * @removeBy 8.1 - */ -const isGeoPolygonFilter = oldIsGeoPolygonFilter; - /** * @deprecated Import from the "@kbn/es-query" package directly instead. * @removeBy 8.1 @@ -338,12 +322,6 @@ type RangeFilterParams = oldRangeFilterParams; */ type ExistsFilter = oldExistsFilter; -/** - * @deprecated Import from the "@kbn/es-query" package directly instead. - * @removeBy 8.1 - */ -type GeoPolygonFilter = oldGeoPolygonFilter; - /** * @deprecated Import from the "@kbn/es-query" package directly instead. * @removeBy 8.1 @@ -380,12 +358,6 @@ type MissingFilter = oldMissingFilter; */ type RangeFilter = oldRangeFilter; -/** - * @deprecated Import from the "@kbn/es-query" package directly instead. - * @removeBy 8.1 - */ -type GeoBoundingBoxFilter = oldGeoBoundingBoxFilter; - /** * @deprecated Import from the "@kbn/es-query" package directly instead. * @removeBy 8.1 @@ -436,8 +408,6 @@ export { isFilters, isExistsFilter, isMatchAllFilter, - isGeoBoundingBoxFilter, - isGeoPolygonFilter, isMissingFilter, isPhraseFilter, isPhrasesFilter, @@ -463,14 +433,12 @@ export { RangeFilterMeta, RangeFilterParams, ExistsFilter, - GeoPolygonFilter, PhrasesFilter, PhraseFilter, MatchAllFilter, CustomFilter, MissingFilter, RangeFilter, - GeoBoundingBoxFilter, KueryNode, FilterMeta, IFieldSubType, diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md index c6f8100c48413..9dd7dff9e5b66 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -748,7 +748,7 @@ export const esFilters: { isPhraseFilter: (filter: import("@kbn/es-query").FieldFilter) => filter is import("@kbn/es-query").PhraseFilter; isExistsFilter: (filter: import("@kbn/es-query").FieldFilter) => filter is import("@kbn/es-query").ExistsFilter; isPhrasesFilter: (filter: import("@kbn/es-query").FieldFilter) => filter is import("@kbn/es-query").PhrasesFilter; - isRangeFilter: (filter?: import("@kbn/es-query").ExistsFilter | import("@kbn/es-query").GeoPolygonFilter | import("@kbn/es-query").PhrasesFilter | import("@kbn/es-query").PhraseFilter | import("@kbn/es-query").MatchAllFilter | import("@kbn/es-query").MissingFilter | import("@kbn/es-query").RangeFilter | import("@kbn/es-query").GeoBoundingBoxFilter | undefined) => filter is import("@kbn/es-query").RangeFilter; + isRangeFilter: (filter?: import("@kbn/es-query").ExistsFilter | import("@kbn/es-query").PhrasesFilter | import("@kbn/es-query").PhraseFilter | import("@kbn/es-query").MatchAllFilter | import("@kbn/es-query").MissingFilter | import("@kbn/es-query").RangeFilter | undefined) => filter is import("@kbn/es-query").RangeFilter; isMatchAllFilter: (filter: import("@kbn/es-query").FieldFilter) => filter is import("@kbn/es-query").MatchAllFilter; isMissingFilter: (filter: import("@kbn/es-query").FieldFilter) => filter is import("@kbn/es-query").MissingFilter; isQueryStringFilter: (filter: import("@kbn/es-query").FieldFilter) => filter is import("@kbn/es-query/target_types/filters/build_filters").QueryStringFilter; diff --git a/src/plugins/data/public/query/filter_manager/lib/map_filter.ts b/src/plugins/data/public/query/filter_manager/lib/map_filter.ts index 249c7bf47b8fb..d5e5d922d19d5 100644 --- a/src/plugins/data/public/query/filter_manager/lib/map_filter.ts +++ b/src/plugins/data/public/query/filter_manager/lib/map_filter.ts @@ -17,8 +17,6 @@ import { mapRange } from './mappers/map_range'; import { mapExists } from './mappers/map_exists'; import { mapMissing } from './mappers/map_missing'; import { mapQueryString } from './mappers/map_query_string'; -import { mapGeoBoundingBox } from './mappers/map_geo_bounding_box'; -import { mapGeoPolygon } from './mappers/map_geo_polygon'; import { mapDefault } from './mappers/map_default'; import { generateMappingChain } from './generate_mapping_chain'; @@ -48,8 +46,6 @@ export function mapFilter(filter: Filter) { mapExists, mapMissing, mapQueryString, - mapGeoBoundingBox, - mapGeoPolygon, mapDefault, ]; diff --git a/src/plugins/data/public/query/filter_manager/lib/mappers/map_geo_bounding_box.test.ts b/src/plugins/data/public/query/filter_manager/lib/mappers/map_geo_bounding_box.test.ts deleted file mode 100644 index aca6a345cb97e..0000000000000 --- a/src/plugins/data/public/query/filter_manager/lib/mappers/map_geo_bounding_box.test.ts +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { mapGeoBoundingBox } from './map_geo_bounding_box'; -import { Filter, GeoBoundingBoxFilter } from '../../../../../common'; - -describe('filter manager utilities', () => { - describe('mapGeoBoundingBox()', () => { - test('should return the key and value for matching filters with bounds', async () => { - const filter = { - meta: { - index: 'logstash-*', - }, - geo_bounding_box: { - point: { - // field name - top_left: { lat: 5, lon: 10 }, - bottom_right: { lat: 15, lon: 20 }, - }, - }, - } as GeoBoundingBoxFilter; - - const result = mapGeoBoundingBox(filter); - - expect(result).toHaveProperty('key', 'point'); - expect(result).toHaveProperty('value'); - - if (result.value) { - const displayName = result.value(); - // remove html entities and non-alphanumerics to get the gist of the value - expect(displayName.replace(/&[a-z]+?;/g, '').replace(/[^a-z0-9]/g, '')).toBe( - 'lat5lon10tolat15lon20' - ); - } - }); - - test('should return the key and value even when using ignore_unmapped', async () => { - const filter = { - meta: { - index: 'logstash-*', - }, - geo_bounding_box: { - ignore_unmapped: true, - point: { - // field name - top_left: { lat: 5, lon: 10 }, - bottom_right: { lat: 15, lon: 20 }, - }, - }, - } as GeoBoundingBoxFilter; - - const result = mapGeoBoundingBox(filter); - - expect(result).toHaveProperty('key', 'point'); - expect(result).toHaveProperty('value'); - - if (result.value) { - const displayName = result.value(); - // remove html entities and non-alphanumerics to get the gist of the value - expect(displayName.replace(/&[a-z]+?;/g, '').replace(/[^a-z0-9]/g, '')).toBe( - 'lat5lon10tolat15lon20' - ); - } - }); - - test('should return undefined for none matching', async (done) => { - const filter = { - meta: { index: 'logstash-*' }, - query: { query_string: { query: 'foo:bar' } }, - } as Filter; - - try { - mapGeoBoundingBox(filter); - } catch (e) { - expect(e).toBe(filter); - done(); - } - }); - }); -}); diff --git a/src/plugins/data/public/query/filter_manager/lib/mappers/map_geo_bounding_box.ts b/src/plugins/data/public/query/filter_manager/lib/mappers/map_geo_bounding_box.ts deleted file mode 100644 index dfa8e862e1b4c..0000000000000 --- a/src/plugins/data/public/query/filter_manager/lib/mappers/map_geo_bounding_box.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { GeoBoundingBoxFilter, FILTERS, isGeoBoundingBoxFilter, Filter } from '@kbn/es-query'; - -import { FilterValueFormatter } from '../../../../../common'; - -const getFormattedValueFn = (params: any) => { - return (formatter?: FilterValueFormatter) => { - const corners = formatter - ? { - topLeft: formatter.convert(params.top_left), - bottomRight: formatter.convert(params.bottom_right), - } - : { - topLeft: JSON.stringify(params.top_left), - bottomRight: JSON.stringify(params.bottom_right), - }; - - return corners.topLeft + ' to ' + corners.bottomRight; - }; -}; - -const getParams = (filter: GeoBoundingBoxFilter) => { - const key = Object.keys(filter.geo_bounding_box).filter((k) => k !== 'ignore_unmapped')[0]; - const params = filter.geo_bounding_box[key]; - - return { - key, - params, - type: FILTERS.GEO_BOUNDING_BOX, - value: getFormattedValueFn(params), - }; -}; - -export const mapGeoBoundingBox = (filter: Filter) => { - if (!isGeoBoundingBoxFilter(filter)) { - throw filter; - } - - return getParams(filter); -}; diff --git a/src/plugins/data/public/query/filter_manager/lib/mappers/map_geo_polygon.test.ts b/src/plugins/data/public/query/filter_manager/lib/mappers/map_geo_polygon.test.ts deleted file mode 100644 index c8fba3adcbb85..0000000000000 --- a/src/plugins/data/public/query/filter_manager/lib/mappers/map_geo_polygon.test.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { mapGeoPolygon } from './map_geo_polygon'; -import { Filter, GeoPolygonFilter } from '../../../../../common'; - -describe('filter manager utilities', () => { - let filter: GeoPolygonFilter; - - beforeEach(() => { - filter = { - meta: { - index: 'logstash-*', - }, - geo_polygon: { - point: { - points: [ - { lat: 5, lon: 10 }, - { lat: 15, lon: 20 }, - ], - }, - }, - } as GeoPolygonFilter; - }); - - describe('mapGeoPolygon()', () => { - test('should return the key and value for matching filters with bounds', async () => { - const result = mapGeoPolygon(filter); - - expect(result).toHaveProperty('key', 'point'); - expect(result).toHaveProperty('value'); - - if (result.value) { - const displayName = result.value(); - // remove html entities and non-alphanumerics to get the gist of the value - expect(displayName.replace(/&[a-z]+?;/g, '').replace(/[^a-z0-9]/g, '')).toBe( - 'lat5lon10lat15lon20' - ); - } - }); - - test('should return the key and value even when using ignore_unmapped', async () => { - const result = mapGeoPolygon(filter); - - expect(result).toHaveProperty('key', 'point'); - expect(result).toHaveProperty('value'); - - if (result.value) { - const displayName = result.value(); - // remove html entities and non-alphanumerics to get the gist of the value - expect(displayName.replace(/&[a-z]+?;/g, '').replace(/[^a-z0-9]/g, '')).toBe( - 'lat5lon10lat15lon20' - ); - } - }); - - test('should return undefined for none matching', async (done) => { - const wrongFilter = { - meta: { index: 'logstash-*' }, - query: { query_string: { query: 'foo:bar' } }, - } as Filter; - - try { - mapGeoPolygon(wrongFilter); - } catch (e) { - expect(e).toBe(wrongFilter); - - done(); - } - }); - }); -}); diff --git a/src/plugins/data/public/query/filter_manager/lib/mappers/map_geo_polygon.ts b/src/plugins/data/public/query/filter_manager/lib/mappers/map_geo_polygon.ts deleted file mode 100644 index e1c21aae64da6..0000000000000 --- a/src/plugins/data/public/query/filter_manager/lib/mappers/map_geo_polygon.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { GeoPolygonFilter, FILTERS, Filter, isGeoPolygonFilter } from '@kbn/es-query'; - -import { FilterValueFormatter } from '../../../../../common'; - -const POINTS_SEPARATOR = ', '; - -const getFormattedValueFn = (points: string[]) => { - return (formatter?: FilterValueFormatter) => { - return points - .map((point: string) => (formatter ? formatter.convert(point) : JSON.stringify(point))) - .join(POINTS_SEPARATOR); - }; -}; - -function getParams(filter: GeoPolygonFilter) { - const key = Object.keys(filter.geo_polygon).filter((k) => k !== 'ignore_unmapped')[0]; - const params = filter.geo_polygon[key]; - - return { - key, - params, - type: FILTERS.GEO_POLYGON, - value: getFormattedValueFn(params.points || []), - }; -} - -export function mapGeoPolygon(filter: Filter) { - if (!isGeoPolygonFilter(filter)) { - throw filter; - } - return getParams(filter); -} diff --git a/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_label.tsx b/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_label.tsx index 5055e122e199a..6debf34c2ae8c 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_label.tsx +++ b/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_label.tsx @@ -57,20 +57,6 @@ export default function FilterLabel({ filter, valueLabel, filterLabelStatus }: F {filter.meta.key}: {getValue(`${existsOperator.message}`)} ); - case FILTERS.GEO_BOUNDING_BOX: - return ( - - {prefix} - {filter.meta.key}: {getValue(valueLabel)} - - ); - case FILTERS.GEO_POLYGON: - return ( - - {prefix} - {filter.meta.key}: {getValue(valueLabel)} - - ); case FILTERS.PHRASES: return ( From a2b8b22929ece67dec377a2304c2d609e08f6072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ece=20=C3=96zalp?= Date: Wed, 18 Aug 2021 11:14:52 -0400 Subject: [PATCH 4/8] [CTI] bring back skipped cypress tests (#108978) --- .../detection_alerts/cti_enrichments.spec.ts | 3 +-- .../detection_rules/indicator_match_rule.spec.ts | 14 +++++--------- .../security_solution/cypress/screens/alerts.ts | 10 +++------- .../cypress/screens/rule_details.ts | 2 +- .../cypress/tasks/create_new_rule.ts | 6 +++--- .../truncatable_text/truncatable_text.tsx | 14 +++++++++++--- .../timeline/body/renderers/formatted_field.tsx | 4 ++-- .../body/renderers/formatted_field_helpers.tsx | 6 +++++- 8 files changed, 31 insertions(+), 28 deletions(-) diff --git a/x-pack/plugins/security_solution/cypress/integration/detection_alerts/cti_enrichments.spec.ts b/x-pack/plugins/security_solution/cypress/integration/detection_alerts/cti_enrichments.spec.ts index 221fd4ae3266e..8ce3de6e5d7ac 100644 --- a/x-pack/plugins/security_solution/cypress/integration/detection_alerts/cti_enrichments.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/detection_alerts/cti_enrichments.spec.ts @@ -37,8 +37,7 @@ import { import { ALERTS_URL } from '../../urls/navigation'; import { addsFieldsToTimeline } from '../../tasks/rule_details'; -// TODO: Doesn't look like the roll over is happening for these tests. 'indicator' is still referenced in the fields browser -describe.skip('CTI Enrichment', () => { +describe('CTI Enrichment', () => { before(() => { cleanKibana(); esArchiverLoad('threat_indicator'); diff --git a/x-pack/plugins/security_solution/cypress/integration/detection_rules/indicator_match_rule.spec.ts b/x-pack/plugins/security_solution/cypress/integration/detection_rules/indicator_match_rule.spec.ts index 6b8afc5da4949..f8b3b426580b2 100644 --- a/x-pack/plugins/security_solution/cypress/integration/detection_rules/indicator_match_rule.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/detection_rules/indicator_match_rule.spec.ts @@ -116,7 +116,7 @@ describe('indicator match', () => { const expectedTags = getNewThreatIndicatorRule().tags.join(''); const expectedMitre = formatMitreAttackDescription(getNewThreatIndicatorRule().mitre); const expectedNumberOfRules = 1; - const expectedNumberOfAlerts = 1; + const expectedNumberOfAlerts = '1 alert'; before(() => { cleanKibana(); @@ -139,8 +139,7 @@ describe('indicator match', () => { getIndicatorIndex().should('have.text', getIndexPatterns().join('')); }); - // TODO: Need to fix - it.skip('Does NOT show invalidation text on initial page load if indicator index pattern is filled out', () => { + it('Does NOT show invalidation text on initial page load if indicator index pattern is filled out', () => { getDefineContinueButton().click(); getIndexPatternInvalidationText().should('not.exist'); }); @@ -154,8 +153,7 @@ describe('indicator match', () => { }); describe('Indicator index patterns', () => { - // TODO: Need to fix - it.skip('Contains a predefined index pattern', () => { + it('Contains a predefined index pattern', () => { getIndicatorIndicatorIndex().should('have.text', getThreatIndexPatterns().join('')); }); @@ -392,8 +390,7 @@ describe('indicator match', () => { loginAndWaitForPageWithoutDateRange(ALERTS_URL); }); - // TODO: Need to fix - it.skip('Creates and activates a new Indicator Match rule', () => { + it('Creates and activates a new Indicator Match rule', () => { waitForAlertsPanelToBeLoaded(); waitForAlertsIndexToBeCreated(); goToManageAlertsDetectionRules(); @@ -491,8 +488,7 @@ describe('indicator match', () => { .should('have.text', getNewThreatIndicatorRule().riskScore); }); - // TODO: Need to fix - it.skip('Investigate alert in timeline', () => { + it('Investigate alert in timeline', () => { const accessibilityText = `Press enter for options, or press space to begin dragging.`; loadPrepackagedTimelineTemplates(); diff --git a/x-pack/plugins/security_solution/cypress/screens/alerts.ts b/x-pack/plugins/security_solution/cypress/screens/alerts.ts index 83b3eb8a613cf..71f7184230f2b 100644 --- a/x-pack/plugins/security_solution/cypress/screens/alerts.ts +++ b/x-pack/plugins/security_solution/cypress/screens/alerts.ts @@ -21,15 +21,11 @@ export const ALERT_ID = '[data-test-subj="draggable-content-_id"]'; export const ALERT_RISK_SCORE_HEADER = '[data-test-subj="dataGridHeaderCell-signal.rule.risk_score"]'; -export const ALERT_RULE_METHOD = '[data-test-subj="draggable-content-signal.rule.type"]'; +export const ALERT_RULE_NAME = '[data-test-subj="formatted-field-signal.rule.name"]'; -export const ALERT_RULE_NAME = '[data-test-subj="draggable-content-signal.rule.name"]'; +export const ALERT_RULE_RISK_SCORE = '[data-test-subj="formatted-field-signal.rule.risk_score"]'; -export const ALERT_RULE_RISK_SCORE = '[data-test-subj="draggable-content-signal.rule.risk_score"]'; - -export const ALERT_RULE_SEVERITY = '[data-test-subj="draggable-content-signal.rule.severity"]'; - -export const ALERT_RULE_VERSION = '[data-test-subj="draggable-content-signal.rule.version"]'; +export const ALERT_RULE_SEVERITY = '[data-test-subj="formatted-field-signal.rule.severity"]'; export const CLOSE_ALERT_BTN = '[data-test-subj="close-alert-status"]'; diff --git a/x-pack/plugins/security_solution/cypress/screens/rule_details.ts b/x-pack/plugins/security_solution/cypress/screens/rule_details.ts index d94be17a0530a..9bc22f35741d9 100644 --- a/x-pack/plugins/security_solution/cypress/screens/rule_details.ts +++ b/x-pack/plugins/security_solution/cypress/screens/rule_details.ts @@ -96,7 +96,7 @@ export const TIMELINE_TEMPLATE_DETAILS = 'Timeline template'; export const TIMESTAMP_OVERRIDE_DETAILS = 'Timestamp override'; export const TIMELINE_FIELD = (field: string) => { - return `[data-test-subj="draggable-content-${field}"]`; + return `[data-test-subj="formatted-field-${field}"]`; }; export const getDetails = (title: string) => diff --git a/x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts b/x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts index 47225227485f0..9a500f81ec45f 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts @@ -394,7 +394,7 @@ export const fillIndexAndIndicatorIndexPattern = ( ) => { getIndexPatternClearButton().click(); getIndicatorIndex().type(`${indexPattern}{enter}`); - getIndicatorIndicatorIndex().type(`${indicatorIndex}{enter}`); + getIndicatorIndicatorIndex().type(`{backspace}{enter}${indicatorIndex}{enter}`); }; export const fillEmailConnectorForm = (connector: EmailConnector = getEmailConnector()) => { @@ -437,7 +437,7 @@ export const getIndexPatternInvalidationText = () => cy.contains(AT_LEAST_ONE_IN export const getAboutContinueButton = () => cy.get(ABOUT_CONTINUE_BTN); /** Returns the continue button on the step of define */ -export const getDefineContinueButton = () => cy.get(DEFINE_CONTINUE_BUTTON); +export const getDefineContinueButton = () => cy.get(DEFINE_CONTINUE_BUTTON).should('exist'); /** Returns the indicator index pattern */ export const getIndicatorIndex = () => cy.get(THREAT_MATCH_INDICATOR_INDEX).eq(0); @@ -447,7 +447,7 @@ export const getIndicatorIndicatorIndex = () => cy.get(THREAT_MATCH_INDICATOR_INDICATOR_INDEX).eq(0); /** Returns the index pattern's clear button */ -export const getIndexPatternClearButton = () => cy.get(COMBO_BOX_CLEAR_BTN).first(); +export const getIndexPatternClearButton = () => cy.get(COMBO_BOX_CLEAR_BTN).should('exist').first(); /** Returns the custom query input */ export const getCustomQueryInput = () => cy.get(THREAT_MATCH_CUSTOM_QUERY_INPUT).eq(0); diff --git a/x-pack/plugins/security_solution/public/common/components/truncatable_text/truncatable_text.tsx b/x-pack/plugins/security_solution/public/common/components/truncatable_text/truncatable_text.tsx index 4c068675aa5a0..cc1c53d107100 100644 --- a/x-pack/plugins/security_solution/public/common/components/truncatable_text/truncatable_text.tsx +++ b/x-pack/plugins/security_solution/public/common/components/truncatable_text/truncatable_text.tsx @@ -32,14 +32,22 @@ EllipsisText.displayName = 'EllipsisText'; interface Props { tooltipContent?: React.ReactNode; children: React.ReactNode; + dataTestSubj?: string; } -export function TruncatableText({ tooltipContent, children, ...props }: Props) { - if (!tooltipContent) return {children}; +export function TruncatableText({ tooltipContent, children, dataTestSubj, ...props }: Props) { + if (!tooltipContent) + return ( + + {children} + + ); return ( - {children} + + {children} + ); } diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/formatted_field.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/formatted_field.tsx index 06ed901110962..5eec4ef66f39c 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/formatted_field.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/formatted_field.tsx @@ -202,11 +202,11 @@ const FormattedFieldValueComponent: React.FC<{ } > - <>{value} + {value} ) : ( - <>{value} + {value} ); } else { const contentValue = getOrEmptyTagFromValue(value); diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/formatted_field_helpers.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/formatted_field_helpers.tsx index c7e15dae0035e..3343882e0071a 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/formatted_field_helpers.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/formatted_field_helpers.tsx @@ -52,7 +52,11 @@ export const RenderRuleName: React.FC = ({ const ruleId = linkValue; const { search } = useFormatUrl(SecurityPageName.rules); const { navigateToApp, getUrlForApp } = useKibana().services.application; - const content = truncate ? {value} : value; + const content = truncate ? ( + {value} + ) : ( + value + ); const goToRuleDetails = useCallback( (ev) => { From ff58841d899598166330eff2cf5c8b6c83b41cac Mon Sep 17 00:00:00 2001 From: Sergi Massaneda Date: Wed, 18 Aug 2021 17:17:53 +0200 Subject: [PATCH 5/8] added defaultColumns property to default security solutions timeline (#109086) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../public/common/mock/global_state.ts | 1 + .../public/common/mock/timeline_results.ts | 98 ++++++++++--------- .../timelines/store/timeline/defaults.ts | 1 + .../timelines/store/timeline/epic.test.ts | 86 ++++++++-------- .../public/timelines/store/timeline/model.ts | 1 + .../timelines/store/timeline/reducer.test.ts | 1 + .../timelines/public/store/t_grid/defaults.ts | 1 + .../timelines/public/store/t_grid/model.ts | 2 + 8 files changed, 102 insertions(+), 89 deletions(-) diff --git a/x-pack/plugins/security_solution/public/common/mock/global_state.ts b/x-pack/plugins/security_solution/public/common/mock/global_state.ts index 8130a7058700d..fb772986bc679 100644 --- a/x-pack/plugins/security_solution/public/common/mock/global_state.ts +++ b/x-pack/plugins/security_solution/public/common/mock/global_state.ts @@ -245,6 +245,7 @@ export const mockGlobalState: State = { id: 'test', savedObjectId: null, columns: defaultHeaders, + defaultColumns: defaultHeaders, indexNames: DEFAULT_INDEX_PATTERN, itemsPerPage: 5, dataProviders: [], diff --git a/x-pack/plugins/security_solution/public/common/mock/timeline_results.ts b/x-pack/plugins/security_solution/public/common/mock/timeline_results.ts index f271f49e56a29..e67b61664745e 100644 --- a/x-pack/plugins/security_solution/public/common/mock/timeline_results.ts +++ b/x-pack/plugins/security_solution/public/common/mock/timeline_results.ts @@ -1930,46 +1930,48 @@ export const mockTimelineResults: OpenTimelineResult[] = [ }, ]; +const mockTimelineModelColumns: TimelineModel['columns'] = [ + { + columnHeaderType: 'not-filtered', + id: '@timestamp', + initialWidth: 190, + }, + { + columnHeaderType: 'not-filtered', + id: 'message', + initialWidth: 180, + }, + { + columnHeaderType: 'not-filtered', + id: 'event.category', + initialWidth: 180, + }, + { + columnHeaderType: 'not-filtered', + id: 'host.name', + initialWidth: 180, + }, + { + columnHeaderType: 'not-filtered', + id: 'source.ip', + initialWidth: 180, + }, + { + columnHeaderType: 'not-filtered', + id: 'destination.ip', + initialWidth: 180, + }, + { + columnHeaderType: 'not-filtered', + id: 'user.name', + initialWidth: 180, + }, +]; export const mockTimelineModel: TimelineModel = { activeTab: TimelineTabs.query, prevActiveTab: TimelineTabs.notes, - columns: [ - { - columnHeaderType: 'not-filtered', - id: '@timestamp', - initialWidth: 190, - }, - { - columnHeaderType: 'not-filtered', - id: 'message', - initialWidth: 180, - }, - { - columnHeaderType: 'not-filtered', - id: 'event.category', - initialWidth: 180, - }, - { - columnHeaderType: 'not-filtered', - id: 'host.name', - initialWidth: 180, - }, - { - columnHeaderType: 'not-filtered', - id: 'source.ip', - initialWidth: 180, - }, - { - columnHeaderType: 'not-filtered', - id: 'destination.ip', - initialWidth: 180, - }, - { - columnHeaderType: 'not-filtered', - id: 'user.name', - initialWidth: 180, - }, - ], + columns: mockTimelineModelColumns, + defaultColumns: mockTimelineModelColumns, dataProviders: [], dateRange: { end: '2020-03-18T13:52:38.929Z', @@ -2076,21 +2078,23 @@ export const mockTimelineResult = { stale: false, }; +const defaultTimelineColumns: CreateTimelineProps['timeline']['columns'] = [ + { columnHeaderType: 'not-filtered', id: '@timestamp', type: 'number', initialWidth: 190 }, + { columnHeaderType: 'not-filtered', id: 'message', initialWidth: 180 }, + { columnHeaderType: 'not-filtered', id: 'event.category', initialWidth: 180 }, + { columnHeaderType: 'not-filtered', id: 'event.action', initialWidth: 180 }, + { columnHeaderType: 'not-filtered', id: 'host.name', initialWidth: 180 }, + { columnHeaderType: 'not-filtered', id: 'source.ip', initialWidth: 180 }, + { columnHeaderType: 'not-filtered', id: 'destination.ip', initialWidth: 180 }, + { columnHeaderType: 'not-filtered', id: 'user.name', initialWidth: 180 }, +]; export const defaultTimelineProps: CreateTimelineProps = { from: '2018-11-05T18:58:25.937Z', timeline: { activeTab: TimelineTabs.query, prevActiveTab: TimelineTabs.query, - columns: [ - { columnHeaderType: 'not-filtered', id: '@timestamp', type: 'number', initialWidth: 190 }, - { columnHeaderType: 'not-filtered', id: 'message', initialWidth: 180 }, - { columnHeaderType: 'not-filtered', id: 'event.category', initialWidth: 180 }, - { columnHeaderType: 'not-filtered', id: 'event.action', initialWidth: 180 }, - { columnHeaderType: 'not-filtered', id: 'host.name', initialWidth: 180 }, - { columnHeaderType: 'not-filtered', id: 'source.ip', initialWidth: 180 }, - { columnHeaderType: 'not-filtered', id: 'destination.ip', initialWidth: 180 }, - { columnHeaderType: 'not-filtered', id: 'user.name', initialWidth: 180 }, - ], + columns: defaultTimelineColumns, + defaultColumns: defaultTimelineColumns, dataProviders: [ { and: [], diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/defaults.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/defaults.ts index d8fd82005dfbe..f411c6ffac9b7 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/defaults.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/defaults.ts @@ -19,6 +19,7 @@ export const timelineDefaults: SubsetTimelineModel & activeTab: TimelineTabs.query, prevActiveTab: TimelineTabs.query, columns: defaultHeaders, + defaultColumns: defaultHeaders, dataProviders: [], dateRange: { start, end }, deletedEventIds: [], diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic.test.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/epic.test.ts index eabcdd53fb994..8b40febbfe993 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic.test.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/epic.test.ts @@ -14,51 +14,53 @@ import { TimelineModel } from './model'; describe('Epic Timeline', () => { describe('#convertTimelineAsInput ', () => { test('should return a TimelineInput instead of TimelineModel ', () => { + const columns: TimelineModel['columns'] = [ + { + columnHeaderType: 'not-filtered', + id: '@timestamp', + initialWidth: 190, + }, + { + columnHeaderType: 'not-filtered', + id: 'message', + initialWidth: 180, + }, + { + columnHeaderType: 'not-filtered', + id: 'event.category', + initialWidth: 180, + }, + { + columnHeaderType: 'not-filtered', + id: 'event.action', + initialWidth: 180, + }, + { + columnHeaderType: 'not-filtered', + id: 'host.name', + initialWidth: 180, + }, + { + columnHeaderType: 'not-filtered', + id: 'source.ip', + initialWidth: 180, + }, + { + columnHeaderType: 'not-filtered', + id: 'destination.ip', + initialWidth: 180, + }, + { + columnHeaderType: 'not-filtered', + id: 'user.name', + initialWidth: 180, + }, + ]; const timelineModel: TimelineModel = { activeTab: TimelineTabs.query, prevActiveTab: TimelineTabs.notes, - columns: [ - { - columnHeaderType: 'not-filtered', - id: '@timestamp', - initialWidth: 190, - }, - { - columnHeaderType: 'not-filtered', - id: 'message', - initialWidth: 180, - }, - { - columnHeaderType: 'not-filtered', - id: 'event.category', - initialWidth: 180, - }, - { - columnHeaderType: 'not-filtered', - id: 'event.action', - initialWidth: 180, - }, - { - columnHeaderType: 'not-filtered', - id: 'host.name', - initialWidth: 180, - }, - { - columnHeaderType: 'not-filtered', - id: 'source.ip', - initialWidth: 180, - }, - { - columnHeaderType: 'not-filtered', - id: 'destination.ip', - initialWidth: 180, - }, - { - columnHeaderType: 'not-filtered', - id: 'user.name', - initialWidth: 180, - }, - ], + columns, + defaultColumns: columns, dataProviders: [ { id: 'hosts-table-hostName-DESKTOP-QBBSCUT', diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/model.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/model.ts index 3c2449a2e787d..7a16b62cd45e6 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/model.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/model.ts @@ -80,6 +80,7 @@ export type SubsetTimelineModel = Readonly< | 'activeTab' | 'prevActiveTab' | 'columns' + | 'defaultColumns' | 'dataProviders' | 'deletedEventIds' | 'description' diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/reducer.test.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/reducer.test.ts index 8a5c8546d3834..96ae11cb8afdc 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/reducer.test.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/reducer.test.ts @@ -80,6 +80,7 @@ const basicTimeline: TimelineModel = { activeTab: TimelineTabs.query, prevActiveTab: TimelineTabs.graph, columns: [], + defaultColumns: [], dataProviders: [{ ...basicDataProvider }], dateRange: { start: '2020-07-07T08:20:18.966Z', diff --git a/x-pack/plugins/timelines/public/store/t_grid/defaults.ts b/x-pack/plugins/timelines/public/store/t_grid/defaults.ts index 8caae1aabbe01..c211b4709efab 100644 --- a/x-pack/plugins/timelines/public/store/t_grid/defaults.ts +++ b/x-pack/plugins/timelines/public/store/t_grid/defaults.ts @@ -62,6 +62,7 @@ export const defaultHeaders: ColumnHeaderOptions[] = [ export const tGridDefaults: SubsetTGridModel = { columns: defaultHeaders, + defaultColumns: defaultHeaders, dateRange: { start: '', end: '' }, deletedEventIds: [], excludedRowRendererIds: [], diff --git a/x-pack/plugins/timelines/public/store/t_grid/model.ts b/x-pack/plugins/timelines/public/store/t_grid/model.ts index 757a1ed66f2fb..2c39e3739b691 100644 --- a/x-pack/plugins/timelines/public/store/t_grid/model.ts +++ b/x-pack/plugins/timelines/public/store/t_grid/model.ts @@ -87,6 +87,7 @@ export interface TGridModel extends TGridModelSettings { export type TGridModelForTimeline = Pick< TGridModel, | 'columns' + | 'defaultColumns' | 'dataProviders' | 'dateRange' | 'deletedEventIds' @@ -114,6 +115,7 @@ export type SubsetTGridModel = Readonly< Pick< TGridModel, | 'columns' + | 'defaultColumns' | 'dateRange' | 'deletedEventIds' | 'excludedRowRendererIds' From 336b099eec2e3a0ea99a9cdd6509d2e26fb0d366 Mon Sep 17 00:00:00 2001 From: Michael Marcialis Date: Wed, 18 Aug 2021 11:25:44 -0400 Subject: [PATCH 6/8] Home Page Style Tweaks (#108989) * balance solutions * clean up solution changes * change footer button size * update management section * apply max-width to management items * remove right side items from page header * add data content update * illustration poc * add data content updates per feedback * img size and alignment * moved shared images to shared assets folder * more solutions clean up * rm unneeded import * remove references to subtitle and appDescriptions * update tests and snapshots * more test and snapshot updates * restore solution sort order * ts and jest fixes; thx catherine! * i18n fixes * use new `KibanaPageTemplateSolutionNavAvatar` comp * change solution imgs from png to svg * update tests and snapshots * rm spacer and update snapshots * account for flex margin changes in img offset * Change "Kibana" overview page text to "Analytics" * update overview icon to match hp changes * update snapshots * center justify solutions and update snapshots * update snapshots * title case dev tools and stack management * update text and snapshots * fix merge error * apply caroline's suggested style tweaks * clean up css and update snapshots Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../application/components/_manage_data.scss | 2 +- .../application/components/_solutions_section.scss | 14 ++++++++------ .../__snapshots__/solutions_section.test.tsx.snap | 2 -- .../solutions_section/solutions_section.tsx | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/plugins/home/public/application/components/_manage_data.scss b/src/plugins/home/public/application/components/_manage_data.scss index df0219636e17c..4fcd6122f0612 100644 --- a/src/plugins/home/public/application/components/_manage_data.scss +++ b/src/plugins/home/public/application/components/_manage_data.scss @@ -1,5 +1,5 @@ .homDataManage__item { @include euiBreakpoint('l', 'xl') { - max-width: calc(50% - #{$euiSizeM * 2}); + max-width: calc(33.33% - #{$euiSizeM * 2}); } } \ No newline at end of file diff --git a/src/plugins/home/public/application/components/_solutions_section.scss b/src/plugins/home/public/application/components/_solutions_section.scss index d563b13ac7e07..4bd8351c933b9 100644 --- a/src/plugins/home/public/application/components/_solutions_section.scss +++ b/src/plugins/home/public/application/components/_solutions_section.scss @@ -1,23 +1,25 @@ .homSolutions__item { @include euiBreakpoint('l', 'xl') { - max-width: calc(50% - #{$euiSizeM * 2}); + max-width: calc(33.33% - #{$euiSizeM * 2}); } } -.euiCard__image { - .homSolutionPanel & { +.homSolutionPanel { + img { background-color: $euiColorPrimary; + max-height: $euiSize * 10; + object-fit: cover; } - .homSolutionPanel--enterpriseSearch & { + &--enterpriseSearch img { background-color: $euiColorWarning; } - .homSolutionPanel--observability & { + &--observability img { background-color: $euiColorAccent; } - .homSolutionPanel--securitySolution & { + &--securitySolution img { background-color: $euiColorSecondary; } } \ No newline at end of file diff --git a/src/plugins/home/public/application/components/solutions_section/__snapshots__/solutions_section.test.tsx.snap b/src/plugins/home/public/application/components/solutions_section/__snapshots__/solutions_section.test.tsx.snap index cef62f4a1e88d..676745e7f1a52 100644 --- a/src/plugins/home/public/application/components/solutions_section/__snapshots__/solutions_section.test.tsx.snap +++ b/src/plugins/home/public/application/components/solutions_section/__snapshots__/solutions_section.test.tsx.snap @@ -19,7 +19,6 @@ exports[`SolutionsSection renders a single solution 1`] = ` = ({ addBasePath, solutions }) => { - + {solutions.map((solution) => ( ))} From 28772d7db44ecd9aa2d949d47fd8c22ecaed18a9 Mon Sep 17 00:00:00 2001 From: Kevin Logan <56395104+kevinlog@users.noreply.github.com> Date: Wed, 18 Aug 2021 11:26:06 -0400 Subject: [PATCH 7/8] [Security Solution] Correct the spelling of behavior in Endpoint policy config (#108969) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../pages/policy/view/policy_forms/protections/behavior.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_forms/protections/behavior.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_forms/protections/behavior.tsx index a77d661593e6b..8bfda22fd3701 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_forms/protections/behavior.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_forms/protections/behavior.tsx @@ -28,7 +28,7 @@ export const BehaviorProtection = React.memo(() => { const protectionLabel = i18n.translate( 'xpack.securitySolution.endpoint.policy.protections.behavior', { - defaultMessage: 'Behaviour protections', + defaultMessage: 'Behavior protections', } ); return ( From ed78d4b7000b7baa424b0fa4b7d00186a3e7558c Mon Sep 17 00:00:00 2001 From: mgiota Date: Wed, 18 Aug 2021 18:01:42 +0200 Subject: [PATCH 8/8] [RAC][Observability] temporarily hide severity column (#109004) * [RAC][Observability] temporarily hide severity column * remove severity from flyout & rename Trigerred to last updated Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../public/pages/alerts/alerts_flyout/index.tsx | 14 ++------------ .../public/pages/alerts/alerts_table_t_grid.tsx | 11 ----------- .../plugins/translations/translations/ja-JP.json | 2 -- .../plugins/translations/translations/zh-CN.json | 2 -- 4 files changed, 2 insertions(+), 27 deletions(-) diff --git a/x-pack/plugins/observability/public/pages/alerts/alerts_flyout/index.tsx b/x-pack/plugins/observability/public/pages/alerts/alerts_flyout/index.tsx index 90032419948ef..c4d455fb43b7f 100644 --- a/x-pack/plugins/observability/public/pages/alerts/alerts_flyout/index.tsx +++ b/x-pack/plugins/observability/public/pages/alerts/alerts_flyout/index.tsx @@ -24,7 +24,6 @@ import type { ALERT_DURATION as ALERT_DURATION_TYPED, ALERT_EVALUATION_THRESHOLD as ALERT_EVALUATION_THRESHOLD_TYPED, ALERT_EVALUATION_VALUE as ALERT_EVALUATION_VALUE_TYPED, - ALERT_SEVERITY_LEVEL as ALERT_SEVERITY_LEVEL_TYPED, ALERT_UUID as ALERT_UUID_TYPED, ALERT_RULE_CATEGORY as ALERT_RULE_CATEGORY_TYPED, ALERT_RULE_NAME as ALERT_RULE_NAME_TYPED, @@ -33,7 +32,6 @@ import { ALERT_DURATION as ALERT_DURATION_NON_TYPED, ALERT_EVALUATION_THRESHOLD as ALERT_EVALUATION_THRESHOLD_NON_TYPED, ALERT_EVALUATION_VALUE as ALERT_EVALUATION_VALUE_NON_TYPED, - ALERT_SEVERITY_LEVEL as ALERT_SEVERITY_LEVEL_NON_TYPED, ALERT_UUID as ALERT_UUID_NON_TYPED, ALERT_RULE_CATEGORY as ALERT_RULE_CATEGORY_NON_TYPED, ALERT_RULE_NAME as ALERT_RULE_NAME_NON_TYPED, @@ -46,7 +44,6 @@ import { useKibana, useUiSetting } from '../../../../../../../src/plugins/kibana import { asDuration } from '../../../../common/utils/formatters'; import type { ObservabilityRuleTypeRegistry } from '../../../rules/create_observability_rule_type_registry'; import { parseAlert } from '../parse_alert'; -import { SeverityBadge } from '../severity_badge'; type AlertsFlyoutProps = { alert?: TopAlert; @@ -59,7 +56,6 @@ type AlertsFlyoutProps = { const ALERT_DURATION: typeof ALERT_DURATION_TYPED = ALERT_DURATION_NON_TYPED; const ALERT_EVALUATION_THRESHOLD: typeof ALERT_EVALUATION_THRESHOLD_TYPED = ALERT_EVALUATION_THRESHOLD_NON_TYPED; const ALERT_EVALUATION_VALUE: typeof ALERT_EVALUATION_VALUE_TYPED = ALERT_EVALUATION_VALUE_NON_TYPED; -const ALERT_SEVERITY_LEVEL: typeof ALERT_SEVERITY_LEVEL_TYPED = ALERT_SEVERITY_LEVEL_NON_TYPED; const ALERT_UUID: typeof ALERT_UUID_TYPED = ALERT_UUID_NON_TYPED; const ALERT_RULE_CATEGORY: typeof ALERT_RULE_CATEGORY_TYPED = ALERT_RULE_CATEGORY_NON_TYPED; const ALERT_RULE_NAME: typeof ALERT_RULE_NAME_TYPED = ALERT_RULE_NAME_NON_TYPED; @@ -97,14 +93,8 @@ export function AlertsFlyout({ description: alertData.active ? 'Active' : 'Recovered', }, { - title: i18n.translate('xpack.observability.alertsFlyout.severityLabel', { - defaultMessage: 'Severity', - }), - description: , - }, - { - title: i18n.translate('xpack.observability.alertsFlyout.triggeredLabel', { - defaultMessage: 'Triggered', + title: i18n.translate('xpack.observability.alertsFlyout.lastUpdatedLabel', { + defaultMessage: 'Last updated', }), description: ( {moment(alertData.start).format(dateFormat)} diff --git a/x-pack/plugins/observability/public/pages/alerts/alerts_table_t_grid.tsx b/x-pack/plugins/observability/public/pages/alerts/alerts_table_t_grid.tsx index 135a63b78dc72..bbbd81b4e49ea 100644 --- a/x-pack/plugins/observability/public/pages/alerts/alerts_table_t_grid.tsx +++ b/x-pack/plugins/observability/public/pages/alerts/alerts_table_t_grid.tsx @@ -13,14 +13,12 @@ import { AlertConsumers as AlertConsumersTyped, ALERT_DURATION as ALERT_DURATION_TYPED, - ALERT_SEVERITY_LEVEL as ALERT_SEVERITY_LEVEL_TYPED, ALERT_STATUS as ALERT_STATUS_TYPED, ALERT_REASON as ALERT_REASON_TYPED, ALERT_RULE_CONSUMER, } from '@kbn/rule-data-utils'; import { ALERT_DURATION as ALERT_DURATION_NON_TYPED, - ALERT_SEVERITY_LEVEL as ALERT_SEVERITY_LEVEL_NON_TYPED, ALERT_STATUS as ALERT_STATUS_NON_TYPED, ALERT_REASON as ALERT_REASON_NON_TYPED, TIMESTAMP, @@ -65,7 +63,6 @@ import { CoreStart } from '../../../../../../src/core/public'; const AlertConsumers: typeof AlertConsumersTyped = AlertConsumersNonTyped; const ALERT_DURATION: typeof ALERT_DURATION_TYPED = ALERT_DURATION_NON_TYPED; -const ALERT_SEVERITY_LEVEL: typeof ALERT_SEVERITY_LEVEL_TYPED = ALERT_SEVERITY_LEVEL_NON_TYPED; const ALERT_STATUS: typeof ALERT_STATUS_TYPED = ALERT_STATUS_NON_TYPED; const ALERT_REASON: typeof ALERT_REASON_TYPED = ALERT_REASON_NON_TYPED; @@ -134,14 +131,6 @@ export const columns: Array< id: ALERT_DURATION, initialWidth: 116, }, - { - columnHeaderType: 'not-filtered', - displayAsText: i18n.translate('xpack.observability.alertsTGrid.severityColumnDescription', { - defaultMessage: 'Severity', - }), - id: ALERT_SEVERITY_LEVEL, - initialWidth: 102, - }, { columnHeaderType: 'not-filtered', displayAsText: i18n.translate('xpack.observability.alertsTGrid.reasonColumnDescription', { diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 68d4482afd92c..eae33aa422ea1 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -18230,9 +18230,7 @@ "xpack.observability.alertsFlyout.durationLabel": "期間", "xpack.observability.alertsFlyout.expectedValueLabel": "想定された値", "xpack.observability.alertsFlyout.ruleTypeLabel": "ルールタイプ", - "xpack.observability.alertsFlyout.severityLabel": "深刻度", "xpack.observability.alertsFlyout.statusLabel": "ステータス", - "xpack.observability.alertsFlyout.triggeredLabel": "実行済み", "xpack.observability.alertsLinkTitle": "アラート", "xpack.observability.alertsTitle": "アラート", "xpack.observability.breadcrumbs.alertsLinkText": "アラート", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index fa6e840e023b3..08acc43b1b9a5 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -18640,9 +18640,7 @@ "xpack.observability.alertsFlyout.durationLabel": "持续时间", "xpack.observability.alertsFlyout.expectedValueLabel": "预期值", "xpack.observability.alertsFlyout.ruleTypeLabel": "规则类型", - "xpack.observability.alertsFlyout.severityLabel": "严重性", "xpack.observability.alertsFlyout.statusLabel": "状态", - "xpack.observability.alertsFlyout.triggeredLabel": "已触发", "xpack.observability.alertsLinkTitle": "告警", "xpack.observability.alertsTitle": "告警", "xpack.observability.breadcrumbs.alertsLinkText": "告警",