Skip to content

Commit

Permalink
Merge branch 'main' into one-discover-logs-contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
davismcphee authored Jun 17, 2024
2 parents d7c7f55 + a9f5375 commit 35a32ce
Show file tree
Hide file tree
Showing 240 changed files with 8,587 additions and 2,624 deletions.
5 changes: 3 additions & 2 deletions .buildkite/ftr_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ enabled:
- x-pack/test/fleet_api_integration/config.epm.ts
- x-pack/test/fleet_api_integration/config.fleet.ts
- x-pack/test/fleet_api_integration/config.package_policy.ts
- x-pack/test/fleet_api_integration/config.space_awareness.ts
- x-pack/test/fleet_functional/config.ts
- x-pack/test/ftr_apis/security_and_spaces/config.ts
- x-pack/test/functional_basic/apps/ml/permissions/config.ts
Expand Down Expand Up @@ -442,7 +443,8 @@ enabled:
- x-pack/test_serverless/functional/test_suites/search/common_configs/config.group6.ts
- x-pack/test_serverless/functional/test_suites/security/config.ts
- x-pack/test_serverless/functional/test_suites/security/config.examples.ts
- x-pack/test_serverless/functional/test_suites/security/config.cloud_security_posture.ts
- x-pack/test_serverless/functional/test_suites/security/config.cloud_security_posture.basic.ts
- x-pack/test_serverless/functional/test_suites/security/config.cloud_security_posture.essentials.ts
- x-pack/test_serverless/functional/test_suites/security/config.saved_objects_management.ts
- x-pack/test_serverless/functional/test_suites/security/common_configs/config.group1.ts
- x-pack/test_serverless/functional/test_suites/security/common_configs/config.group2.ts
Expand Down Expand Up @@ -572,4 +574,3 @@ enabled:
- x-pack/test/security_solution_api_integration/test_suites/security_solution_endpoint/configs/serverless.integrations.config.ts
- x-pack/test/security_solution_api_integration/test_suites/security_solution_endpoint/configs/serverless.integrations_feature_flag.config.ts
- x-pack/test/security_solution_api_integration/test_suites/security_solution_endpoint/configs/integrations_feature_flag.config.ts

3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -1651,7 +1651,8 @@ x-pack/test/security_solution_api_integration/test_suites/genai @elastic/securit
/x-pack/test/cloud_security_posture_functional/ @elastic/kibana-cloud-security-posture
/x-pack/test/cloud_security_posture_api/ @elastic/kibana-cloud-security-posture
/x-pack/test_serverless/functional/test_suites/security/ftr/cloud_security_posture/ @elastic/kibana-cloud-security-posture
/x-pack/test_serverless/functional/test_suites/security/config.cloud_security_posture.ts @elastic/kibana-cloud-security-posture
/x-pack/test_serverless/functional/test_suites/security/config.cloud_security_posture.basic.ts @elastic/kibana-cloud-security-posture
/x-pack/test_serverless/functional/test_suites/security/config.cloud_security_posture.essentials.ts @elastic/kibana-cloud-security-posture
/x-pack/test_serverless/api_integration/test_suites/security/cloud_security_posture/ @elastic/kibana-cloud-security-posture
/x-pack/plugins/fleet/public/components/cloud_security_posture @elastic/fleet @elastic/kibana-cloud-security-posture
/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/components/cloud_security_posture @elastic/fleet @elastic/kibana-cloud-security-posture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Logger } from '../../lib/utils/create_logger';
import { RunOptions } from './parse_run_cli_flags';

async function discoverAuth(parsedTarget: Url) {
const possibleCredentials = [`admin:changeme`, `elastic:changeme`];
const possibleCredentials = [`admin:changeme`, `elastic:changeme`, `elastic_serverless:changeme`];
for (const auth of possibleCredentials) {
const url = format({
...parsedTarget,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { JSXElementConstructor, MutableRefObject } from 'react';
import React from 'react';
import type { EuiDataGridColumnCellActionProps, EuiDataGridRefProps } from '@elastic/eui';
import { EuiButtonEmpty, type EuiDataGridColumnCellAction } from '@elastic/eui';
import { render, waitFor, act } from '@testing-library/react';
import { render, waitFor } from '@testing-library/react';
import { renderHook } from '@testing-library/react-hooks';
import { makeAction } from '../mocks/helpers';
import type { UseDataGridColumnsCellActionsProps } from './use_data_grid_column_cell_actions';
Expand Down Expand Up @@ -74,25 +74,15 @@ describe('useDataGridColumnsCellActions', () => {
const { result, waitForNextUpdate } = renderHook(useDataGridColumnsCellActions, {
initialProps: useDataGridColumnsCellActionsProps,
});
expect(result.current).toHaveLength(columns.length);
expect(result.current[0]).toHaveLength(1); // loader

expect(result.current).toHaveLength(0);

await waitForNextUpdate();

expect(result.current).toHaveLength(columns.length);
expect(result.current[0]).toHaveLength(actions.length);
});

it('should render cell actions loading state', async () => {
const { result } = renderHook(useDataGridColumnsCellActions, {
initialProps: useDataGridColumnsCellActionsProps,
});
await act(async () => {
const cellAction = renderCellAction(result.current[0][0]);
expect(cellAction.getByTestId('dataGridColumnCellAction-loading')).toBeInTheDocument();
});
});

it('should call getCellValue with the proper params', async () => {
const { result, waitForNextUpdate } = renderHook(useDataGridColumnsCellActions, {
initialProps: useDataGridColumnsCellActionsProps,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
*/

import type { MutableRefObject } from 'react';
import React, { useCallback, useMemo, useRef } from 'react';
import React, { useCallback, useMemo, useRef, useState, useEffect } from 'react';
import type { EuiDataGridRefProps } from '@elastic/eui';
import { EuiLoadingSpinner, type EuiDataGridColumnCellAction } from '@elastic/eui';
import { type EuiDataGridColumnCellAction } from '@elastic/eui';
import type { FieldSpec } from '@kbn/data-views-plugin/common';
import type {
CellAction,
Expand Down Expand Up @@ -46,10 +46,6 @@ export type UseDataGridColumnsCellActions<
P extends UseDataGridColumnsCellActionsProps = UseDataGridColumnsCellActionsProps
> = (props: P) => EuiDataGridColumnCellAction[][];

// static actions array references to prevent React updates
const loadingColumnActions: EuiDataGridColumnCellAction[] = [
() => <EuiLoadingSpinner size="s" data-test-subj="dataGridColumnCellAction-loading" />,
];
const emptyActions: EuiDataGridColumnCellAction[][] = [];

export const useDataGridColumnsCellActions: UseDataGridColumnsCellActions = ({
Expand All @@ -60,6 +56,8 @@ export const useDataGridColumnsCellActions: UseDataGridColumnsCellActions = ({
dataGridRef,
disabledActionTypes = [],
}) => {
const [cellActions, setCellActions] = useState<EuiDataGridColumnCellAction[][]>(emptyActions);

const bulkContexts: CellActionCompatibilityContext[] | undefined = useMemo(() => {
if (!triggerId || !fields?.length) {
return undefined;
Expand All @@ -75,35 +73,35 @@ export const useDataGridColumnsCellActions: UseDataGridColumnsCellActions = ({
disabledActionTypes,
});

const columnsCellActions = useMemo<EuiDataGridColumnCellAction[][]>(() => {
if (loading) {
return fields?.length ? fields.map(() => loadingColumnActions) : emptyActions;
}
if (!triggerId || !columnsActions?.length || !fields?.length) {
return emptyActions;
useEffect(() => {
// no-op
if (loading || !triggerId || !columnsActions?.length || !fields?.length) {
return;
}

// Check for a temporary inconsistency because `useBulkLoadActions` takes one render loop before setting `loading` to true.
// It will eventually update to a consistent state
if (columnsActions.length !== fields.length) {
return emptyActions;
return;
}

return columnsActions.map((actions, columnIndex) =>
actions.map((action) =>
createColumnCellAction({
action,
field: fields[columnIndex],
getCellValue,
metadata,
triggerId,
dataGridRef,
})
setCellActions(
columnsActions.map((actions, columnIndex) =>
actions.map((action) =>
createColumnCellAction({
action,
field: fields[columnIndex],
getCellValue,
metadata,
triggerId,
dataGridRef,
})
)
)
);
}, [columnsActions, fields, getCellValue, loading, metadata, triggerId, dataGridRef]);

return columnsCellActions;
return cellActions;
};

interface CreateColumnCellActionParams
Expand Down
2 changes: 2 additions & 0 deletions packages/kbn-doc-links/src/get_doc_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
mappingSourceFields: `${ELASTICSEARCH_DOCS}mapping-source-field.html`,
mappingSourceFieldsDisable: `${ELASTICSEARCH_DOCS}mapping-source-field.html#disable-source-field`,
mappingStore: `${ELASTICSEARCH_DOCS}mapping-store.html`,
mappingSubobjects: `${ELASTICSEARCH_DOCS}subobjects.html`,
mappingTermVector: `${ELASTICSEARCH_DOCS}term-vector.html`,
mappingTypesRemoval: `${ELASTICSEARCH_DOCS}removal-of-types.html`,
migrateIndexAllocationFilters: `${ELASTICSEARCH_DOCS}migrate-index-allocation-filters.html`,
Expand Down Expand Up @@ -841,6 +842,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
datastreamsManualRollover: `${ELASTICSEARCH_DOCS}use-a-data-stream.html#manually-roll-over-a-data-stream`,
datastreamsTSDS: `${ELASTICSEARCH_DOCS}tsds.html`,
datastreamsTSDSMetrics: `${ELASTICSEARCH_DOCS}tsds.html#time-series-metric`,
datastreamsDownsampling: `${ELASTICSEARCH_DOCS}downsampling.html`,
installElasticAgent: `${FLEET_DOCS}install-fleet-managed-elastic-agent.html`,
installElasticAgentStandalone: `${FLEET_DOCS}install-standalone-elastic-agent.html`,
upgradeElasticAgent: `${FLEET_DOCS}upgrade-elastic-agent.html`,
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-doc-links/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ export interface DocLinks {
datastreamsManualRollover: string;
datastreamsTSDS: string;
datastreamsTSDSMetrics: string;
datastreamsDownsampling: string;
installElasticAgent: string;
installElasticAgentStandalone: string;
packageSignatures: string;
Expand Down
5 changes: 5 additions & 0 deletions packages/kbn-esql-ast/src/antlr/esql_lexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ ASTERISK : '*';
SLASH : '/';
PERCENT : '%';

NAMED_OR_POSITIONAL_PARAM
: PARAM LETTER UNQUOTED_ID_BODY*
| PARAM DIGIT+
;

// Brackets are funny. We can happen upon a CLOSING_BRACKET in two ways - one
// way is to start in an explain command which then shifts us to expression
// mode. Thus, the two popModes on CLOSING_BRACKET. The other way could as
Expand Down
5 changes: 4 additions & 1 deletion packages/kbn-esql-ast/src/antlr/esql_lexer.interp

Large diffs are not rendered by default.

129 changes: 65 additions & 64 deletions packages/kbn-esql-ast/src/antlr/esql_lexer.tokens
Original file line number Diff line number Diff line change
Expand Up @@ -65,62 +65,63 @@ MINUS=64
ASTERISK=65
SLASH=66
PERCENT=67
OPENING_BRACKET=68
CLOSING_BRACKET=69
UNQUOTED_IDENTIFIER=70
QUOTED_IDENTIFIER=71
EXPR_LINE_COMMENT=72
EXPR_MULTILINE_COMMENT=73
EXPR_WS=74
METADATA=75
FROM_LINE_COMMENT=76
FROM_MULTILINE_COMMENT=77
FROM_WS=78
ID_PATTERN=79
PROJECT_LINE_COMMENT=80
PROJECT_MULTILINE_COMMENT=81
PROJECT_WS=82
AS=83
RENAME_LINE_COMMENT=84
RENAME_MULTILINE_COMMENT=85
RENAME_WS=86
ON=87
WITH=88
ENRICH_POLICY_NAME=89
ENRICH_LINE_COMMENT=90
ENRICH_MULTILINE_COMMENT=91
ENRICH_WS=92
ENRICH_FIELD_LINE_COMMENT=93
ENRICH_FIELD_MULTILINE_COMMENT=94
ENRICH_FIELD_WS=95
LOOKUP_LINE_COMMENT=96
LOOKUP_MULTILINE_COMMENT=97
LOOKUP_WS=98
LOOKUP_FIELD_LINE_COMMENT=99
LOOKUP_FIELD_MULTILINE_COMMENT=100
LOOKUP_FIELD_WS=101
MVEXPAND_LINE_COMMENT=102
MVEXPAND_MULTILINE_COMMENT=103
MVEXPAND_WS=104
INFO=105
SHOW_LINE_COMMENT=106
SHOW_MULTILINE_COMMENT=107
SHOW_WS=108
FUNCTIONS=109
META_LINE_COMMENT=110
META_MULTILINE_COMMENT=111
META_WS=112
COLON=113
SETTING=114
SETTING_LINE_COMMENT=115
SETTTING_MULTILINE_COMMENT=116
SETTING_WS=117
METRICS_LINE_COMMENT=118
METRICS_MULTILINE_COMMENT=119
METRICS_WS=120
CLOSING_METRICS_LINE_COMMENT=121
CLOSING_METRICS_MULTILINE_COMMENT=122
CLOSING_METRICS_WS=123
NAMED_OR_POSITIONAL_PARAM=68
OPENING_BRACKET=69
CLOSING_BRACKET=70
UNQUOTED_IDENTIFIER=71
QUOTED_IDENTIFIER=72
EXPR_LINE_COMMENT=73
EXPR_MULTILINE_COMMENT=74
EXPR_WS=75
METADATA=76
FROM_LINE_COMMENT=77
FROM_MULTILINE_COMMENT=78
FROM_WS=79
ID_PATTERN=80
PROJECT_LINE_COMMENT=81
PROJECT_MULTILINE_COMMENT=82
PROJECT_WS=83
AS=84
RENAME_LINE_COMMENT=85
RENAME_MULTILINE_COMMENT=86
RENAME_WS=87
ON=88
WITH=89
ENRICH_POLICY_NAME=90
ENRICH_LINE_COMMENT=91
ENRICH_MULTILINE_COMMENT=92
ENRICH_WS=93
ENRICH_FIELD_LINE_COMMENT=94
ENRICH_FIELD_MULTILINE_COMMENT=95
ENRICH_FIELD_WS=96
LOOKUP_LINE_COMMENT=97
LOOKUP_MULTILINE_COMMENT=98
LOOKUP_WS=99
LOOKUP_FIELD_LINE_COMMENT=100
LOOKUP_FIELD_MULTILINE_COMMENT=101
LOOKUP_FIELD_WS=102
MVEXPAND_LINE_COMMENT=103
MVEXPAND_MULTILINE_COMMENT=104
MVEXPAND_WS=105
INFO=106
SHOW_LINE_COMMENT=107
SHOW_MULTILINE_COMMENT=108
SHOW_WS=109
FUNCTIONS=110
META_LINE_COMMENT=111
META_MULTILINE_COMMENT=112
META_WS=113
COLON=114
SETTING=115
SETTING_LINE_COMMENT=116
SETTTING_MULTILINE_COMMENT=117
SETTING_WS=118
METRICS_LINE_COMMENT=119
METRICS_MULTILINE_COMMENT=120
METRICS_WS=121
CLOSING_METRICS_LINE_COMMENT=122
CLOSING_METRICS_MULTILINE_COMMENT=123
CLOSING_METRICS_WS=124
'dissect'=1
'drop'=2
'enrich'=3
Expand Down Expand Up @@ -177,11 +178,11 @@ CLOSING_METRICS_WS=123
'*'=65
'/'=66
'%'=67
']'=69
'metadata'=75
'as'=83
'on'=87
'with'=88
'info'=105
'functions'=109
':'=113
']'=70
'metadata'=76
'as'=84
'on'=88
'with'=89
'info'=106
'functions'=110
':'=114
Loading

0 comments on commit 35a32ce

Please sign in to comment.