Skip to content

Commit

Permalink
Merge branch 'main' into 184333-diagnostics-page-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored May 28, 2024
2 parents e99652e + 69b28f3 commit 9e9a558
Show file tree
Hide file tree
Showing 181 changed files with 2,934 additions and 1,399 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ x-pack/plugins/global_search_providers @elastic/appex-sharedux
x-pack/test/plugin_functional/plugins/global_search_test @elastic/kibana-core
x-pack/plugins/graph @elastic/kibana-visualizations
x-pack/plugins/grokdebugger @elastic/kibana-management
packages/kbn-grouping @elastic/response-ops
packages/kbn-guided-onboarding @elastic/appex-sharedux
examples/guided_onboarding_example @elastic/appex-sharedux
src/plugins/guided_onboarding @elastic/appex-sharedux
Expand Down Expand Up @@ -735,7 +736,6 @@ x-pack/packages/security-solution/data_table @elastic/security-threat-hunting-in
packages/kbn-securitysolution-ecs @elastic/security-threat-hunting-explore
packages/kbn-securitysolution-es-utils @elastic/security-detection-engine
packages/kbn-securitysolution-exception-list-components @elastic/security-detection-engine
packages/kbn-securitysolution-grouping @elastic/security-threat-hunting-explore
packages/kbn-securitysolution-hook-utils @elastic/security-detection-engine
packages/kbn-securitysolution-io-ts-alerting-types @elastic/security-detection-engine
packages/kbn-securitysolution-io-ts-list-types @elastic/security-detection-engine
Expand Down
2 changes: 1 addition & 1 deletion .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"filesManagement": "src/plugins/files_management",
"flot": "packages/kbn-flot-charts/lib",
"generateCsv": "packages/kbn-generate-csv",
"grouping": "packages/kbn-securitysolution-grouping/src",
"grouping": "packages/kbn-grouping/src",
"guidedOnboarding": "src/plugins/guided_onboarding",
"guidedOnboardingPackage": "packages/kbn-guided-onboarding",
"home": "src/plugins/home",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@
"@kbn/global-search-test-plugin": "link:x-pack/test/plugin_functional/plugins/global_search_test",
"@kbn/graph-plugin": "link:x-pack/plugins/graph",
"@kbn/grokdebugger-plugin": "link:x-pack/plugins/grokdebugger",
"@kbn/grouping": "link:packages/kbn-grouping",
"@kbn/guided-onboarding": "link:packages/kbn-guided-onboarding",
"@kbn/guided-onboarding-example-plugin": "link:examples/guided_onboarding_example",
"@kbn/guided-onboarding-plugin": "link:src/plugins/guided_onboarding",
Expand Down Expand Up @@ -739,7 +740,6 @@
"@kbn/securitysolution-ecs": "link:packages/kbn-securitysolution-ecs",
"@kbn/securitysolution-es-utils": "link:packages/kbn-securitysolution-es-utils",
"@kbn/securitysolution-exception-list-components": "link:packages/kbn-securitysolution-exception-list-components",
"@kbn/securitysolution-grouping": "link:packages/kbn-securitysolution-grouping",
"@kbn/securitysolution-hook-utils": "link:packages/kbn-securitysolution-hook-utils",
"@kbn/securitysolution-io-ts-alerting-types": "link:packages/kbn-securitysolution-io-ts-alerting-types",
"@kbn/securitysolution-io-ts-list-types": "link:packages/kbn-securitysolution-io-ts-list-types",
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions packages/kbn-grouping/README.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @kbn/grouping

Grouping component and query.
File renamed without changes.
26 changes: 26 additions & 0 deletions packages/kbn-grouping/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* 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.
*/

module.exports = {
preset: '@kbn/test',
rootDir: '../..',
roots: ['<rootDir>/packages/kbn-grouping'],
coverageReporters: ['text', 'html'],
collectCoverageFrom: [
'<rootDir>/packages/kbn-grouping/**/*.{ts,tsx}',
'!<rootDir>/packages/kbn-grouping/**/*.test',
'!<rootDir>/packages/kbn-grouping/**/types/*',
'!<rootDir>/packages/kbn-grouping/**/*.type',
'!<rootDir>/packages/kbn-grouping/**/*.styles',
'!<rootDir>/packages/kbn-grouping/**/mocks/*',
'!<rootDir>/packages/kbn-grouping/**/*.config',
'!<rootDir>/packages/kbn-grouping/**/translations',
'!<rootDir>/packages/kbn-grouping/**/types/*',
],
setupFilesAfterEnv: ['<rootDir>/packages/kbn-grouping/setup_test.ts'],
};
5 changes: 5 additions & 0 deletions packages/kbn-grouping/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "shared-common",
"id": "@kbn/grouping",
"owner": "@elastic/response-ops"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@kbn/securitysolution-grouping",
"name": "@kbn/grouping",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions packages/kbn-monaco/src/console/lexer_rules/console_editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
consoleSharedLexerRules,
matchTokensWithEOL,
matchToken,
matchTokens,
} from './shared';
import { monaco } from '../../monaco_imports';

Expand All @@ -31,6 +32,11 @@ export const lexerRules: monaco.languages.IMonarchLanguage = {
// text
matchToken('text', '.+?'),
],
comments: [
// line comment indicated by #
matchTokens(['comment.punctuation', 'comment.line'], /(#)(.*$)/),
...consoleSharedLexerRules.tokenizer.comments,
],
method_sep: [
// protocol host with slash
matchTokensWithEOL(
Expand Down
26 changes: 25 additions & 1 deletion packages/kbn-monaco/src/console/lexer_rules/console_output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
* Side Public License, v 1.
*/

import { consoleSharedLanguageConfiguration, consoleSharedLexerRules } from './shared';
import {
consoleSharedLanguageConfiguration,
consoleSharedLexerRules,
matchTokensWithEOL,
} from './shared';
import { monaco } from '../../monaco_imports';

export const consoleOutputLanguageConfiguration: monaco.languages.LanguageConfiguration = {
Expand All @@ -15,4 +19,24 @@ export const consoleOutputLanguageConfiguration: monaco.languages.LanguageConfig

export const consoleOutputLexerRules: monaco.languages.IMonarchLanguage = {
...consoleSharedLexerRules,
tokenizer: {
...consoleSharedLexerRules.tokenizer,
comments: [
// Line comment indicated by #
// Everything after the # character is matched, stopping right before the status code and status text at the end if they are present
matchTokensWithEOL('comment', /# .+?(?=\s+\d{3}(?: \w+)*$)/, 'root', 'status'),
...consoleSharedLexerRules.tokenizer.comments,
],
status: [
// Following HTTP response status codes conventions
// Informational responses (status codes 100 – 199)
matchTokensWithEOL('status.info', /\b1\d{2}(?: \w+)*$/, 'root'),
// Successful responses (status codes 200 – 299)
matchTokensWithEOL('status.success', /\b2\d{2}(?: \w+)*$/, 'root'),
// Redirection messages (status codes 300 – 399)
matchTokensWithEOL('status.redirect', /\b3\d{2}(?: \w+)*$/, 'root'),
// Client and server error responses (status codes 400 – 599)
matchTokensWithEOL('status.error', /\b[4-5]\d{2}(?: \w+)*$/, 'root'),
],
},
};
2 changes: 0 additions & 2 deletions packages/kbn-monaco/src/console/lexer_rules/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ export const consoleSharedLexerRules: monaco.languages.IMonarchLanguage = {
matchToken('paren.lparen', '{', 'json_root'),
],
comments: [
// line comment indicated by #
matchTokens(['comment.punctuation', 'comment.line'], /(#)(.*$)/),
// start a block comment indicated by /*
matchToken('comment.punctuation', /\/\*/, 'block_comment'),
// line comment indicated by //
Expand Down
20 changes: 20 additions & 0 deletions packages/kbn-monaco/src/console/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,26 @@ export const buildConsoleTheme = (): monaco.editor.IStandaloneThemeData => {
['constant.numeric'],
makeHighContrastColor(euiThemeVars.euiColorAccentText)(background)
),
...buildRuleGroup(
['status.info'],
makeHighContrastColor(euiThemeVars.euiColorWarningText)(background),
true
),
...buildRuleGroup(
['status.success'],
makeHighContrastColor(euiThemeVars.euiColorSuccessText)(background),
true
),
...buildRuleGroup(
['status.redirect'],
makeHighContrastColor(euiThemeVars.euiColorWarningText)(background),
true
),
...buildRuleGroup(
['status.error'],
makeHighContrastColor(euiThemeVars.euiColorDangerText)(background),
true
),
...buildRuleGroup(['method'], makeHighContrastColor(methodTextColor)(background)),
...buildRuleGroup(['url'], makeHighContrastColor(urlTextColor)(background)),
],
Expand Down
3 changes: 0 additions & 3 deletions packages/kbn-securitysolution-grouping/README.mdx

This file was deleted.

26 changes: 0 additions & 26 deletions packages/kbn-securitysolution-grouping/jest.config.js

This file was deleted.

5 changes: 0 additions & 5 deletions packages/kbn-securitysolution-grouping/kibana.jsonc

This file was deleted.

2 changes: 1 addition & 1 deletion src/dev/storybook/aliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const storybookAliases = {
expression_shape: 'src/plugins/expression_shape/.storybook',
expression_tagcloud: 'src/plugins/chart_expressions/expression_tagcloud/.storybook',
fleet: 'x-pack/plugins/fleet/.storybook',
grouping: 'packages/kbn-securitysolution-grouping/.storybook',
grouping: 'packages/kbn-grouping/.storybook',
home: 'src/plugins/home/.storybook',
infra: 'x-pack/plugins/observability_solution/infra/.storybook',
kibana_react: 'src/plugins/kibana_react/.storybook',
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,8 @@
"@kbn/graph-plugin/*": ["x-pack/plugins/graph/*"],
"@kbn/grokdebugger-plugin": ["x-pack/plugins/grokdebugger"],
"@kbn/grokdebugger-plugin/*": ["x-pack/plugins/grokdebugger/*"],
"@kbn/grouping": ["packages/kbn-grouping"],
"@kbn/grouping/*": ["packages/kbn-grouping/*"],
"@kbn/guided-onboarding": ["packages/kbn-guided-onboarding"],
"@kbn/guided-onboarding/*": ["packages/kbn-guided-onboarding/*"],
"@kbn/guided-onboarding-example-plugin": ["examples/guided_onboarding_example"],
Expand Down Expand Up @@ -1464,8 +1466,6 @@
"@kbn/securitysolution-es-utils/*": ["packages/kbn-securitysolution-es-utils/*"],
"@kbn/securitysolution-exception-list-components": ["packages/kbn-securitysolution-exception-list-components"],
"@kbn/securitysolution-exception-list-components/*": ["packages/kbn-securitysolution-exception-list-components/*"],
"@kbn/securitysolution-grouping": ["packages/kbn-securitysolution-grouping"],
"@kbn/securitysolution-grouping/*": ["packages/kbn-securitysolution-grouping/*"],
"@kbn/securitysolution-hook-utils": ["packages/kbn-securitysolution-hook-utils"],
"@kbn/securitysolution-hook-utils/*": ["packages/kbn-securitysolution-hook-utils/*"],
"@kbn/securitysolution-io-ts-alerting-types": ["packages/kbn-securitysolution-io-ts-alerting-types"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ describe('AlertingEventLogger', () => {
saved_objects: [
// @ts-ignore
...event.kibana?.saved_objects,
{ id: 'bbb', type: 'alert', type_id: 'test' },
{ id: 'bbb', type: 'alert', type_id: 'test', rel: 'primary' },
],
},
});
Expand Down Expand Up @@ -472,7 +472,7 @@ describe('AlertingEventLogger', () => {
saved_objects: [
// @ts-ignore
...event.kibana?.saved_objects,
{ id: 'bbb', type: 'alert', type_id: 'test' },
{ id: 'bbb', type: 'alert', type_id: 'test', rel: 'primary' },
],
},
});
Expand Down Expand Up @@ -567,7 +567,7 @@ describe('AlertingEventLogger', () => {
saved_objects: [
// @ts-ignore
...event.kibana?.saved_objects,
{ id: 'bbb', type: 'alert', type_id: 'test' },
{ id: 'bbb', type: 'alert', type_id: 'test', rel: 'primary' },
],
},
});
Expand Down Expand Up @@ -754,7 +754,7 @@ describe('AlertingEventLogger', () => {
const event = createAlertRecord(
backfillContext,
ruleData,
[adHocRunSO, { id: 'bbb', type: 'alert', typeId: 'test' }],
[adHocRunSO, { id: 'bbb', type: 'alert', typeId: 'test', relation: 'primary' }],
alert
);

Expand Down Expand Up @@ -1130,7 +1130,7 @@ describe('AlertingEventLogger', () => {
saved_objects: [
// @ts-ignore
...event.kibana?.saved_objects,
{ id: 'bbb', type: 'alert', type_id: 'test' },
{ id: 'bbb', type: 'alert', type_id: 'test', rel: 'primary' },
],
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ export class AlertingEventLogger {
typeId: type?.id,
type: RULE_SAVED_OBJECT_TYPE,
namespace: this.context?.namespace,
relation: SAVED_OBJECT_REL_PRIMARY,
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { useCasesToast } from '../../../common/use_cases_toast';
import { alertComment } from '../../../containers/mock';
import { useCreateAttachments } from '../../../containers/use_create_attachments';
import { CasesContext } from '../../cases_context';
import { CasesContextStoreActionsList } from '../../cases_context/cases_context_reducer';
import { CasesContextStoreActionsList } from '../../cases_context/state/cases_context_reducer';
import { ExternalReferenceAttachmentTypeRegistry } from '../../../client/attachment_framework/external_reference_registry';
import type { AddToExistingCaseModalProps } from './use_cases_add_to_existing_case_modal';
import { useCasesAddToExistingCaseModal } from './use_cases_add_to_existing_case_modal';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { CaseStatuses } from '../../../../common/types/domain';
import type { AllCasesSelectorModalProps } from '.';
import { useCasesToast } from '../../../common/use_cases_toast';
import type { CaseUI } from '../../../containers/types';
import { CasesContextStoreActionsList } from '../../cases_context/cases_context_reducer';
import { CasesContextStoreActionsList } from '../../cases_context/state/cases_context_reducer';
import { useCasesContext } from '../../cases_context/use_cases_context';
import { useCasesAddToNewCaseFlyout } from '../../create/flyout/use_cases_add_to_new_case_flyout';
import type { CaseAttachmentsWithoutOwner } from '../../../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { getAllCasesSelectorModalNoProviderLazy } from '../../client/ui/get_all_
import { getCreateCaseFlyoutLazyNoProvider } from '../../client/ui/get_create_case_flyout';
import type { AppMockRenderer } from '../../common/mock';
import { createAppMockRenderer } from '../../common/mock';
import { getInitialCasesContextState } from './cases_context_reducer';
import { getInitialCasesContextState } from './state/cases_context_reducer';
import { CasesGlobalComponents } from './cases_global_components';

jest.mock('../../client/ui/get_create_case_flyout');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import React from 'react';
import { getAllCasesSelectorModalNoProviderLazy } from '../../client/ui/get_all_cases_selector_modal';
import { getCreateCaseFlyoutLazyNoProvider } from '../../client/ui/get_create_case_flyout';
import type { CasesContextState } from './cases_context_reducer';
import type { CasesContextState } from './state/cases_context_reducer';

export const CasesGlobalComponents = React.memo(({ state }: { state: CasesContextState }) => {
return (
Expand Down
23 changes: 13 additions & 10 deletions x-pack/plugins/cases/public/components/cases_context/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { FilesContext } from '@kbn/shared-ux-file-context';

import type { QueryClient } from '@tanstack/react-query';
import { QueryClientProvider } from '@tanstack/react-query';
import type { CasesContextStoreAction } from './cases_context_reducer';
import type {
CasesFeaturesAllRequired,
CasesFeatures,
Expand All @@ -29,7 +28,9 @@ import { CasesGlobalComponents } from './cases_global_components';
import { DEFAULT_FEATURES } from '../../../common/constants';
import { constructFileKindIdByOwner } from '../../../common/files';
import { DEFAULT_BASE_PATH } from '../../common/navigation';
import { casesContextReducer, getInitialCasesContextState } from './cases_context_reducer';
import type { CasesContextStoreAction } from './state/cases_context_reducer';
import { casesContextReducer, getInitialCasesContextState } from './state/cases_context_reducer';
import { CasesStateContext } from './state/cases_state_context';
import { isRegisteredOwner } from '../../files';
import { casesQueryClient } from './query_client';

Expand Down Expand Up @@ -152,14 +153,16 @@ export const CasesProvider: FC<

return (
<QueryClientProvider client={queryClient}>
<CasesContext.Provider value={value}>
{applyFilesContext(
<>
<CasesGlobalComponents state={state} />
{children}
</>
)}
</CasesContext.Provider>
<CasesStateContext.Provider value={state}>
<CasesContext.Provider value={value}>
{applyFilesContext(
<>
<CasesGlobalComponents state={state} />
{children}
</>
)}
</CasesContext.Provider>
</CasesStateContext.Provider>
</QueryClientProvider>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*/

import { assertNever } from '@kbn/std';
import type { AllCasesSelectorModalProps } from '../all_cases/selector_modal';
import type { CreateCaseFlyoutProps } from '../create/flyout';
import type { AllCasesSelectorModalProps } from '../../all_cases/selector_modal';
import type { CreateCaseFlyoutProps } from '../../create/flyout';

export const getInitialCasesContextState = (): CasesContextState => {
return {
Expand Down
Loading

0 comments on commit 9e9a558

Please sign in to comment.