From a5d661c7f4e7cbaffc3efd0cb6b1267c354cbd6b Mon Sep 17 00:00:00 2001 From: Matthew Kime Date: Wed, 12 Feb 2020 16:18:59 -0600 Subject: [PATCH 1/3] Management Api - add to migration guide (#56892) * update management info in migration guide --- src/core/MIGRATION.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/MIGRATION.md b/src/core/MIGRATION.md index f8699364fa9e28..c942bddc9fd57b 100644 --- a/src/core/MIGRATION.md +++ b/src/core/MIGRATION.md @@ -1163,6 +1163,7 @@ import { setup, start } from '../core_plugins/visualizations/public/legacy'; | Legacy Platform | New Platform | Notes | | ------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | +| `import 'ui/management'` | `management.sections` | | | `import 'ui/apply_filters'` | N/A. Replaced by triggering an APPLY_FILTER_TRIGGER trigger. | Directive is deprecated. | | `import 'ui/filter_bar'` | `import { FilterBar } from '../data/public'` | Directive is deprecated. | | `import 'ui/query_bar'` | `import { QueryStringInput } from '../data/public'` | Directives are deprecated. | @@ -1240,7 +1241,7 @@ This table shows where these uiExports have moved to in the New Platform. In mos | `inspectorViews` | | Should be an API on the data (?) plugin. | | `interpreter` | | Should be an API on the interpreter plugin. | | `links` | n/a | Not necessary, just register your app via `core.application.register` | -| `managementSections` | [`plugins.management.sections.register`](/rfcs/text/0006_management_section_service.md) | API finalized, implementation in progress. | +| `managementSections` | [`plugins.management.sections.register`](/rfcs/text/0006_management_section_service.md) | | | `mappings` | | Part of SavedObjects, see [#33587](https://github.com/elastic/kibana/issues/33587) | | `migrations` | | Part of SavedObjects, see [#33587](https://github.com/elastic/kibana/issues/33587) | | `navbarExtensions` | n/a | Deprecated | From 0faab4aa48509fac2e5a4de3469b594df67f947f Mon Sep 17 00:00:00 2001 From: Andrea Del Rio Date: Wed, 12 Feb 2020 14:58:15 -0800 Subject: [PATCH 2/3] [Alerting] Create alert design cleanup (#56929) --- .../threshold/expression.tsx | 27 +++++++++++++++++-- .../threshold/visualization.tsx | 3 +-- .../action_connector_form/_index.scss | 4 +++ .../sections/alert_add/alert_form.tsx | 25 ++++++++++------- 4 files changed, 45 insertions(+), 14 deletions(-) diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_alert_types/threshold/expression.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_alert_types/threshold/expression.tsx index 1708b2f0ae016d..f7d2b8f60157ff 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_alert_types/threshold/expression.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_alert_types/threshold/expression.tsx @@ -10,6 +10,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { EuiFlexItem, EuiFlexGroup, + EuiFormLabel, EuiExpression, EuiPopover, EuiPopoverTitle, @@ -327,7 +328,15 @@ export const IndexThresholdAlertTypeExpression: React.FunctionComponent ) : null} - + + + + + + { setIndexPopoverOpen(true); @@ -370,6 +379,8 @@ export const IndexThresholdAlertTypeExpression: React.FunctionComponent + + ) : null} + + + + + + + + + = ({ > {error} - ); } @@ -248,7 +247,7 @@ export const ThresholdVisualization: React.FunctionComponent = ({
{alertVisualizationDataKeys.length ? ( - + +
@@ -609,17 +610,20 @@ export const AlertForm = ({ {canChangeTrigger ? ( - { setAlertProperty('alertTypeId', null); setAlertTypeModel(null); }} - > - - + /> ) : null} @@ -636,7 +640,7 @@ export const AlertForm = ({ {selectedGroupActions} {isAddActionPanelOpen ? ( - +
{alertTypeDetails} ) : ( +
Date: Wed, 12 Feb 2020 17:38:18 -0600 Subject: [PATCH 3/3] Use default spaces suffix for signals index if spaces disabled (#57244) Addresses #57221. Co-authored-by: Elastic Machine --- .../lib/detection_engine/routes/utils.test.ts | 33 +++++++++++++++++++ .../lib/detection_engine/routes/utils.ts | 2 +- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/utils.test.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/utils.test.ts index 3e3ccfe5babef6..2699f687c51066 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/utils.test.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/utils.test.ts @@ -11,6 +11,7 @@ import { transformBulkError, BulkError, createSuccessObject, + getIndex, ImportSuccessError, createImportErrorObject, transformImportError, @@ -292,4 +293,36 @@ describe('utils', () => { expect(transformed).toEqual(expected); }); }); + + describe('getIndex', () => { + it('appends the space ID to the configured index if spaces are enabled', () => { + const mockGet = jest.fn(); + const mockGetSpaceId = jest.fn(); + const config = jest.fn(() => ({ get: mockGet, has: jest.fn() })); + const server = { plugins: { spaces: { getSpaceId: mockGetSpaceId } }, config }; + + mockGet.mockReturnValue('mockSignalsIndex'); + mockGetSpaceId.mockReturnValue('myspace'); + // @ts-ignore-next-line TODO these dependencies are simplified on + // https://github.com/elastic/kibana/pull/56814. We're currently mocking + // out what we need. + const index = getIndex(null, server); + + expect(index).toEqual('mockSignalsIndex-myspace'); + }); + + it('appends the default space ID to the configured index if spaces are disabled', () => { + const mockGet = jest.fn(); + const config = jest.fn(() => ({ get: mockGet, has: jest.fn() })); + const server = { plugins: {}, config }; + + mockGet.mockReturnValue('mockSignalsIndex'); + // @ts-ignore-next-line TODO these dependencies are simplified on + // https://github.com/elastic/kibana/pull/56814. We're currently mocking + // out what we need. + const index = getIndex(null, server); + + expect(index).toEqual('mockSignalsIndex-default'); + }); + }); }); diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/utils.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/utils.ts index af78f60f16ae43..20871e5309c302 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/utils.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/utils.ts @@ -178,7 +178,7 @@ export const getIndex = ( request: RequestFacade | Omit, server: ServerFacade ): string => { - const spaceId = server.plugins.spaces.getSpaceId(request); + const spaceId = server.plugins.spaces?.getSpaceId?.(request) ?? 'default'; const signalsIndex = server.config().get(`xpack.${APP_ID}.${SIGNALS_INDEX_KEY}`); return `${signalsIndex}-${spaceId}`; };