-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix_timeslice_chaining
- Loading branch information
Showing
320 changed files
with
2,170 additions
and
973 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* 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 { SerializedFieldFormat } from '@kbn/field-formats-plugin/common'; | ||
import type { IFieldSubType } from '@kbn/es-query'; | ||
import type { RuntimeField } from '@kbn/data-views-plugin/common'; | ||
|
||
export interface BrowserField { | ||
aggregatable: boolean; | ||
category: string; | ||
description?: string | null; | ||
example?: string | number | null; | ||
fields: Readonly<Record<string, Partial<BrowserField>>>; | ||
format?: SerializedFieldFormat; | ||
indexes: string[]; | ||
name: string; | ||
searchable: boolean; | ||
type: string; | ||
subType?: IFieldSubType; | ||
readFromDocValues: boolean; | ||
runtimeField?: RuntimeField; | ||
} | ||
|
||
export type BrowserFields = Record<string, Partial<BrowserField>>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...ages/kbn-alerts-ui-shared/src/common/apis/fetch_alerts_fields/fetch_alerts_fields.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* 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 { httpServiceMock } from '@kbn/core/public/mocks'; | ||
import { fetchAlertsFields } from '.'; | ||
import { AlertConsumers } from '@kbn/rule-data-utils'; | ||
|
||
describe('fetchAlertsFields', () => { | ||
const http = httpServiceMock.createStartContract(); | ||
test('should call the browser_fields API with the correct parameters', async () => { | ||
const featureIds = [AlertConsumers.STACK_ALERTS]; | ||
http.get.mockResolvedValueOnce({ | ||
browserFields: { fakeCategory: {} }, | ||
fields: [ | ||
{ | ||
name: 'fakeCategory', | ||
}, | ||
], | ||
}); | ||
const result = await fetchAlertsFields({ http, featureIds }); | ||
expect(result).toEqual({ | ||
browserFields: { fakeCategory: {} }, | ||
fields: [ | ||
{ | ||
name: 'fakeCategory', | ||
}, | ||
], | ||
}); | ||
expect(http.get).toHaveBeenLastCalledWith('/internal/rac/alerts/browser_fields', { | ||
query: { featureIds }, | ||
}); | ||
}); | ||
}); |
20 changes: 20 additions & 0 deletions
20
packages/kbn-alerts-ui-shared/src/common/apis/fetch_alerts_fields/fetch_alerts_fields.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* 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 type { FieldDescriptor } from '@kbn/data-views-plugin/server'; | ||
import type { BrowserFields } from '@kbn/alerting-types'; | ||
import type { FetchAlertsFieldsParams } from './types'; | ||
import { BASE_RAC_ALERTS_API_PATH } from '../../constants'; | ||
|
||
export const fetchAlertsFields = ({ http, featureIds }: FetchAlertsFieldsParams) => | ||
http.get<{ browserFields: BrowserFields; fields: FieldDescriptor[] }>( | ||
`${BASE_RAC_ALERTS_API_PATH}/browser_fields`, | ||
{ | ||
query: { featureIds }, | ||
} | ||
); |
10 changes: 10 additions & 0 deletions
10
packages/kbn-alerts-ui-shared/src/common/apis/fetch_alerts_fields/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export * from './fetch_alerts_fields'; | ||
export * from './types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.