From ac9cba64d948334ad8b90981aa156d82c57632a1 Mon Sep 17 00:00:00 2001 From: Xavier Mouligneau <189600+XavierM@users.noreply.github.com> Date: Thu, 29 Jul 2021 17:33:54 -0400 Subject: [PATCH 1/5] integrating rbac search strategy with alert table --- .../pages/alerts/alerts_table_t_grid.tsx | 4 ++++ .../search_strategy/timeline/events/index.ts | 9 ++++---- .../components/t_grid/integrated/index.tsx | 5 +++++ .../components/t_grid/standalone/index.tsx | 4 ++++ .../timelines/public/container/index.tsx | 21 ++++++++++++++----- 5 files changed, 34 insertions(+), 9 deletions(-) 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 bd6844915459c0..ae87286bc0bf33 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 @@ -5,6 +5,7 @@ * 2.0. */ +import { ALERTS_CONSUMERS } from '@kbn/rule-data-utils/target/alerts_as_data_rbac'; import { EuiButtonIcon, EuiDataGridColumn } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import styled from 'styled-components'; @@ -109,6 +110,8 @@ const NO_ROW_RENDER: RowRenderer[] = []; const trailingControlColumns: never[] = []; +const O11Y_ALERT_CONSUMER = [ALERTS_CONSUMERS.APM, ALERTS_CONSUMERS.LOGS]; + export function AlertsTableTGrid(props: AlertsTableTGridProps) { const { core, observabilityRuleTypeRegistry } = usePluginContext(); const { prepend } = core.http.basePath; @@ -184,6 +187,7 @@ export function AlertsTableTGrid(props: AlertsTableTGridProps) { )} {timelines.getTGrid<'standalone'>({ + alertConsumers: O11Y_ALERT_CONSUMER, type: 'standalone', columns, deletedEventIds: [], diff --git a/x-pack/plugins/timelines/common/search_strategy/timeline/events/index.ts b/x-pack/plugins/timelines/common/search_strategy/timeline/events/index.ts index 82e439b386d606..6b204224d3d5de 100644 --- a/x-pack/plugins/timelines/common/search_strategy/timeline/events/index.ts +++ b/x-pack/plugins/timelines/common/search_strategy/timeline/events/index.ts @@ -17,7 +17,8 @@ export enum TimelineEventsQueries { lastEventTime = 'eventsLastEventTime', } -export enum EntityType { - ALERTS = 'alerts', - EVENTS = 'events', -} +export const EntityType = { + ALERTS: 'alerts', + EVENTS: 'events', +} as const; +export type EntityType = typeof EntityType[keyof typeof EntityType]; diff --git a/x-pack/plugins/timelines/public/components/t_grid/integrated/index.tsx b/x-pack/plugins/timelines/public/components/t_grid/integrated/index.tsx index 3f987e1f75e6aa..4c5603bfb79d12 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/integrated/index.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/integrated/index.tsx @@ -4,6 +4,8 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ + +import { ALERTS_CONSUMERS } from '@kbn/rule-data-utils/target/alerts_as_data_rbac'; import { EuiFlexGroup, EuiFlexItem, EuiPanel } from '@elastic/eui'; import { isEmpty } from 'lodash/fp'; import React, { useEffect, useMemo, useState } from 'react'; @@ -104,6 +106,8 @@ const HeaderFilterGroupWrapper = styled.header<{ show: boolean }>` ${({ show }) => (show ? '' : 'visibility: hidden;')} `; +const SECURITY_ALERTS_CONSUMERS = [ALERTS_CONSUMERS.SIEM]; + export interface TGridIntegratedProps { browserFields: BrowserFields; columns: ColumnHeaderOptions[]; @@ -237,6 +241,7 @@ const TGridIntegratedComponent: React.FC = ({ loading, { events, updatedAt, loadPage, pageInfo, refetch, totalCount = 0, inspect }, ] = useTimelineEvents({ + alertConsumers: SECURITY_ALERTS_CONSUMERS, docValueFields, fields, filterQuery: combinedQueries!.filterQuery, diff --git a/x-pack/plugins/timelines/public/components/t_grid/standalone/index.tsx b/x-pack/plugins/timelines/public/components/t_grid/standalone/index.tsx index cabedd84d270d1..ec40d87dc4f683 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/standalone/index.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/standalone/index.tsx @@ -4,6 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ +import type { ALERTS_CONSUMERS } from '@kbn/rule-data-utils/target/alerts_as_data_rbac'; import { EuiFlexGroup, EuiFlexItem, EuiPanel } from '@elastic/eui'; import { isEmpty } from 'lodash/fp'; import React, { useEffect, useMemo, useState } from 'react'; @@ -101,6 +102,7 @@ const HeaderFilterGroupWrapper = styled.header<{ show: boolean }>` `; export interface TGridStandaloneProps { + alertConsumers: ALERTS_CONSUMERS; columns: ColumnHeaderOptions[]; deletedEventIds: Readonly; end: string; @@ -129,6 +131,7 @@ export interface TGridStandaloneProps { const basicUnit = (n: number) => i18n.UNIT(n); const TGridStandaloneComponent: React.FC = ({ + alertConsumers, columns, deletedEventIds, end, @@ -217,6 +220,7 @@ const TGridStandaloneComponent: React.FC = ({ loading, { events, updatedAt, loadPage, pageInfo, refetch, totalCount = 0, inspect }, ] = useTimelineEvents({ + alertConsumers, docValueFields: [], excludeEcsData: true, fields, diff --git a/x-pack/plugins/timelines/public/container/index.tsx b/x-pack/plugins/timelines/public/container/index.tsx index c00d3ea7f934eb..6a6d0a20775510 100644 --- a/x-pack/plugins/timelines/public/container/index.tsx +++ b/x-pack/plugins/timelines/public/container/index.tsx @@ -5,6 +5,7 @@ * 2.0. */ +import type { ALERTS_CONSUMERS } from '@kbn/rule-data-utils/target/alerts_as_data_rbac'; import deepEqual from 'fast-deep-equal'; import { isEmpty, isString, noop } from 'lodash/fp'; import { useCallback, useEffect, useRef, useState } from 'react'; @@ -80,6 +81,7 @@ export interface UseTimelineEventsProps { startDate: string; timerangeKind?: 'absolute' | 'relative'; data?: DataPublicPluginStart; + alertConsumers?: ALERTS_CONSUMERS[]; } const createFilter = (filterQuery: ESQuery | string | undefined) => @@ -106,7 +108,9 @@ export const initSortDefault = [ }, ]; +const EMPTY_ARRAY: unknown[] = []; export const useTimelineEvents = ({ + alertConsumers = EMPTY_ARRAY, docValueFields, endDate, excludeEcsData = false, @@ -185,11 +189,16 @@ export const useTimelineEvents = ({ setLoading(true); if (data && data.search) { searchSubscription$.current = data.search - .search, TimelineResponse>(request, { - strategy: - request.language === 'eql' ? 'timelineEqlSearchStrategy' : 'timelineSearchStrategy', - abortSignal: abortCtrl.current.signal, - }) + .search, TimelineResponse>( + { ...request, entityType: 'alerts' }, + { + strategy: + request.language === 'eql' + ? 'timelineEqlSearchStrategy' + : 'timelineSearchStrategy', + abortSignal: abortCtrl.current.signal, + } + ) .subscribe({ next: (response) => { if (isCompleteResponse(response)) { @@ -262,6 +271,7 @@ export const useTimelineEvents = ({ : 0; const currentRequest = { + alertConsumers, defaultIndex: indexNames, docValueFields: docValueFields ?? [], excludeEcsData, @@ -291,6 +301,7 @@ export const useTimelineEvents = ({ return prevRequest; }); }, [ + alertConsumers, dispatch, indexNames, activePage, From 5da260eb1b86b78a425b29ad1f2771ae8e7871da Mon Sep 17 00:00:00 2001 From: Xavier Mouligneau <189600+XavierM@users.noreply.github.com> Date: Thu, 29 Jul 2021 20:48:50 -0400 Subject: [PATCH 2/5] fix types --- .../timelines/public/components/t_grid/standalone/index.tsx | 2 +- x-pack/plugins/timelines/public/container/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/timelines/public/components/t_grid/standalone/index.tsx b/x-pack/plugins/timelines/public/components/t_grid/standalone/index.tsx index ec40d87dc4f683..219101bc60d9fb 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/standalone/index.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/standalone/index.tsx @@ -102,7 +102,7 @@ const HeaderFilterGroupWrapper = styled.header<{ show: boolean }>` `; export interface TGridStandaloneProps { - alertConsumers: ALERTS_CONSUMERS; + alertConsumers: ALERTS_CONSUMERS[]; columns: ColumnHeaderOptions[]; deletedEventIds: Readonly; end: string; diff --git a/x-pack/plugins/timelines/public/container/index.tsx b/x-pack/plugins/timelines/public/container/index.tsx index 6a6d0a20775510..b4e19d0aed2960 100644 --- a/x-pack/plugins/timelines/public/container/index.tsx +++ b/x-pack/plugins/timelines/public/container/index.tsx @@ -108,7 +108,7 @@ export const initSortDefault = [ }, ]; -const EMPTY_ARRAY: unknown[] = []; +const EMPTY_ARRAY: ALERTS_CONSUMERS[] = []; export const useTimelineEvents = ({ alertConsumers = EMPTY_ARRAY, docValueFields, From 3c0cf2bc00531373e1c6d8b835c47103b945edc8 Mon Sep 17 00:00:00 2001 From: Xavier Mouligneau <189600+XavierM@users.noreply.github.com> Date: Fri, 30 Jul 2021 14:23:12 -0400 Subject: [PATCH 3/5] fix types + review I --- .../public/pages/alerts/alerts_table_t_grid.tsx | 6 +++++- .../public/applications/timelines_test/index.tsx | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) 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 ae87286bc0bf33..010ca417c7373c 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 @@ -110,7 +110,11 @@ const NO_ROW_RENDER: RowRenderer[] = []; const trailingControlColumns: never[] = []; -const O11Y_ALERT_CONSUMER = [ALERTS_CONSUMERS.APM, ALERTS_CONSUMERS.LOGS]; +const O11Y_ALERT_CONSUMER = [ + ALERTS_CONSUMERS.APM, + ALERTS_CONSUMERS.LOGS, + ALERTS_CONSUMERS.SYNTHETICS, +]; export function AlertsTableTGrid(props: AlertsTableTGridProps) { const { core, observabilityRuleTypeRegistry } = usePluginContext(); diff --git a/x-pack/test/plugin_functional/plugins/timelines_test/public/applications/timelines_test/index.tsx b/x-pack/test/plugin_functional/plugins/timelines_test/public/applications/timelines_test/index.tsx index e21ca4754e6cfa..cadcc2bb4e403a 100644 --- a/x-pack/test/plugin_functional/plugins/timelines_test/public/applications/timelines_test/index.tsx +++ b/x-pack/test/plugin_functional/plugins/timelines_test/public/applications/timelines_test/index.tsx @@ -5,6 +5,7 @@ * 2.0. */ +import { ALERTS_CONSUMERS } from '@kbn/rule-data-utils/target/alerts_as_data_rbac'; import { Router } from 'react-router-dom'; import React, { useCallback, useRef } from 'react'; import ReactDOM from 'react-dom'; @@ -37,6 +38,7 @@ export function renderApp( ReactDOM.unmountComponentAtNode(parameters.element); }; } +const ALERT_CONSUMER = [ALERTS_CONSUMERS.SIEM]; const AppRoot = React.memo( ({ @@ -61,6 +63,7 @@ const AppRoot = React.memo( {(timelinesPluginSetup && timelinesPluginSetup.getTGrid && timelinesPluginSetup.getTGrid<'standalone'>({ + alertConsumers: ALERT_CONSUMER, type: 'standalone', columns: [], indexNames: [], From d402d5180431c9f6d22fb3cbf6ba1cf01c90b60e Mon Sep 17 00:00:00 2001 From: Yara Tercero Date: Tue, 3 Aug 2021 14:47:30 -0700 Subject: [PATCH 4/5] updating with master and renaming a few things --- api_docs/timelines.json | 2 +- .../kbn-rule-data-utils/src/alerts_as_data_rbac.ts | 6 +++--- .../public/pages/alerts/alerts_table_t_grid.tsx | 13 +++++++------ .../common/search_strategy/timeline/index.ts | 4 ++-- .../public/components/t_grid/integrated/index.tsx | 4 ++-- .../public/components/t_grid/standalone/index.tsx | 4 ++-- x-pack/plugins/timelines/public/container/index.tsx | 6 +++--- .../server/search_strategy/timeline/index.ts | 4 ++-- .../public/applications/timelines_test/index.tsx | 4 ++-- 9 files changed, 24 insertions(+), 23 deletions(-) diff --git a/api_docs/timelines.json b/api_docs/timelines.json index f273ee5fc24ba5..42943819522168 100644 --- a/api_docs/timelines.json +++ b/api_docs/timelines.json @@ -10918,7 +10918,7 @@ "label": "alertConsumers", "description": [], "signature": [ - "ALERTS_CONSUMERS", + "AlertConsumers", "[] | undefined" ], "path": "x-pack/plugins/timelines/common/search_strategy/timeline/index.ts", diff --git a/packages/kbn-rule-data-utils/src/alerts_as_data_rbac.ts b/packages/kbn-rule-data-utils/src/alerts_as_data_rbac.ts index 2d0b0ec4a726c7..d3d20edffa2864 100644 --- a/packages/kbn-rule-data-utils/src/alerts_as_data_rbac.ts +++ b/packages/kbn-rule-data-utils/src/alerts_as_data_rbac.ts @@ -15,7 +15,7 @@ * setting, with which the user can change the index prefix. */ -export const ALERTS_CONSUMERS = { +export const AlertConsumers = { APM: 'apm', LOGS: 'logs', INFRASTRUCTURE: 'infrastructure', @@ -23,9 +23,9 @@ export const ALERTS_CONSUMERS = { SIEM: 'siem', SYNTHETICS: 'synthetics', } as const; -export type ALERTS_CONSUMERS = typeof ALERTS_CONSUMERS[keyof typeof ALERTS_CONSUMERS]; +export type AlertConsumers = typeof AlertConsumers[keyof typeof AlertConsumers]; -export const mapConsumerToIndexName: Record = { +export const mapConsumerToIndexName: Record = { apm: '.alerts-observability-apm', logs: '.alerts-observability.logs', infrastructure: '.alerts-observability.metrics', 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 47ff871ab13acf..33001fd34bcf6d 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 @@ -5,7 +5,7 @@ * 2.0. */ -import { ALERTS_CONSUMERS } from '@kbn/rule-data-utils/target/alerts_as_data_rbac'; +import { AlertConsumers } from '@kbn/rule-data-utils/target/alerts_as_data_rbac'; import { EuiButtonIcon, EuiDataGridColumn } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import styled from 'styled-components'; @@ -115,10 +115,11 @@ const NO_ROW_RENDER: RowRenderer[] = []; const trailingControlColumns: never[] = []; -const O11Y_ALERT_CONSUMER = [ - ALERTS_CONSUMERS.APM, - ALERTS_CONSUMERS.LOGS, - ALERTS_CONSUMERS.SYNTHETICS, +const OBSERVABILITY_ALERT_CONSUMERS = [ + AlertConsumers.APM, + AlertConsumers.LOGS, + AlertConsumers.INFRASTRUCTURE, + AlertConsumers.SYNTHETICS, ]; export function AlertsTableTGrid(props: AlertsTableTGridProps) { @@ -196,7 +197,7 @@ export function AlertsTableTGrid(props: AlertsTableTGridProps) { )} {timelines.getTGrid<'standalone'>({ - alertConsumers: O11Y_ALERT_CONSUMER, + alertConsumers: OBSERVABILITY_ALERT_CONSUMERS, type: 'standalone', columns, deletedEventIds: [], diff --git a/x-pack/plugins/timelines/common/search_strategy/timeline/index.ts b/x-pack/plugins/timelines/common/search_strategy/timeline/index.ts index cb5e27ec84d47d..99ee021cb68003 100644 --- a/x-pack/plugins/timelines/common/search_strategy/timeline/index.ts +++ b/x-pack/plugins/timelines/common/search_strategy/timeline/index.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import type { ALERTS_CONSUMERS } from '@kbn/rule-data-utils/target/alerts_as_data_rbac'; +import type { AlertConsumers } from '@kbn/rule-data-utils/target/alerts_as_data_rbac'; import { IEsSearchRequest } from '../../../../../../src/plugins/data/common'; import { ESQuery } from '../../typed_json'; @@ -44,7 +44,7 @@ export interface TimelineRequestBasicOptions extends IEsSearchRequest { docValueFields?: DocValueFields[]; factoryQueryType?: TimelineFactoryQueryTypes; entityType?: EntityType; - alertConsumers?: ALERTS_CONSUMERS[]; + alertConsumers?: AlertConsumers[]; } export interface TimelineRequestSortField extends SortField { diff --git a/x-pack/plugins/timelines/public/components/t_grid/integrated/index.tsx b/x-pack/plugins/timelines/public/components/t_grid/integrated/index.tsx index 550c72f7f2fa5c..f966d3f307af55 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/integrated/index.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/integrated/index.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { ALERTS_CONSUMERS } from '@kbn/rule-data-utils/target/alerts_as_data_rbac'; +import { AlertConsumers } from '@kbn/rule-data-utils/target/alerts_as_data_rbac'; import { EuiFlexGroup, EuiFlexItem, EuiPanel } from '@elastic/eui'; import { isEmpty } from 'lodash/fp'; import React, { useEffect, useMemo, useState } from 'react'; @@ -102,7 +102,7 @@ const HeaderFilterGroupWrapper = styled.header<{ show: boolean }>` ${({ show }) => (show ? '' : 'visibility: hidden;')} `; -const SECURITY_ALERTS_CONSUMERS = [ALERTS_CONSUMERS.SIEM]; +const SECURITY_ALERTS_CONSUMERS = [AlertConsumers.SIEM]; export interface TGridIntegratedProps { browserFields: BrowserFields; diff --git a/x-pack/plugins/timelines/public/components/t_grid/standalone/index.tsx b/x-pack/plugins/timelines/public/components/t_grid/standalone/index.tsx index 0ddcf3593e4be8..e4ca591147ec27 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/standalone/index.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/standalone/index.tsx @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import type { ALERTS_CONSUMERS } from '@kbn/rule-data-utils/target/alerts_as_data_rbac'; +import type { AlertConsumers } from '@kbn/rule-data-utils/target/alerts_as_data_rbac'; import { EuiFlexGroup, EuiFlexItem, EuiPanel } from '@elastic/eui'; import { isEmpty } from 'lodash/fp'; import React, { useEffect, useMemo, useState } from 'react'; @@ -98,7 +98,7 @@ const HeaderFilterGroupWrapper = styled.header<{ show: boolean }>` `; export interface TGridStandaloneProps { - alertConsumers: ALERTS_CONSUMERS[]; + alertConsumers: AlertConsumers[]; columns: ColumnHeaderOptions[]; deletedEventIds: Readonly; end: string; diff --git a/x-pack/plugins/timelines/public/container/index.tsx b/x-pack/plugins/timelines/public/container/index.tsx index b4e19d0aed2960..35a41a268fbfa5 100644 --- a/x-pack/plugins/timelines/public/container/index.tsx +++ b/x-pack/plugins/timelines/public/container/index.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import type { ALERTS_CONSUMERS } from '@kbn/rule-data-utils/target/alerts_as_data_rbac'; +import type { AlertConsumers } from '@kbn/rule-data-utils/target/alerts_as_data_rbac'; import deepEqual from 'fast-deep-equal'; import { isEmpty, isString, noop } from 'lodash/fp'; import { useCallback, useEffect, useRef, useState } from 'react'; @@ -81,7 +81,7 @@ export interface UseTimelineEventsProps { startDate: string; timerangeKind?: 'absolute' | 'relative'; data?: DataPublicPluginStart; - alertConsumers?: ALERTS_CONSUMERS[]; + alertConsumers?: AlertConsumers[]; } const createFilter = (filterQuery: ESQuery | string | undefined) => @@ -108,7 +108,7 @@ export const initSortDefault = [ }, ]; -const EMPTY_ARRAY: ALERTS_CONSUMERS[] = []; +const EMPTY_ARRAY: AlertConsumers[] = []; export const useTimelineEvents = ({ alertConsumers = EMPTY_ARRAY, docValueFields, diff --git a/x-pack/plugins/timelines/server/search_strategy/timeline/index.ts b/x-pack/plugins/timelines/server/search_strategy/timeline/index.ts index 431a71faf847e4..dfba32f8a238ce 100644 --- a/x-pack/plugins/timelines/server/search_strategy/timeline/index.ts +++ b/x-pack/plugins/timelines/server/search_strategy/timeline/index.ts @@ -11,7 +11,7 @@ import { from } from 'rxjs'; import { isValidFeatureId, mapConsumerToIndexName, - ALERTS_CONSUMERS, + AlertConsumers, } from '@kbn/rule-data-utils/target/alerts_as_data_rbac'; import { @@ -125,7 +125,7 @@ const timelineAlertsSearchStrategy = ({ deps: SearchStrategyDependencies; alerting: AlertingPluginStartContract; queryFactory: TimelineFactory; - alertConsumers: ALERTS_CONSUMERS[]; + alertConsumers: AlertConsumers[]; }) => { // Based on what solution alerts you want to see, figures out what corresponding // index to query (ex: siem --> .alerts-security.alerts) diff --git a/x-pack/test/plugin_functional/plugins/timelines_test/public/applications/timelines_test/index.tsx b/x-pack/test/plugin_functional/plugins/timelines_test/public/applications/timelines_test/index.tsx index f6f85d93b4e268..317010aca24bda 100644 --- a/x-pack/test/plugin_functional/plugins/timelines_test/public/applications/timelines_test/index.tsx +++ b/x-pack/test/plugin_functional/plugins/timelines_test/public/applications/timelines_test/index.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { ALERTS_CONSUMERS } from '@kbn/rule-data-utils/target/alerts_as_data_rbac'; +import { AlertConsumers } from '@kbn/rule-data-utils/target/alerts_as_data_rbac'; import { Router } from 'react-router-dom'; import React, { useCallback, useRef } from 'react'; import ReactDOM from 'react-dom'; @@ -38,7 +38,7 @@ export function renderApp( ReactDOM.unmountComponentAtNode(parameters.element); }; } -const ALERT_CONSUMER = [ALERTS_CONSUMERS.SIEM]; +const ALERT_CONSUMER = [AlertConsumers.SIEM]; const AppRoot = React.memo( ({ From 3c6ba02ce9f15bca1505b425f51a80f35fbb0f1f Mon Sep 17 00:00:00 2001 From: Yara Tercero Date: Thu, 5 Aug 2021 13:53:44 -0700 Subject: [PATCH 5/5] update const naming per feedback --- x-pack/plugins/timelines/public/container/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/timelines/public/container/index.tsx b/x-pack/plugins/timelines/public/container/index.tsx index 35a41a268fbfa5..5fb0ed56afaae3 100644 --- a/x-pack/plugins/timelines/public/container/index.tsx +++ b/x-pack/plugins/timelines/public/container/index.tsx @@ -108,9 +108,9 @@ export const initSortDefault = [ }, ]; -const EMPTY_ARRAY: AlertConsumers[] = []; +const NO_CONSUMERS: AlertConsumers[] = []; export const useTimelineEvents = ({ - alertConsumers = EMPTY_ARRAY, + alertConsumers = NO_CONSUMERS, docValueFields, endDate, excludeEcsData = false,