Skip to content

Commit

Permalink
Merge branch 'main' into feat/data-ingestion-hub-header-cards
Browse files Browse the repository at this point in the history
  • Loading branch information
agusruidiazgd authored Sep 10, 2024
2 parents 639f044 + 65e53eb commit 8110f9e
Show file tree
Hide file tree
Showing 91 changed files with 2,022 additions and 17,092 deletions.
4 changes: 0 additions & 4 deletions .buildkite/scripts/steps/esql_generate_function_metadata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ main () {

yarn make:defs $PARENT_DIR/elasticsearch

report_main_step "Generate function validation tests"

yarn make:tests

report_main_step "Generate inline function docs"

cd "$KIBANA_DIR/$EDITOR_PACKAGE_DIR"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ const initialSerializedControlGroupState = {
} as object,
references: [
{
name: `controlGroup_${rangeSliderControlId}:${RANGE_SLIDER_CONTROL}DataView`,
name: `controlGroup_${rangeSliderControlId}:rangeSliderDataView`,
type: 'index-pattern',
id: WEB_LOGS_DATA_VIEW_ID,
},
{
name: `controlGroup_${optionsListId}:${OPTIONS_LIST_CONTROL}DataView`,
name: `controlGroup_${optionsListId}:optionsListDataView`,
type: 'index-pattern',
id: WEB_LOGS_DATA_VIEW_ID,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import React, { useEffect, useState } from 'react';
import { ViewMode } from '@kbn/embeddable-plugin/public';
import type { DataView } from '@kbn/data-views-plugin/public';
import { EuiPanel, EuiSpacer, EuiText, EuiTitle } from '@elastic/eui';
import { controlGroupInputBuilder } from '@kbn/controls-plugin/public';
import { getDefaultControlGroupInput } from '@kbn/controls-plugin/common';
import { controlGroupStateBuilder } from '@kbn/controls-plugin/public';
import {
AwaitingDashboardAPI,
DashboardRenderer,
Expand Down Expand Up @@ -64,16 +63,15 @@ export const DashboardWithControlsExample = ({ dataView }: { dataView: DataView
<EuiPanel hasBorder={true}>
<DashboardRenderer
getCreationOptions={async (): Promise<DashboardCreationOptions> => {
const builder = controlGroupInputBuilder;
const controlGroupInput = getDefaultControlGroupInput();
await builder.addDataControlFromField(controlGroupInput, {
const controlGroupState = {};
await controlGroupStateBuilder.addDataControlFromField(controlGroupState, {
dataViewId: dataView.id ?? '',
title: 'Destintion country',
fieldName: 'geo.dest',
width: 'medium',
grow: false,
});
await builder.addDataControlFromField(controlGroupInput, {
await controlGroupStateBuilder.addDataControlFromField(controlGroupState, {
dataViewId: dataView.id ?? '',
fieldName: 'bytes',
width: 'medium',
Expand All @@ -86,7 +84,7 @@ export const DashboardWithControlsExample = ({ dataView }: { dataView: DataView
getInitialInput: () => ({
timeRange: { from: 'now-30d', to: 'now' },
viewMode: ViewMode.VIEW,
controlGroupInput,
controlGroupState,
}),
};
}}
Expand Down
14 changes: 0 additions & 14 deletions packages/kbn-esql-validation-autocomplete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,20 +284,6 @@ It accepts
2. a list of expected errors (can be empty)
3. a list of expected warnings (can be empty or omitted)

The bulk of the validation tests are auto-generated from function definitions. All the generated function tests are found within the following describe block

```ts
describe(FUNCTION_DESCRIBE_BLOCK_NAME, () => {
...
});
```

They are currently generated in CI when a new function definition is added. The generator script is at `packages/kbn-esql-validation-autocomplete/scripts/generate_function_validation_tests.ts`.

The generator can be run locally using the `cd packages/kbn-esql-validation-autocomplete && yarn make:tests`.

It is not perfect and occasionally creates a test case that is invalid for a particular function. So, humans are allowed to edit the expected assertions for any test case—those edits will not be overwritten by the generator script. However, if a human deletes a test case, it will be added back next time the generator runs. So, we should edit the test cases to make them valid, not delete them.

Running the tests in `validation.test.ts` populates `packages/kbn-esql-validation-autocomplete/src/validation/esql_validation_meta_tests.json` which is then used in `test/api_integration/apis/esql/errors.ts` to make sure our validator isn't giving users false positives. Therefore, the validation test suite should always be run after any changes have been made to it so that the JSON file stays in sync.

#### Autocomplete
Expand Down
2 changes: 0 additions & 2 deletions packages/kbn-esql-validation-autocomplete/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
"license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0",
"sideEffects": false,
"scripts": {
"make:tests": "ts-node --transpileOnly ./scripts/generate_function_validation_tests.ts",
"postmake:tests": "yarn run lint:fix",
"make:defs": "ts-node --transpileOnly ./scripts/generate_function_definitions.ts",
"postmake:defs": "yarn run lint:fix",
"lint:fix": "cd ../.. && node ./scripts/eslint --fix ./packages/kbn-esql-validation-autocomplete/src/**/*.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,14 @@ const functionEnrichments: Record<string, RecursivePartial<FunctionDefinition>>
date_diff: {
signatures: [
{
params: [{ literalOptions: dateDiffOptions, literalSuggestions: dateDiffSuggestions }],
params: [{ acceptedValues: dateDiffOptions, literalSuggestions: dateDiffSuggestions }],
},
],
},
date_extract: {
signatures: [
{
params: [{ literalOptions: dateExtractOptions }],
params: [{ acceptedValues: dateExtractOptions }],
},
],
},
Expand Down
Loading

0 comments on commit 8110f9e

Please sign in to comment.