Skip to content

Commit 0c187b9

Browse files
committed
Merge remote-tracking branch 'upstream/main' into related-integration-ui-performance
2 parents 8ed29a4 + 1575f51 commit 0c187b9

58 files changed

Lines changed: 427 additions & 703 deletions

File tree

Some content is hidden

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

examples/esql_validation_example/public/app.tsx

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import {
2525
import type { CoreStart } from '@kbn/core/public';
2626

2727
import { ESQLCallbacks, ESQLRealField, validateQuery } from '@kbn/esql-validation-autocomplete';
28-
import { getAstAndSyntaxErrors } from '@kbn/esql-ast';
2928
import type { StartDependencies } from './plugin';
3029
import { CodeSnippet } from './code_snippet';
3130

@@ -77,16 +76,13 @@ export const App = (props: { core: CoreStart; plugins: StartDependencies }) => {
7776
if (currentQuery === '') {
7877
return;
7978
}
80-
validateQuery(
81-
currentQuery,
82-
getAstAndSyntaxErrors,
83-
{ ignoreOnMissingCallbacks: ignoreErrors },
84-
callbacks
85-
).then(({ errors: validationErrors, warnings: validationWarnings }) => {
86-
// syntax errors come with a slight different format than other validation errors
87-
setErrors(validationErrors.map((e) => ('severity' in e ? e.message : e.text)));
88-
setWarnings(validationWarnings.map((e) => e.text));
89-
});
79+
validateQuery(currentQuery, { ignoreOnMissingCallbacks: ignoreErrors }, callbacks).then(
80+
({ errors: validationErrors, warnings: validationWarnings }) => {
81+
// syntax errors come with a slight different format than other validation errors
82+
setErrors(validationErrors.map((e) => ('severity' in e ? e.message : e.text)));
83+
setWarnings(validationWarnings.map((e) => e.text));
84+
}
85+
);
9086
}, [currentQuery, ignoreErrors, callbacks]);
9187

9288
const checkboxes = [
@@ -106,7 +102,7 @@ export const App = (props: { core: CoreStart; plugins: StartDependencies }) => {
106102

107103
return (
108104
<EuiPage>
109-
<EuiPageBody style={{ maxWidth: 800, margin: '0 auto' }}>
105+
<EuiPageBody css={{ maxWidth: 800, margin: '0 auto' }}>
110106
<EuiPageHeader paddingSize="s" bottomBorder={true} pageTitle="ES|QL validation example" />
111107
<EuiPageSection paddingSize="s">
112108
<p>This app shows how to use the ES|QL validation API with all its options</p>

examples/esql_validation_example/public/code_snippet.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,14 @@ export function CodeSnippet({ currentQuery, callbacks, ignoreErrors }: CodeSnipp
5656
<EuiCodeBlock language="typescript" isCopyable>
5757
{`
5858
import { ESQLCallbacks, validateQuery } from '@kbn/esql-validation-autocomplete';
59-
import { getAstAndSyntaxErrors } from '@kbn/esql-ast';
59+
import { parse } from '@kbn/esql-ast';
6060
6161
const currentQuery = "${currentQuery}";
6262
6363
const callbacks: ESQLCallbacks = () => ${getCallbacksCode(callbacks)};
6464
6565
const {errors, warnings} = validateQuery(
6666
currentQuery,
67-
getAstAndSyntaxErrors,
6867
{ ignoreOnMissingCallbacks: ${Boolean(ignoreErrors)} },
6968
callbacks
7069
);

examples/esql_validation_example/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"@kbn/data-plugin",
1919
"@kbn/data-views-plugin",
2020
"@kbn/developer-examples-plugin",
21-
"@kbn/esql-ast",
2221
"@kbn/esql-validation-autocomplete",
2322
]
2423
}

src/core/packages/chrome/browser-internal/src/project_navigation/project_navigation_service.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ describe('initNavigation()', () => {
237237
const nodesBody = treeDefinition.body as ChromeProjectNavigationNode[];
238238
expect(nodesBody[1]).toEqual({
239239
id: 'node-1', // auto generated
240-
title: '',
241240
path: 'node-1',
242241
type: 'navGroup',
243242
isExternalLink: false,
@@ -246,7 +245,6 @@ describe('initNavigation()', () => {
246245
{
247246
id: 'node-0', // auto generated
248247
path: 'node-1.node-0',
249-
title: '',
250248
isExternalLink: false,
251249
sideNavStatus: 'visible',
252250
children: [
@@ -283,7 +281,6 @@ describe('initNavigation()', () => {
283281
{
284282
id: 'node-0', // auto generated
285283
path: 'node-4.node-0',
286-
title: '',
287284
isExternalLink: false,
288285
sideNavStatus: 'visible',
289286
children: [

src/core/packages/chrome/browser-internal/src/project_navigation/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ function extractParentPaths(key: string, navTree: Record<string, ChromeProjectNa
106106
}
107107

108108
return arr
109-
.reduce<string[]>((acc, currentValue, currentIndex) => {
109+
.reduce<string[]>((acc, _currentValue, currentIndex) => {
110110
acc.push(arr.slice(0, currentIndex + 1).join(''));
111111
return acc;
112112
}, [])
@@ -244,7 +244,7 @@ function getNodeStatus(
244244
function getTitleForNode(
245245
navNode: { title?: string; deepLink?: { title: string }; cloudLink?: CloudLinkId },
246246
{ deepLink, cloudLinks }: { deepLink?: ChromeNavLink; cloudLinks: CloudLinks }
247-
): string {
247+
): string | undefined {
248248
if (navNode.title) {
249249
return navNode.title;
250250
}
@@ -257,7 +257,7 @@ function getTitleForNode(
257257
return cloudLinks[navNode.cloudLink]?.title ?? '';
258258
}
259259

260-
return '';
260+
return; // title is optional in EuiCollapsibleNavItemProps
261261
}
262262

263263
function validateNodeProps<

src/core/packages/chrome/browser/src/project_navigation.ts

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

10-
import type { ComponentType, MouseEventHandler, ReactNode } from 'react';
10+
import type { ComponentType, MouseEventHandler } from 'react';
1111
import type { Location } from 'history';
1212
import type { EuiSideNavItemType, EuiThemeSizes, IconType } from '@elastic/eui';
1313
import type { Observable } from 'rxjs';
@@ -227,7 +227,7 @@ export interface ChromeProjectNavigationNode extends NodeDefinitionBase {
227227
/** Optional id, if not passed a "link" must be provided. */
228228
id: string;
229229
/** Optional title. If not provided and a "link" is provided the title will be the Deep link title */
230-
title: string;
230+
title?: string;
231231
/** Path in the tree of the node */
232232
path: string;
233233
/** App id or deeplink id */
@@ -250,10 +250,8 @@ export interface ChromeProjectNavigationNode extends NodeDefinitionBase {
250250

251251
export type PanelSelectedNode = Pick<
252252
ChromeProjectNavigationNode,
253-
'id' | 'children' | 'path' | 'sideNavStatus' | 'deepLink'
254-
> & {
255-
title: string | ReactNode;
256-
};
253+
'id' | 'children' | 'path' | 'sideNavStatus' | 'deepLink' | 'title'
254+
>;
257255

258256
/** @public */
259257
export interface SideNavCompProps {

src/platform/packages/shared/kbn-esql-ast/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export type {
2626
ESQLColumn,
2727
ESQLLiteral,
2828
ESQLParamLiteral,
29-
AstProviderFn,
3029
EditorError,
3130
ESQLAstNode,
3231
ESQLInlineCast,
@@ -57,7 +56,6 @@ export {
5756
parseErrors,
5857
type ParseOptions,
5958
type ParseResult,
60-
getAstAndSyntaxErrors,
6159
ESQLErrorListener,
6260
} from './src/parser';
6361

src/platform/packages/shared/kbn-esql-ast/src/parser/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ export {
1515
parseErrors,
1616
type ParseOptions,
1717
type ParseResult,
18-
19-
/** @deprecated Use `parse` instead. */
20-
parse as getAstAndSyntaxErrors,
2118
} from './parser';
2219

2320
export { ESQLErrorListener } from './esql_error_listener';

src/platform/packages/shared/kbn-esql-ast/src/types.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -489,13 +489,6 @@ export interface ESQLMessage {
489489
code: string;
490490
}
491491

492-
export type AstProviderFn = (text: string | undefined) =>
493-
| Promise<{
494-
ast: ESQLAst;
495-
errors: EditorError[];
496-
}>
497-
| { ast: ESQLAst; errors: EditorError[] };
498-
499492
export interface EditorError {
500493
startLineNumber: number;
501494
endLineNumber: number;

src/platform/packages/shared/kbn-esql-utils/src/utils/append_to_query.ts

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

10-
import { getAstAndSyntaxErrors } from '@kbn/esql-ast';
1110
import { parse, mutate, BasicPrettyPrinter } from '@kbn/esql-ast';
1211
import { sanitazeESQLInput } from './sanitaze_input';
1312

@@ -61,7 +60,7 @@ export function appendWhereClauseToESQLQuery(
6160
filterValue = '';
6261
}
6362

64-
const { ast } = getAstAndSyntaxErrors(baseESQLQuery);
63+
const { ast } = parse(baseESQLQuery);
6564

6665
const lastCommandIsWhere = ast[ast.length - 1].name === 'where';
6766
// if where command already exists in the end of the query:

0 commit comments

Comments
 (0)