Skip to content

Commit 52e532c

Browse files
authored
Merge branch 'main' into fix/team-2022
2 parents c86fe0c + 8ffa32a commit 52e532c

File tree

111 files changed

+2377
-763
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+2377
-763
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ target
1919
/build
2020
.jruby
2121
.idea
22+
.claude
2223
.windsurf
2324
*.iml
2425
*.log

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,7 @@
11481148
"@langchain/langgraph": "^0.2.45",
11491149
"@langchain/langgraph-checkpoint": "~0.0.17",
11501150
"@langchain/openai": "^0.4.4",
1151-
"@launchdarkly/node-server-sdk": "^9.10.1",
1151+
"@launchdarkly/node-server-sdk": "^9.10.2",
11521152
"@launchdarkly/openfeature-node-server": "^1.1.0",
11531153
"@loaders.gl/core": "^3.4.7",
11541154
"@loaders.gl/json": "^3.4.7",

packages/kbn-optimizer/limits.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pageLoadAssetSize:
1111
canvas: 15210
1212
cases: 153204
1313
charts: 40269
14-
cloud: 8836
14+
cloud: 9012
1515
cloudDataMigration: 5687
1616
cloudExperiments: 103984
1717
cloudFullStory: 4752

src/platform/packages/private/kbn-esql-editor/src/editor_footer/errors_warnings_popover.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,26 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

10-
import React, { useCallback, useMemo } from 'react';
11-
import { i18n } from '@kbn/i18n';
1210
import {
11+
EuiButtonEmpty,
12+
EuiDescriptionList,
13+
EuiDescriptionListDescription,
1314
EuiFlexGroup,
1415
EuiFlexItem,
1516
EuiIcon,
1617
EuiPopover,
17-
EuiDescriptionList,
18-
EuiDescriptionListDescription,
19-
EuiButtonEmpty,
20-
euiTextBreakWord,
2118
EuiSwitch,
2219
EuiText,
20+
euiTextBreakWord,
2321
useEuiTheme,
2422
} from '@elastic/eui';
25-
import { css } from '@emotion/react';
2623
import { css as classNameCss } from '@emotion/css';
24+
import { css } from '@emotion/react';
25+
import { i18n } from '@kbn/i18n';
2726
import { FormattedMessage } from '@kbn/i18n-react';
28-
import { filterDataErrors, type MonacoMessage } from '../helpers';
27+
import React, { useCallback, useMemo } from 'react';
28+
import type { MonacoMessage } from '@kbn/monaco/src/languages/esql/language';
29+
import { filterDataErrors } from '../helpers';
2930
import type { DataErrorsControl } from '../types';
3031

3132
interface TypeConsts {

src/platform/packages/private/kbn-esql-editor/src/editor_footer/index.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,32 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

10-
import React, { memo, useState, useCallback, useMemo } from 'react';
11-
import { i18n } from '@kbn/i18n';
1210
import {
13-
EuiText,
11+
EuiButtonEmpty,
12+
EuiButtonIcon,
13+
EuiCode,
1414
EuiFlexGroup,
1515
EuiFlexItem,
16-
EuiCode,
17-
EuiButtonIcon,
18-
EuiButtonEmpty,
16+
EuiText,
1917
EuiToolTip,
2018
} from '@elastic/eui';
2119
import type { Interpolation, Theme } from '@emotion/react';
2220
import { css } from '@emotion/react';
21+
import { getLimitFromESQLQuery } from '@kbn/esql-utils';
22+
import { i18n } from '@kbn/i18n';
2323
import { useKibana } from '@kbn/kibana-react-plugin/public';
2424
import {
25-
LanguageDocumentationInline,
2625
LanguageDocumentationFlyout,
26+
LanguageDocumentationInline,
2727
} from '@kbn/language-documentation';
28-
import { getLimitFromESQLQuery } from '@kbn/esql-utils';
29-
import { type MonacoMessage } from '../helpers';
28+
import React, { memo, useCallback, useMemo, useState } from 'react';
29+
import type { MonacoMessage } from '@kbn/monaco/src/languages/esql/language';
30+
import type { DataErrorsControl, ESQLEditorDeps } from '../types';
3031
import { ErrorsWarningsFooterPopover } from './errors_warnings_popover';
31-
import { QueryHistoryAction, HistoryAndStarredQueriesTabs } from './history_starred_queries';
3232
import { SubmitFeedbackComponent } from './feedback_component';
33-
import { QueryWrapComponent } from './query_wrap_component';
33+
import { HistoryAndStarredQueriesTabs, QueryHistoryAction } from './history_starred_queries';
3434
import { KeyboardShortcuts } from './keyboard_shortcuts';
35-
import type { DataErrorsControl, ESQLEditorDeps } from '../types';
35+
import { QueryWrapComponent } from './query_wrap_component';
3636

3737
const isMac = navigator.platform.toLowerCase().indexOf('mac') >= 0;
3838
const COMMAND_KEY = isMac ? '⌘' : '^';

src/platform/packages/private/kbn-esql-editor/src/esql_editor.test.tsx

Lines changed: 67 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

10-
import React from 'react';
11-
import userEvent from '@testing-library/user-event';
12-
import { BehaviorSubject } from 'rxjs';
10+
import type { SerializedStyles } from '@emotion/react';
1311
import type { IUiSettingsClient } from '@kbn/core/public';
14-
import { renderWithI18n } from '@kbn/test-jest-helpers';
15-
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
16-
import { ESQLEditor } from './esql_editor';
17-
import type { ESQLEditorProps } from './types';
1812
import { coreMock } from '@kbn/core/public/mocks';
1913
import { dataPluginMock } from '@kbn/data-plugin/public/mocks';
14+
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
15+
import { renderWithI18n } from '@kbn/test-jest-helpers';
2016
import { waitFor } from '@testing-library/dom';
2117
import { act } from '@testing-library/react';
22-
import type { SerializedStyles } from '@emotion/react';
18+
import userEvent from '@testing-library/user-event';
19+
import React from 'react';
20+
import { BehaviorSubject } from 'rxjs';
21+
import { ESQLEditor } from './esql_editor';
22+
import type { ESQLEditorProps } from './types';
2323

2424
const mockValidate = jest.fn().mockResolvedValue({ errors: [], warnings: [] });
2525
jest.mock('@kbn/monaco', () => ({
@@ -212,37 +212,68 @@ describe('ESQLEditor', () => {
212212
expect(queryByTestId('ESQLEditor-run-query-button')).not.toBeInTheDocument();
213213
});
214214

215-
it('should render the data errors switch if the dataErrorsControl prop is set', async () => {
216-
const newProps = {
217-
...props,
218-
dataErrorsControl: { enabled: true, onChange: jest.fn() },
219-
};
220-
mockValidate.mockResolvedValue({
221-
errors: [{ message: 'Data error example', severity: 'error' }],
222-
warnings: [],
223-
});
224-
const { queryByTestId } = renderWithI18n(renderESQLEditorComponent(newProps));
225-
await waitFor(() => {
226-
expect(queryByTestId('ESQLEditor-footerPopoverButton-error')).toBeInTheDocument();
227-
});
228-
act(() => {
229-
queryByTestId('ESQLEditor-footerPopoverButton-error')?.click();
230-
});
231-
expect(queryByTestId('ESQLEditor-footerPopover-dataErrorsSwitch')).toBeInTheDocument();
232-
});
215+
describe('data errors switch', () => {
216+
test('shown with errors enabled', async () => {
217+
const newProps = {
218+
...props,
219+
dataErrorsControl: { enabled: true, onChange: jest.fn() },
220+
};
221+
mockValidate.mockResolvedValue({
222+
errors: [
223+
{ message: 'Data error example', severity: 'error', code: 'unknownColumn' },
224+
{ message: 'Data error example', severity: 'error', code: 'unknownIndex' },
225+
],
226+
warnings: [],
227+
});
228+
const { queryByTestId, queryAllByText } = renderWithI18n(renderESQLEditorComponent(newProps));
229+
await waitFor(() => {
230+
expect(queryByTestId('ESQLEditor-footerPopoverButton-error')).toBeInTheDocument();
231+
});
232+
act(() => {
233+
queryByTestId('ESQLEditor-footerPopoverButton-error')?.click();
234+
});
235+
expect(queryByTestId('ESQLEditor-footerPopover-dataErrorsSwitch')).toBeInTheDocument();
233236

234-
it('should not render the data errors switch if the dataErrorsControl prop is not set', async () => {
235-
mockValidate.mockResolvedValue({
236-
errors: [{ message: 'Data error example', severity: 'error' }],
237-
warnings: [],
237+
expect(queryAllByText('Data error example')).toHaveLength(2);
238238
});
239-
const { queryByTestId } = renderWithI18n(renderESQLEditorComponent(props));
240-
await waitFor(() => {
241-
expect(queryByTestId('ESQLEditor-footerPopoverButton-error')).toBeInTheDocument();
239+
240+
test('shown with errors disabled', async () => {
241+
const newProps = {
242+
...props,
243+
dataErrorsControl: { enabled: false, onChange: jest.fn() },
244+
};
245+
mockValidate.mockResolvedValue({
246+
errors: [
247+
{ message: 'Data error example', severity: 'error', code: 'unknownColumn' },
248+
{ message: 'Data error example', severity: 'error', code: 'unknownIndex' },
249+
],
250+
warnings: [],
251+
});
252+
const { queryByTestId, queryAllByText } = renderWithI18n(renderESQLEditorComponent(newProps));
253+
await waitFor(() => {
254+
expect(queryByTestId('ESQLEditor-footerPopoverButton-error')).toBeInTheDocument();
255+
});
256+
act(() => {
257+
queryByTestId('ESQLEditor-footerPopoverButton-error')?.click();
258+
});
259+
expect(queryByTestId('ESQLEditor-footerPopover-dataErrorsSwitch')).toBeInTheDocument();
260+
261+
expect(queryAllByText('Data error example')).toHaveLength(0);
242262
});
243-
act(() => {
244-
queryByTestId('ESQLEditor-footerPopoverButton-error')?.click();
263+
264+
test('not shown when prop not set', async () => {
265+
mockValidate.mockResolvedValue({
266+
errors: [{ message: 'Data error example', severity: 'error' }],
267+
warnings: [],
268+
});
269+
const { queryByTestId } = renderWithI18n(renderESQLEditorComponent(props));
270+
await waitFor(() => {
271+
expect(queryByTestId('ESQLEditor-footerPopoverButton-error')).toBeInTheDocument();
272+
});
273+
act(() => {
274+
queryByTestId('ESQLEditor-footerPopoverButton-error')?.click();
275+
});
276+
expect(queryByTestId('ESQLEditor-footerPopover-dataErrorsSwitch')).not.toBeInTheDocument();
245277
});
246-
expect(queryByTestId('ESQLEditor-footerPopover-dataErrorsSwitch')).not.toBeInTheDocument();
247278
});
248279
});

src/platform/packages/private/kbn-esql-editor/src/esql_editor.tsx

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,74 +8,74 @@
88
*/
99

1010
import {
11+
EuiButton,
12+
EuiDatePicker,
1113
EuiFlexGroup,
1214
EuiFlexItem,
15+
EuiFormLabel,
1316
EuiOutsideClickDetector,
14-
useEuiTheme,
15-
EuiDatePicker,
1617
EuiToolTip,
17-
EuiButton,
18-
type EuiButtonColor,
18+
useEuiTheme,
1919
useGeneratedHtmlId,
20-
EuiFormLabel,
20+
type EuiButtonColor,
2121
} from '@elastic/eui';
22-
import { i18n } from '@kbn/i18n';
23-
import moment from 'moment';
24-
import { isEqual, memoize } from 'lodash';
22+
import { Global, css } from '@emotion/react';
2523
import type { CodeEditorProps } from '@kbn/code-editor';
2624
import { CodeEditor } from '@kbn/code-editor';
27-
import type { SerializedEnrichPolicy } from '@kbn/index-management-shared-types';
28-
import useObservable from 'react-use/lib/useObservable';
29-
import { KBN_FIELD_TYPES } from '@kbn/field-types';
3025
import type { CoreStart } from '@kbn/core/public';
3126
import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public';
3227
import type { AggregateQuery, TimeRange } from '@kbn/es-query';
28+
import type { FieldType } from '@kbn/esql-ast';
29+
import type { ESQLFieldWithMetadata } from '@kbn/esql-ast/src/commands_registry/types';
30+
import {
31+
ESQLVariableType,
32+
type ESQLControlVariable,
33+
type IndicesAutocompleteResult,
34+
} from '@kbn/esql-types';
35+
import { fixESQLQueryWithVariables, getRemoteClustersFromESQLQuery } from '@kbn/esql-utils';
3336
import type { ExpressionsStart } from '@kbn/expressions-plugin/public';
37+
import { KBN_FIELD_TYPES } from '@kbn/field-types';
38+
import { i18n } from '@kbn/i18n';
39+
import type { SerializedEnrichPolicy } from '@kbn/index-management-shared-types';
3440
import { useKibana } from '@kbn/kibana-react-plugin/public';
3541
import type { ILicense } from '@kbn/licensing-types';
3642
import { ESQLLang, ESQL_LANG_ID, monaco, type ESQLCallbacks } from '@kbn/monaco';
43+
import type { MonacoMessage } from '@kbn/monaco/src/languages/esql/language';
44+
import { isEqual, memoize } from 'lodash';
45+
import moment from 'moment';
3746
import type { ComponentProps } from 'react';
3847
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
39-
import { fixESQLQueryWithVariables, getRemoteClustersFromESQLQuery } from '@kbn/esql-utils';
4048
import { createPortal } from 'react-dom';
41-
import { css, Global } from '@emotion/react';
42-
import {
43-
ESQLVariableType,
44-
type ESQLControlVariable,
45-
type IndicesAutocompleteResult,
46-
} from '@kbn/esql-types';
47-
import type { ESQLFieldWithMetadata } from '@kbn/esql-ast/src/commands_registry/types';
48-
import type { FieldType } from '@kbn/esql-ast';
49+
import useObservable from 'react-use/lib/useObservable';
50+
import { useCanCreateLookupIndex, useLookupIndexCommand } from './custom_commands';
4951
import { EditorFooter } from './editor_footer';
52+
import {
53+
EDITOR_INITIAL_HEIGHT,
54+
EDITOR_INITIAL_HEIGHT_INLINE_EDITING,
55+
EDITOR_MAX_HEIGHT,
56+
RESIZABLE_CONTAINER_INITIAL_HEIGHT,
57+
esqlEditorStyles,
58+
} from './esql_editor.styles';
5059
import { fetchFieldsFromESQL } from './fetch_fields_from_esql';
5160
import {
5261
clearCacheWhenOld,
62+
filterDataErrors,
5363
getESQLSources,
64+
getEditorOverwrites,
65+
onKeyDownResizeHandler,
66+
onMouseDownResizeHandler,
5467
parseErrors,
5568
parseWarning,
5669
useDebounceWithOptions,
57-
onKeyDownResizeHandler,
58-
onMouseDownResizeHandler,
59-
getEditorOverwrites,
60-
type MonacoMessage,
61-
filterDataErrors,
6270
} from './helpers';
6371
import { addQueriesToCache } from './history_local_storage';
6472
import { ResizableButton } from './resizable_button';
65-
import {
66-
EDITOR_INITIAL_HEIGHT,
67-
EDITOR_INITIAL_HEIGHT_INLINE_EDITING,
68-
RESIZABLE_CONTAINER_INITIAL_HEIGHT,
69-
EDITOR_MAX_HEIGHT,
70-
esqlEditorStyles,
71-
} from './esql_editor.styles';
73+
import { useRestorableState, withRestorableState } from './restorable_state';
7274
import type {
73-
ESQLEditorProps as ESQLEditorPropsInternal,
74-
ESQLEditorDeps,
7575
ControlsContext,
76+
ESQLEditorDeps,
77+
ESQLEditorProps as ESQLEditorPropsInternal,
7678
} from './types';
77-
import { useRestorableState, withRestorableState } from './restorable_state';
78-
import { useCanCreateLookupIndex, useLookupIndexCommand } from './custom_commands';
7979

8080
// for editor width smaller than this value we want to start hiding some text
8181
const BREAKPOINT_WIDTH = 540;
@@ -687,7 +687,13 @@ const ESQLEditorInternal = function ESQLEditor({
687687
}
688688
if (active) {
689689
setEditorMessages({ errors: parserErrors, warnings: parserWarnings });
690-
monaco.editor.setModelMarkers(editorModel.current, 'Unified search', markers);
690+
monaco.editor.setModelMarkers(
691+
editorModel.current,
692+
'Unified search',
693+
// don't show the code in the editor
694+
// but we need it above
695+
markers.map((m) => ({ ...m, code: undefined }))
696+
);
691697
return;
692698
}
693699
},

0 commit comments

Comments
 (0)