Commit graph

143 commits

Author SHA1 Message Date
Yulia Čech
985948a9f3
[Console] Add inspect tokens action (#189203)
## Summary

This PR enables an action to inspect tokens which is very helpful when
working on grammars/highlighting in Monaco. The command palette is
currently disabled in Monaco that is why I decided to use `F1` key for
inspect tokens in Console.

<img width="646" alt="Screenshot 2024-07-25 at 17 33 37"
src="https://github.com/user-attachments/assets/d2d6064b-851d-46cf-9101-52816835ba78">



### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
2024-07-31 15:09:07 +02:00
Drew Tate
49fb36c69c
[ES|QL] remove meta (#189302)
## Summary

close https://github.com/elastic/kibana/issues/188481

`META` is still in the grammar so you won't get a syntax error, but no
highlighting, validation, or autocomplete support.

<img width="268" alt="Screenshot 2024-07-26 at 9 46 09 AM"
src="https://github.com/user-attachments/assets/563ba2fe-c35d-437e-bc6c-e717cd8b0de8">

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-07-29 11:31:34 -05:00
Nick Partridge
49a985625b
Upgrade prettier dependencies (#188032)
## Summary

- Upgrade `prettier` to `v2.8.x`.
- Upgrade related decencies.
- Adds `prettier` group to renovate config.
- Fixes bootstrapping type error.

## Main Changes

### Add parentheses for `TypeofTypeAnnotation` to improve readability

[link](https://github.com/prettier/prettier/blob/main/CHANGELOG.md#add-parentheses-for-typeoftypeannotation-to-improve-readability-14458-by-fisker)

```ts
// Input
type A = (typeof node.children)[];

// Prettier 2.8.4
type A = typeof node.children[];

// Prettier 2.8.5
type A = (typeof node.children)[];
```

### Add parentheses to head of `ExpressionStatement` instead of the
whole statement


[link](https://github.com/prettier/prettier/blob/main/CHANGELOG.md#add-parentheses-to-head-of-expressionstatement-instead-of-the-whole-statement-14077-by-fisker)

```ts
// Input
({}).toString.call(foo) === "[object Array]"
  ? foo.forEach(iterateArray)
  : iterateObject(foo);

// Prettier 2.8.1
({}.toString.call(foo) === "[object Array]"
  ? foo.forEach(iterateArray)
  : iterateObject(foo));

// Prettier 2.8.2
({}).toString.call(foo.forEach) === "[object Array]"
  ? foo.forEach(iterateArray)
  : iterateObject(foo);
```

## Details

This started because I noticed we were on `typescript@^5` but still on
an old prettier that complained about use of new TS features such as
[`satisfies`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-9.html#the-satisfies-operator).

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-24 17:29:05 +01:00
Elena Stoeva
db5a839e4a
[Console Monaco] Resolve uncaught error from tokenizer (#188746)
Fixes https://github.com/elastic/kibana/issues/186765

## Summary

This PR fixes the uncaught error from the tokenizer when we add the
input below:

<details>
<summary>Test input</summary>

```
GET /
GET _cluster/settings?include_defaults&flat_settings&filter_path=*.*interval*
PUT _cluster/settings
{
  "persistent": {
    "indices.lifecycle.poll_interval": "10s"
  }
}

GET _cat/${TEST}

PUT _data_stream/test-cold
POST test-cold/_rollover

GET _cat/indices?v&h=
GET _cat/indices/.alerts-observability.threshold.alerts-default,.alerts-default.alerts-default,

GET _cat/indices,aliases

GET _cat/shards/test*?v
"""
index                                    shard prirep state      docs store dataset ip         node
.ds-test-cold-2024.05.20-000002          0     p      STARTED       0  249b    249b 172.19.0.2 839a1677bdab
.ds-test-cold-2024.05.20-000002          0     r      UNASSIGNED                               
restored-.ds-test-cold-2024.05.20-000001 0     p      STARTED       0  289b    289b 172.19.0.2 839a1677bdab
"""

GET restored-.ds-test-cold-2024.05.20-000001/_settings

"""
          "snapshot": {
            "snapshot_name": "2024.05.20-.ds-test-cold-2024.05.20-000001-test-h5yr-_tws6es6biug0uqbw",
            "index_uuid": "8tXgFf_cR2KIMofpj2I7Uw",
            "repository_uuid": "3i3oPavIQZGeYOQzRZajyQ",
            "index_name": ".ds-test-cold-2024.05.20-000001",
            "repository_name": "fs",
            "snapshot_uuid": "3S3CDGZgSh2XQSRO3UTxVA"
          }
"""

DELETE _snapshot/fs/2024.05.20-.ds-test-cold-2024.05.20-000001-test-h5yr-_tws6es6biug0uqbw

POST _ilm/stop

POST restored-.ds-test-cold-2024.05.20-000001/_clone/.ds-test-cold-2024.05.20-000001
{
  "settings": {
    "index.store.type": null,
    "index.recovery.type": null
  }
}

# Check the cloned index & shards
GET _cat/indices/.ds-test-cold-2024.05.20-000001?v
GET _cat/shards/.ds-test-cold-2024.05.20-000001?v

PUT _snapshot/fs/2024.05.20-.ds-test-cold-2024.05.20-000001
{
  "indices": ".ds-test-cold-2024.05.20-000001",
  "ignore_unavailable": false,
  "include_global_state": false
}

# Check the taken snapshot

GET _snapshot/fs/2024.05.20-.ds-test-cold-2024.05.20-000001
"""
      "snapshot": "2024.05.20-.ds-test-cold-2024.05.20-000001",
      "uuid": "GC7xoG1yQN6W5LIUMqCDYA",
"""




PUT _snapshot/fs/temp-snapshot-for-recovery
{
  "indices": "restored-.ds-test-cold-2024.05.20-000001",
  "ignore_unavailable": false,
  "include_global_state": false
}
GET _snapshot/fs/temp-snapshot-for-recovery
"""
      "snapshot": "temp-snapshot-for-recovery",
      "uuid": "NgFDtQMESv2o4BZd0dsP8g",
"""

GET .ds-test-cold-2024.05.20-000002
"""
{
  ".ds-test-cold-2024.05.20-000002": {
    "aliases": {},
    "mappings": {
      "_data_stream_timestamp": {
        "enabled": true
      },
      "properties": {
        "@timestamp": {
          "type": "date"
        }
      }
    },
    "settings": {
      "index": {
        "lifecycle": {
          "name": "test"
        },
        "routing": {
          "allocation": {
            "include": {
              "_tier_preference": "data_hot"
            }
          }
        },
        "hidden": "true",
        "number_of_shards": "1",
        "provided_name": ".ds-test-cold-2024.05.20-000002",
        "creation_date": "1716175738940",
        "priority": "100",
        "number_of_replicas": "1",
        "uuid": "nvldBwt2QxeQzpkrbK69qQ",
        "version": {
          "created": "8503000"
        }
      }
    },
    "data_stream": "test-cold"
  }
}
"""


```
</details>

**How to test:** Add the input above in Console editor and verify that
there is no uncaught error in the browser error.

This change also resolves some highlighting inconsistencies, where some
text was incorrectly highlighted as a `method` and `url` tokens:

Before:

<img width="919" alt="Screenshot 2024-07-19 at 17 15 05"
src="https://github.com/user-attachments/assets/3865f5ee-3f8e-4f85-a44d-a7ee73338621">


<img width="919" alt="Screenshot 2024-07-19 at 17 24 33"
src="https://github.com/user-attachments/assets/07326394-8425-40fd-863e-8314e15763fb">

<br><br>

Now:

<img width="919" alt="Screenshot 2024-07-19 at 17 12 07"
src="https://github.com/user-attachments/assets/e2afde99-bc49-4dc5-ad4f-4727ef604534">


<img width="919" alt="Screenshot 2024-07-19 at 17 25 39"
src="https://github.com/user-attachments/assets/e8778eb2-93be-461f-80f0-abdc810874b4">
2024-07-23 13:04:16 -05:00
Elena Stoeva
3c97fbaac5
[Monaco Editor] Add Search functionality (#188337)
Fixes https://github.com//elastic/kibana/issues/186635

## Summary

This PR adds the find action to the Monaco code editor, which enables
the search bar functionality as it is needed for Console with Monaco.
The functionality is disabled by default.

<img width="1496" alt="Screenshot 2024-07-15 at 18 08 14"
src="https://github.com/user-attachments/assets/a7476e4c-8ab8-4523-a815-1f7db483ddfa">

**How to test:**
1. Open Console and verify that Command/Ctrl + f opens the search bar
(should work for both the editor and the output panel).
2. Open any other code editor in Kibana and verify that the search
functionality is disabled.


<!--
### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
-->
2024-07-23 16:42:41 +01:00
Drew Tate
2438c36fd9
[ES|QL] improve SORT command suggestions (#188579)
## Summary

- Suggests options in uppercase
- Applies syntax highlighting

**Before**


https://github.com/user-attachments/assets/5f04d8fc-d61a-4779-906b-a7f4f42b4014

**After**


https://github.com/user-attachments/assets/cd585306-020a-4a55-867a-affe373666f6

---------

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
2024-07-22 09:06:27 -05:00
Stratoula Kalafateli
fcf2702c0e
[ES|QL] Enabling the timepicker for indices without the @timestamp field (#184361)
## Summary

Based on https://github.com/elastic/elasticsearch/pull/108421

Closes https://github.com/elastic/kibana/issues/180805

It allows the users to add an `?earliest` and `?latest` variable in the
ES|QL editor.

When we are detecting this variable, we are also sending the values to
ES.

- Earliest is the from value of the date picker
- Latest is the to value of the date picker


![meow](177ceafe-558d-43ea-809c-f0ec2833ec17)

Usage in bucket


![meow](8dea8188-b4e0-43e6-894e-236811374030)

This enables 2 very important features:

- I can use the values of the time picker in the bucket function
- I can use the time picker for indices without `@timestamp` field

### For reviewers
- Although it seems as a big PR, the majority of the changes happen due
to the signature change of the `getESQLAdHocDataview`
- The ML changes are mostly because the ML code has a lot of repetition.
I think the code needs to be refactored to have a central point
(preferably the `getESQLResults` from the esql-utils. I will create an
issue for the ML team.
- I am not proposing this in bucket autocomplete because it doesnt work
great in general for the date histogram case. We are working on
autocomplete improvements so I am expecting this to be part of a follow
up PR.
- I want to talk to the docs team to add it in the docs.


### Follow ups
- Change the histogram to use the bucket instead of the date_trunc
(needs investigation first)
- Speak with the docs team about adding an example on our official docs


### Flaky test runner 
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/6521

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Julia Rechkunova <julia.rechkunova@gmail.com>
2024-07-17 16:23:16 -07:00
Quynh Nguyen (Quinn)
27dc08bcc4
[ES|QL] Automatically encapsulate index names with special chars with quotes (#187899)
## Summary

Addresses https://github.com/elastic/kibana/issues/186411. This PR
introduces quoted index names when auto populated/suggested if the index
name contains special characters.


94a37a82-9921-4419-b7d4-c8c50cc509f3

If user is already prefixing index name with a quote, e.g. `from "a` it
will suggest as normal.


### Checklis

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
2024-07-11 08:56:56 +02:00
Ryan Keairns
06f773934a
[ES|QL] Set custom highlight colors for suggest widget (#186476)
## Summary

Set custom theme colors for highlights in the suggest widget.

*Dark mode*
![CleanShot 2024-06-19 at 08 10
32@2x](ced95d75-a5c5-4780-a9f8-188e2432ee31)

*Light mode*
![CleanShot 2024-06-19 at 08 09
40@2x](7d3c6292-a9f3-4bb4-a4f9-df6fa8274c39)


### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)
2024-06-19 09:46:20 -07:00
Yulia Čech
5e346b2561
[Console] Enable monaco by default (#184862)
## Summary

Closes https://github.com/elastic/kibana/issues/184025

This PR enables the migration from Ace to Monaco in Dev Tools Console by
default in the main branch. All serverless projects will still have the
migration disabled by default. After 8.15 is branched, the migration
will be disabled there as well. The intended release version for this
migration is 8.16.

### Functional tests 
This PR creates a copy of functional tests for Monaco Console and keeps
the tests for Ace in a separate folder. When the migration is released,
we can remove the code for Ace together with tests.
The Monaco tests are not the exact copy of the Ace tests, since some
functionality and autocomplete behaviour is slightly different in the
migrated Console. For example, the auto-closing of brackets works in
Monaco when typing something, but is not kicking in in the tests.

Flaky test runner 

### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-06-19 17:37:04 +02:00
Ryan Keairns
1c7b5952b3
[ES|QL] Theme updates for text based languages editor (#186345)
## Summary

This is a design pass at the editor. Functionality and layout have not
been changed.

### What has changed?
- Color settings in the `esql_theme.ts`
- Added additional rule groups for color treatment (e.g. more operators
and values)
- Replaced hardcoded style values with EUI variables
- As a result, one set of theme colors now works across light and dark
mode
- Made a few small Monaco configuration (i.e. options) changes that
affect the UI/visual output (e.g. active line styles, line height,
font... the font size is the same, but I believe these other changes
will make it feel larger/more readable)
- Re-ordered the options set to more easily find what is/is not enabled
- Shortened the height of the top bar; tightened up the padding; more
closely matches the footer design

### How does it look?
*Light mode*
![CleanShot 2024-06-17 at 16 13
46@2x](5e78c2ac-5be8-4138-b1bf-616373c98bf1)

*Dark mode*
![CleanShot 2024-06-17 at 16 15
49@2x](f739742e-92d8-46d0-a4d2-26f8f2669044)

*Compact*
![CleanShot 2024-06-17 at 16 15
26@2x](a0f2b129-5973-4742-b428-16ef4f8b1eca)

### What about the other things we saw in the Slack screenshots...
I have some other ideas cookin', but I would like to iterate on those
concepts in Figma and get additional feedback. These entail the
edge-to-edge design, less borders, consolidated header and footer,
smaller CTA buttons, full-height field list, etc. Something like this...

<details>

<summary>Additional design considerations not in this PR</summary>

![CleanShot 2024-06-14 at 22 38
34@2x](dd5e0f12-1c9a-4ade-ad80-22376f841a41)

</details>

### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
2024-06-18 18:27:39 -07:00
Ahmad Bamieh
f1c854b9db
[i18n][system upgrade] Upgrade Intl Packages from v2 to v6 (#179506)
## Summary

Upgrading intl packages from v2 to v6

### Packages upgrade:

- [x] Add @formatJS packages
- [x] `react-intl` Upgraded
- [x] `intl-messageformat` Upgraded
- [x] `intl-format-cache` removed
- [x] `intl-relativeformat` removed
- [x] `intl-messageformat-parser` removed

### Todo list:
- [x] Refactor HTML tags
- [x] Refactor Upgrade tags
- [x] Refactor `kbn-i18n`
- [x] Refactor `kbn-i18n-react`
- [x] Refactor `FormattedRelative` to `FormattedRelativeTime`
- [x] Refactor polyfills
- [x] Refactor IntlShape types
- [x] Rewrite Providers
- [x] Rewrite tests using i18n
- [x] Removed current pseudolocale implementation (tracker:
https://github.com/elastic/kibana/issues/180244)
- [x] Fix jest tests using rendered `Provider`
- [x] Remove no longer valid i18n packages documentation (tracker:
https://github.com/elastic/kibana/issues/180259)

Closes https://github.com/elastic/kibana/issues/178968
Closes https://github.com/elastic/kibana/issues/38642


## Notes to code reviewers
For team other than the core team, please review your plugins code
changes by filtering files by codeowners.


### Test Snapshot updates
Most of the changes are refactors of renamed functions and changed ICU
syntax.

The main updates are snapshot changes where `FormattedMessage` is now
memoized so snapshots capturing the html tree needed to be updated to
use `<Memo(MemoizedFormattedMessage)` instead of `<FormattedMessage`


### ICU now supports HTML tags:
before:
```
<FormattedMessage
  defaultMessage="To buy a shoe, { link } and { cta }"
  values={{
    link: (
      <a class="external_link" target="_blank" href="https://www.shoe.com/">
        visit our website
      </a>
    ),
    cta: <strong class="important">eat a shoe</strong>,
  }}
/>
```
after:
```
<FormattedMessage
  defaultMessage="To buy a shoe, <a>visit our website</a> and <cta>eat a shoe</cta>"
  values={{
    a: msg => (
      <a class="external_link" target="_blank" href="https://www.shoe.com/">
        {msg}
      </a>
    ),
    cta: msg => <strong class="important">{msg}</strong>,
  }}
/>
```

### Escape character to prevent ICU parsing changed from double slashes
to single quotes:
before: `\\{escaped\\}`
after: `'{escaped}'`

### No need for Intl Shape
the new packages under formatJS are written in typescript and come with
types support out of the box so no need to set types when using i18n.

Renamed `InjectedIntlProps` with `WrappedComponentProps`.
Removed `prop-types` and `intlShape` in favor of `IntlShape`.

### FormattedRelative has been renamed to FormattedRelativeTime and its
API has changed significantly. See
[FormattedRelativeTime](https://formatjs.io/docs/react-intl/upgrade-guide-3x#formattedrelativetime)
for more details.

### All tags specified must have corresponding values and will throw
error if it's missing
All tags are now parsed and expected to be formatted properly (all
opened tags must be closed).

To skip this check you can use the `ignoreTag: true` property

```
i18n.translate('xpack.apm.agentConfig.captureJmxMetrics.description', {
      defaultMessage: 'This is not an HTML tag <JMX object name pattern>' +
      ignoreTag: true,
    }),
```

**When do I use ignore tags?**

If your message has HTML tags, it is preferred not to ignore the Tag to
have some string verification that the html tags you are adding are
properly formatted and closed.

If it the text between brackets is not an HTML tag and it is just a
fomat preference then using `ignoreTag` makes sense.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
2024-06-02 16:50:33 +03:00
Vadim Kibana
b5ef72b377
[ES|QL] Add syntax highlighting for METRICS command (#184515)
## Summary

Partially addresses https://github.com/elastic/kibana/issues/184498

- Add syntax coloring in Manaco editor for the `METRICS` source command.
2024-05-31 08:58:19 +02:00
Elena Stoeva
c1d992d281
[Console Migration] Add styling for status codes in multiple response output (#183858)
Closes https://github.com/elastic/kibana/issues/179522

## Summary

This PR adds styling for the status codes in the multiple-response
output in Console Monaco.



1934cda7-d6c1-41a0-9147-3f71885929c6


<img width="1574" alt="Screenshot 2024-05-21 at 16 38 55"
src="59b28258-5b41-4e66-8d1b-97b7d146d6e5">



In Ace editor:

<img width="1918" alt="Screenshot 2024-05-16 at 18 01 42"
src="da9d85e0-0791-4631-84e7-139749ce4956">

Note: In the Ace editor, we use the [`badge.badge` css classes for token
names](0f1139f302/src/plugins/console/public/application/models/legacy_core_editor/mode/output_highlight_rules.ts (L15)),
but unfortunately Monaco theme rules don't support class names. I tried
setting the [background color
property](https://microsoft.github.io/monaco-editor/typedoc/interfaces/editor.ITokenThemeRule.html#background)
in the rules for the status code tokens but this doesn't work because of
a bug from Monaco's side, see
https://github.com/microsoft/monaco-editor/issues/3868 and
https://github.com/microsoft/monaco-editor/issues/586). Therefore, in
this PR we only set the text colors.






<!--
### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
-->

---------

Co-authored-by: Yulia Čech <6585477+yuliacech@users.noreply.github.com>
2024-05-28 11:09:40 +02:00
Stratoula Kalafateli
c7ae3c6f71
ES|QL static metadata (#183890)
## Summary

Cleanups the implementation of the metadata logic. There is no reason at
this point (and maybe not even in the future) to have this metadata list
be dynamic. This PR is removing this logic and cleans it up
2024-05-23 23:10:07 +02:00
Yulia Čech
9fb859ea67
[Console Monaco Migration] Implement autocomplete support (#181347)
## Summary
Partially addresses https://github.com/elastic/kibana/issues/180208 

This PR adds autocomplete support for method, url and url parameters in
the Monaco editor. The url suggestions include the indices name.

#### Screen recording 


b31f87b2-df11-48ad-88a7-cc3f9fbb5ffc






### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
2024-05-03 03:46:21 -07:00
Elena Stoeva
b8d8c737e6
[Console Monaco Migration] Fix issue with different themes (#180321)
Fixes https://github.com/elastic/kibana/issues/180218

## Summary

This PR fixes the highlighting issue in the Monaco editor that is caused
when using a theme in the output panel that is different from the theme
in the editor. This fix is implemented by unifying the themes for both
editors into one.

The PR also fixes the issue with Console theme overwriting theme in
other code editors (e.g. embeddable Console in the index detail tabs) by
reusing the `euiTheme`.

Note: This solution changes some of the original highlighting colors in
Console (e.g. comments were green and now they are grey, background
color is also different now). We might be able to fix the text colors by
specifying unique token names in the Console language (e.g. using
`consoleComment` instead of `comment` token name). cc: @yuliacech


d77d4ea3-61b5-43fa-81ef-7e4ac239aadd



1dab2eca-08e5-421b-acd4-38e0b3d91a3e


<img width="1494" alt="Screenshot 2024-04-22 at 15 34 45"
src="a4241574-77ad-42db-8707-ae38761d52d0">




<!--
### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
-->

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-04-30 15:20:28 +01:00
Stratoula Kalafateli
e2aa9fdbac
[ES|QL] Retrieve the indices from AST parsing (#181271)
## Summary

Closes https://github.com/elastic/kibana/issues/180959

Retrieves the indices from ast parsing. This ensures that the index
patterns we get from the `from` command is always the correct one. I
have replaced it everywhere expect from specific places where I still
use the deprecated function. I am not sure how to test the app and I
don't want to cause regressions so I prefer the responsible teams to do
the migration.


Before

Could not retrieve the index correctly
<img width="1677" alt="image"
src="77cdac00-ffff-4b91-88ba-0fc523c5f54d">

After
Correct retrieval of the index and the @timestamp info

<img width="1067" alt="image"
src="bc14718a-30f5-4f3c-8a56-cf57f69cff14">

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: dej611 <dej611@gmail.com>
2024-04-26 07:52:00 +02:00
Elena Stoeva
ec5b6fd214
[Code Editor] Move theme to kbn-monaco package (#181417)
## Summary

This PR moves the Monaco themes used in the Code Editor component to the
`kbn-monaco` package to prevent the circular dependency between the
`kbn-monaco` and `code_editor` packages that occurs in
https://github.com/elastic/kibana/pull/180321 (where the code editor
theme is reused from inside the `kbn-monaco` package).

<!--
### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
-->

---------

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
2024-04-25 13:41:22 +01:00
Yulia Čech
0b4e60e7d4
[Console] Monaco migration: send request and copy as curl buttons (#179808)
## Summary

Closes https://github.com/elastic/kibana/issues/178990

This PR adds the actions buttons to the monaco editor and the
functionality for the buttons to send a request and copy the request as
a curl command. When the cursor or user selection doesn't overlap or
contain any requests on the selected line, the actions buttons are
hidden. When the cursor or selection changes, the buttons are displayed
on the 1st line of the 1st selected request. Several requests can be
sent at once. Only the 1st request is copied as a curl command.

There are also some minor UI and copy changes (see screenshots below) as
suggested by @MichaelMarcialis in the review.

### Screenshot 

#### Before

<img width="882" alt="Screenshot 2024-04-15 at 15 16 59"
src="8fa95a5b-51c6-4220-8837-38adc4696602">
<img width="296" alt="Screenshot 2024-04-15 at 15 17 07"
src="6c99a4db-f7a6-4872-a24a-cddb56e0ec3d">

#### After
<img width="916" alt="Screenshot 2024-04-15 at 15 18 08"
src="1ae0b161-c731-42e1-90af-69468e9f0905">
<img width="367" alt="Screenshot 2024-04-15 at 15 18 14"
src="bb8818bd-38d4-4ec3-8bf4-30e24afd3664">


### How to test
- Check that the actions buttons are not displayed when there are no
requests in the input
- Check that the actions buttons are not displayed when no requests are
selected by the cursor or the selection
- Check that the selected requests are highlighted
- Check that the buttons are displayed on the 1st line of the 1st
selected request
- Check that the position of the buttons is updated when the editor is
scrolled up or down

### Follow up issues 
- The functionality for the button to open a documentation for the 1st
selected request
- The functionality for the button to auto-indent input
- The input highlighting is temporarily reset when sending a request
- Sent requests need to be saved to history
- After sending a request, the autocomplete polling needs to be
restarted
- Add more unit tests
2024-04-16 06:16:30 -07:00
Stratoula Kalafateli
0bad865382
[ES|QL] Slightly change the editor colors (#180180)
## Summary

The colors are not exported from eui so they are hardcoded now. I asked
from the team to expose them. I will create a follow up PR as soon as
they are exported

**Light mode**
<img width="1675" alt="image"
src="60dfd901-fa42-4ea5-b788-52836de0d837">

**Dark mode**
<img width="1679" alt="image"
src="8ea12e9c-4588-4894-8025-50bd6e7b6a48">

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-04-08 18:12:33 +02:00
Marco Liberati
c2adb13ee9
[ES|QL] Make getActions more resilient to lack of callbacks (#180260)
## Summary

Now `getActions` provides some more fixes in case of lack of callabacks,
like with unquoted fields.
The feature is still experimental and applies only to unquoted fields
(disabling the existence check on quoted fields).

### Checklist

- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
2024-04-08 16:07:54 +02:00
Elena Stoeva
4a5acf360d
[Console] Migrate output editor to Monaco (#178696)
Closes https://github.com/elastic/kibana/issues/178941

## Summary

This PR migrates the output editor from Ace editor to Monaco editor.

<img width="1491" alt="Screenshot 2024-04-03 at 11 22 27"
src="fbff226d-8f6b-470a-b6c8-34f4aaf64200">




**How to test:**
1. Create a `config/kibana.dev.yml` file (if one doesn't exist already)
and add the line: `console.dev.enableMonaco: true`
2. Change the condition in
b8c13babf1/src/plugins/console/public/application/containers/editor/editor.tsx (L76)
to `!isMonacoEnabled` to display the old Ace editor in the request panel
for now so that we can test sending a request.
3. Send a request and verify the output panel displays the response
correctly in json format and that the highlighting is the same as in the
original output panel. Also test sending multiple requests at once.

<details>
<summary>JSON output screenshots:</summary>

Ace editor:
<img width="561" alt="Screenshot 2024-03-22 at 16 12 48"
src="898a3e48-5a3b-48b6-ac4e-92fa6e05403a">

Now: 
<img width="722" alt="Screenshot 2024-04-03 at 11 12 59"
src="503614db-946b-490e-9447-fd3cdcb83bcf">

When multiple requests are sent:
<img width="1491" alt="Screenshot 2024-04-03 at 11 10 53"
src="63b05227-a723-49ec-a9ac-3ae3269effd1">

</details>

4. Send a request with `?format=yaml` parameter (e.g. `GET
_all?format=yaml`) and verify that the output panel displays the
response correctly in yaml format.

<details>
<summary>YAML output screenshot:</summary>
<img width="1459" alt="Screenshot 2024-03-27 at 11 29 45"
src="c1967f0f-021e-4b68-bb8f-3098ef35ff1f">

</details>

5. The output also supports text output data. To test this format,
delete line 29 and add the following code in line 34 in
`src/plugins/console/public/application/containers/editor/monaco/monaco_editor_output.tsx`:

```
const data = [
      {
        response: { value: 'Hello World!' },
      },
    ];
```

Then reload the Console page and verify the data is correctly displayed
and highlighted.

<details>
<summary>TEXT output screenshot:</summary>
<img width="285" alt="Screenshot 2024-03-22 at 18 06 31"
src="f30cdfd6-be67-4d34-b54d-2a19d6dcb09d">

</details>

<!---
### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
-->

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-04-04 12:38:22 +01:00
Marco Liberati
fb19e57a4e
[ES|QL] New @kbn/esql-services package (#179029)
## Summary

Closes https://github.com/elastic/kibana/issues/172649

This PR extracts the ES|QL service like "validation", "autocomplete",
"code_action" (quick fixes) and some other services into a separate
package `@kbn/esql-validation-autocomplete` which has no tie with Monaco
editor anymore.

All the AST and grammar logic has been encapsulated into a single
`@kbn/esql-ast` package who contains the `getAst` function together with
the `parser` and `lexer`.

## Validation enhancements

The validation API has been enhanced to gracefully degrade whenever
callbacks are not provided, via the `ignoreOnMissingCallback` option.
Tests are included as well for this scenario.

### Example plugin

An example plugin app has been developed to show to to use the
validation API

<img width="500" alt="Screenshot 2024-03-22 at 17 45 38"
src="ebc172d3-ee61-4f3a-9e42-dcb9b15c7e69">

The app starts with a missing callback:

<img width="855" alt="Screenshot 2024-03-22 at 17 36 22"
src="c9b81370-8a10-487d-b22f-2359e1365a54">

Toggling the ignore option will hide the index error due to the lack of
`getSources` callback:

<img width="816" alt="Screenshot 2024-03-22 at 17 28 17"
src="931f4e5f-3ad6-46f7-97ca-63d7bb66646b">

Warnings are shown as well when detected:

<img width="807" alt="Screenshot 2024-03-22 at 17 35 56"
src="5e3e0537-cba2-475f-946b-0302867384ca">

#### Code snippet

The example app produces a copyable code snippet of the current
configuration of the validator:

![Code
snippet](https://private-user-images.githubusercontent.com/924948/316838987-fd16da58-8790-40b2-851d-b92aca1811dc.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTE0NTY0MzUsIm5iZiI6MTcxMTQ1NjEzNSwicGF0aCI6Ii85MjQ5NDgvMzE2ODM4OTg3LWZkMTZkYTU4LTg3OTAtNDBiMi04NTFkLWI5MmFjYTE4MTFkYy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwMzI2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDMyNlQxMjI4NTVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00ZDhhOGRlMjZjMzZhN2NjNTdkYWMxYTNjOWVkNTA3NDk5NGViOTg2NWEzMTAyZGM4MGYyOTQ0YjQ2N2Q3ZDI1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.H-3r_B57NK1-rS8UbR_bxlNtAMQ0flFGtW0oTIiOlr0)

### Checklist

- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-03-27 14:39:48 +01:00
Yulia Čech
c59016ed9a
[Console] Add theme and more lexer rules (#178757)
## Summary

This PR adds a theme for the Console language in Monaco editor and adds
more lexer rules to bring the highlighting of the input closed to the
original in Ace editor.

### Screenshots
Monaco editor 
<img width="682" alt="Screenshot 2024-03-19 at 12 38 07"
src="98a1acc7-3a8a-4ad9-a79e-5236091c4c39">

Ace editor
<img width="651" alt="Screenshot 2024-03-19 at 12 37 52"
src="37935a68-923b-493c-ac56-ef4982f27fdf">

### How to test
1. Add `console.dev.enableMonaco: true` to `kibana.dev.yml``
2. Type different requests into Console and check that the highlighting
works the same as in Ace. For example, use the following requests

```
GET ${pathVariable}/_search
{
 "query": {
   "match": {
     "${bodyNameVariable}": "${bodyValueVariable}",
     "number_property": 1234,
     "array_property": ["test1", 1234, false], 
     "boolean_property": true,
     "text_property": "text_value",
     "triple_quote": """
     inside triple quote
     """
     // line comment
     /* 
      block comment
    */
   }
 }
}

// line comment
/* 
block comment
*/

GET _sql
{
  "query": """
  SELECT "field" FROM "index-*" WHERE "column" = "value"
  """
}
```
3. To check that `xjson` highlighting still works
 a. Navigate to Ingest pipelines and click the "create from csv" button
b. Load a valid csv file, for example this
[one](https://github.com/kgeller/ecs-mapper/blob/master/example/mapping.csv)

#### Known issues that will be addressed in follow up PRs
- SQL highlighting needs to be re-implemented (added to the follow up
list in https://github.com/elastic/kibana/issues/176926)
- Strings inside triple quotes are not using italics (added to the
follow up list in https://github.com/elastic/kibana/issues/176926)
- Font size needs to be set via settings and the default value provided
(fixed via https://github.com/elastic/kibana/pull/178982)
- Font family: do we want to use the same font as for other Monaco
languages are use the one for Ace? (added to the follow up list in
https://github.com/elastic/kibana/issues/176926)
- In the future, we might want to use the same theme for `xjson` and
Console (added to the follow up list in
https://github.com/elastic/kibana/issues/176926)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-03-27 03:06:40 -07:00
Kibana Machine
61ed6e77b1
[ES|QL] Update grammars (#179266)
This PR updates the ES|QL grammars (lexer and parser) to match the
latest version in Elasticsearch.

## Edit by @dej611 

* Introduced new `META` command (with the only `FUNCTIONS` option) who
replaced the previous `SHOW FUNCTIONS`
  * add new `meta` command into the commands definitions
  * make it work with both validation and autocomplete
  * updated ES|QL theme with new `meta` command
* Removed the `FUNCTIONS` function from the `SHOW` command
  * tweaked the `show` command definition
  * fix both validation and autocomplete
* removed some unused code after the grammar changes

---------

Co-authored-by: dej611 <dej611@gmail.com>
Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
2024-03-26 15:52:07 +01:00
Drew Tate
1eae619bea
[ES|QL] grammar sync job (#178347)
## Summary

Introduces a CI job to check for changes to the Elasticsearch grammar.

Part of https://github.com/elastic/kibana/issues/178262

The first time this job runs, it will result in a PR to update the
grammar because of formatting differences. That should be merged. Then,
it will only create a PR when something has changed on the Elasticsearch
side.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-03-21 17:01:48 -05:00
Drew Tate
28277c25df
[ES|QL] case only requires two parameters (#179011)
## Summary

Part of https://github.com/elastic/kibana/issues/177699

We had `case` marked as if it required three parameters when in reality
it only requires two.

<img width="600" alt="Screenshot 2024-03-19 at 4 23 29 PM"
src="45f7578a-e6ad-4ba9-b71a-05bb1978a384">

Note: we could consider testing these n-1 cases to prevent this kind of
bug in the future.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Marta Bondyra <4283304+mbondyra@users.noreply.github.com>
2024-03-21 09:34:38 -05:00
Marco Liberati
ad272c2acf
[ES|QL] Fix wilcard complex scenarios (#178938)
## Summary

Improves the wildcard validation logic to handle multiple occurrencies
of wildcards.


### Checklist

Delete any items that are not applicable to this PR.


- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
2024-03-21 10:19:57 +01:00
Drew Tate
05dfb28dcc
[ES|QL] use lexer from elasticsearch (#178257)
## Summary

Up till now, we had to define our own lexer rules for our client-side
ES|QL validation. This was because we were using an unofficial ANTLR
package (before the official ANTLR had typescript support).

Now that we are using the official ANTLR library (as of
https://github.com/elastic/kibana/pull/177211), we no longer have to
encode case insensitivity into the lexer rules themselves because the
[`caseInsensitive` option](https://github.com/antlr/antlr4/pull/3399) is
now available to us.

This means we can adopt the very [same
definitions](343b1ae1ba/x-pack/plugin/esql/src/main/antlr/EsqlBaseLexer.g4)
that Elasticsearch uses as long as we set `caseInsensitive`
(Elasticsearch handles case insensitivity at runtime).

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
2024-03-08 08:47:29 -06:00
Drew Tate
0e7adf5dae
[ES|QL] fix validation test (#178245)
## Summary

Due to a merge race condition, some incorrect properties were left in
this test.

cc @delanni
2024-03-07 17:33:29 +01:00
Drew Tate
bf2ebe9da4
[ES|QL] simplify signature definition (removes infiniteParams) (#177628)
## Summary

Close https://github.com/elastic/kibana/issues/177117


### Checklist

Delete any items that are not applicable to this PR.


- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-03-07 09:30:52 -06:00
Marco Liberati
cad276fcbd
[ES|QL] Fix some validation misconfiguration (#177783)
## Summary

Related issue #177699

Fix variables logic for expressions at `stats by ...` level.
Fix validation logic for agg functions within `eval` or `where` scope.
Fix validation and autocomplete logic for nested quoted expressions
  * i.e. 
  ```
from index | eval round(numberField) + 1 | eval `round(numberField) + 1`
+ 1 | eval ```round(numberField) + 1`` + 1` + 1 | eval
```````round(numberField) + 1```` + 1`` + 1` + 1 | eval
```````````````round(numberField) + 1```````` + 1```` + 1`` + 1` + 1 |
keep ```````````````````````````````round(numberField) +
1```````````````` + 1```````` + 1```` + 1`` + 1`
  ```
* updated `count_distinct` agg definition to have the `precision` second
optional param.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
2024-03-07 13:57:27 +01:00
Eyo O. Eyo
cbcbb938fc
Migrate to official antlr4 package (#177211)
## Summary

This PR migrates kibana away from using the antlr4ts to the official
antlr package, so the grammar used in Kibana (for example with ES|QL) is
on par with ES.

<!-- 
### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

-->

---------

Co-authored-by: dej611 <dej611@gmail.com>
2024-03-05 15:27:39 +01:00
Yulia Čech
1d4057fdf5
[Console] Add Console parser to kbn/monaco (#177194)
## Summary

Related meta [issue](https://github.com/elastic/kibana/issues/176926) 

This PR adds the parser used by Ace in Console to the Console language
definition in `kbn/monaco`.
Changes introduced by this PR: 
- Copy the code for `'sense_editor/mode/worker_parser'` from the file
`src/plugins/console/public/application/models/legacy_core_editor/mode/worker/worker.js`
into the `kbn/monaco` package
- Move the code for the webworker from the `xjson` folder in
`kbn/monaco` to a shared folder `ace_migration`
- Register the parser worker for the Console language in `kbn/monaco`

### How to test
#### Test the parser in Console
1. Add `console.dev.enableMonaco: true` to kibana.dev.yml
2. Open Dev Tools Console and try to type a valid request, check that
there are no red markers in the editor
3. Type an invalid request and check that there are red markers in the
editor

#### Test that `xjson` language parser still works
1. Navigate to Ingest pipelines and click the "create from csv" button
2. Load a valid csv file, for example this
[one](https://github.com/kgeller/ecs-mapper/blob/master/example/mapping.csv)
3. In the editor that now display a valid json, try changing the value
and check that red markers appear for invalid json

### Screenshots
#### Invalid request (red markers in the editor)
<img width="786" alt="Screenshot 2024-02-19 at 18 06 13"
src="bac1bdfd-c402-45f1-9b9b-a9cc29ccb123">


#### Valid request
<img width="795" alt="Screenshot 2024-02-19 at 18 06 23"
src="c06b1163-1077-43c6-bddc-1d86d0116266">


### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
2024-02-22 10:40:13 +01:00
Marco Liberati
2b86cceff7
[ES|QL] Improve arguments error copy (#177418)
## Summary

Improve error copy based on @leemthompo suggestions.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
2024-02-21 07:56:21 -07:00
Marco Liberati
eb708f5f4e
[ES|QL] Improve handling of functions for variadic signatures with minParams (#177165)
## Summary

Fix an issue with functions with the `minParams` configuration
(`concat`, `case`, `cidr_match`).

Validation fix:
* now validation engine understands the minimum number of args and
provide a better message based on the function signature
* if the function has a single exact signature, then make it explicit
the `exact` nature
<img width="442" alt="Screenshot 2024-02-19 at 11 46 59"
src="14aa9cb4-bce2-404b-936e-cb92ec966c2d">

<img width="227" alt="Screenshot 2024-02-19 at 11 45 18"
src="94b2a051-5cd2-4f60-b65a-c3ac77c17b85">

* if the function has some optional args in the signature, then make it
explicit that there are too few or too many args
  
<img width="441" alt="Screenshot 2024-02-19 at 11 48 00"
src="55acf5f7-ce6b-452d-ba49-cd38ac05120e">

<img width="443" alt="Screenshot 2024-02-19 at 11 45 03"
src="653f62d3-7ee5-44d2-91e9-aae812f08394">

* if the function has a minParams configuration, then it should make it
explicit that there are too few args:
<img width="467" alt="Screenshot 2024-02-19 at 11 41 46"
src="8a4030e0-317d-4371-abd0-11b333ad26d9">

<img width="441" alt="Screenshot 2024-02-19 at 11 41 16"
src="d8f8048e-edda-44c2-b84e-b908cd7b29a5">

<img width="446" alt="Screenshot 2024-02-19 at 11 41 04"
src="c6ac58ef-a1b7-48a6-b2ad-a8994ae2b885">

* autocomplete now understand the `minParams` and suggest the right
value in the right place

![esql_min_params_autocomplete](fd21a819-8310-4f94-88e6-3a2967c7a8bd)

* signature hover tooltip now provides a better signature for functions
with minParams (arg should not be optional, rather mandatory until the
#minParams, optional after)


![esql_min_params_signature](421f22f3-8d00-4acb-a65c-495a05b8d400)

### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
2024-02-21 09:07:44 +01:00
Marco Liberati
c1616fe394
[ES|QL] Disable support for case insensitive quality operator (#177171)
## Summary

Sync with https://github.com/elastic/elasticsearch/pull/105611

Removes the builtin operator from validation and autocomplete.

<img width="595" alt="Screenshot 2024-02-19 at 12 04 37"
src="72f0ed8c-5bc3-400d-953b-07a833a7f413">
<img width="540" alt="Screenshot 2024-02-19 at 12 04 25"
src="5be38d83-8838-4dbe-8841-1d2d7222dc33">

Tests are currently skipped as the intention to restore it back later
on.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
2024-02-19 18:05:28 +01:00
Yulia Čech
4d7f5930f4
[Console] Add a dev config for the editor migration (#176520)
## Summary

This PR adds a dev config to Console to enable a migration to the Monaco
editor. The config value is `false` by default and can be changed by
adding `console.dev.enableMonaco: true` to `kibana.dev.yml`. Also a new
custom Monaco language is registered for Console in the package
`kbn/monaco` and will be worked on behind the config flag iteratively in
the next weeks.
To not let the dev config get into 8.13 release, this PR will only be
merged **after** 8.13 has been branched.
After this PR is merged, the team will start re-implementing existing
Console features in the new Monaco editor, see
https://github.com/elastic/kibana/issues/176723 and
https://github.com/elastic/kibana/issues/176926

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-02-19 04:57:17 -07:00
Marco Liberati
392bb4024e
[ES|QL] Integration tests (#177017)
## Summary

The validation test suite now dumps all test cases into a JSON with a
flag that tell if the query should fail or not.

On top of that an integration test has been written, who collects the
JSON and execute it again against the ES ES|QL `_query` endpoint, then
compare the two result.

* if both results are the same (both pass or errors) then it's good to
go 
* if client side fails and ES pass, then it's a failure  
* if client side passes and ES fails, then it's bad but still ok ⚠️ 
* in this case the error is logged and stored into a JSON (not
committed)

All tests are ran 8 times ( stringField => `["text", "keyword"]`,
numberField => `["integer", "double", "long", "unsigned_long]` for a
totale of ~16k assertions (2000 x 8 tests).
Assertions have to be within a single test to avoid memory issues on the
CI otherwise.

~~Fixes the signature utility for functions with a minimum number of
args.~~



### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
2024-02-19 12:07:55 +01:00
Marco Liberati
30458e30b4
[ES|QL] More ES sync and bug fixes (#176687)
## Summary

This PR contains several fixes and sync features from the ES
counterpart, here's a short list:

* Sync with grammar changes
https://github.com/elastic/elasticsearch/pull/105325
  * Added the same tests as its ES counter part.
* Sync with more grammar changes
https://github.com/elastic/elasticsearch/pull/105476
* Added the same tests as its ES bug counter part (and added more for
impacted commands)
* Revisited a couple of suggestions label texts
* Revisited some error messages in validation
* Autocomplete test suite is now testing also the final list
  * some tests have changed to reflect the final ranking
  * within a `stats` context it suggests functions as well
* suggestions take into account previous function used now and promote
agg functions if not used yet
  * suggestion ranking is now dynamic
* pipe and comma suggestion order has been inverted (comma first, then
pipe)
  * agg functions have higher ranking than everything else
* Definition updates
  * `concat` now requires at least 2 args
  * `auto_bucket` requires constant values as 3rd and 4th arg
  * `percentile` requires a constant value as 2nd arg (optional)
  * `mv_max` and `mv_min` now accept any arg type
  * `st_centroid` fixed returned type
* The validation logic has been extended to handle also the constant
validation scenario.
  * also, renamed indexes in the tests suite to be compliant with ES
  * fixed a bug here with column validation in `row` column


### Checklist

Delete any items that are not applicable to this PR.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
2024-02-14 16:47:32 +01:00
Marco Liberati
7bbea56c16
[ES|QL] New sync with ES changes (#176283)
## Summary

Sync with https://github.com/elastic/elasticsearch/pull/104958 for
support of builtin fn in STATS
  * validation  
  * autocomplete  
  * also fixed `STATS BY <field>` syntax


![new_stats](735f9842-b1d3-4aa0-9d51-4b2f9b136ed3)


Sync with https://github.com/elastic/elasticsearch/pull/104913 for new
`log` function
  * validation   - also warning for negative values
  * autocomplete  

![add_log](146b945d-a23b-45ec-9df2-2d2b291e883b)

Sync with https://github.com/elastic/elasticsearch/pull/105064 for
removal of `PROJECT` command
  * validation   (both new and legacy syntax supported)
  * autocomplete   (will only suggest new syntax)


![remove_project](b6f40afe-a26d-4917-b7a1-d8ae97c5368b)

Sync with https://github.com/elastic/elasticsearch/pull/105221 for
removal of mandatory brackets for `METADATA` command option
* validation  (added warning deprecation message when using brackets)
  * autocomplete  

![fix_metadata](c65db176-dd94-45f3-9524-45453e62f51a)


Sync with https://github.com/elastic/elasticsearch/pull/105224 for
change of syntax for ENRICH ccq mode
  * validation  
* autocomplete  (not directly promoted, the user has to type `_` to
trigger it)
  * hover  
  * code actions  

![fix_ccq_enrich](0900edd9-a0a7-4ac8-bc12-e39a72359984)

![fix_ccq_enrich_2](74b0908f-d385-4723-b3d4-c09108f47a73)


Do not merge until those 5 get merged.

Additional things in this PR:
* Added more tests for `callbacks` not passed scenario
  * covered more cases like those with `dissect`
* Added more tests for signature params number (calling a function with
an extra arg should return an error)
* Cleaned up some more unused code
* Improved messages on too many arguments for functions

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
2024-02-09 14:25:28 +01:00
Marco Liberati
b091d8e956
[ES|QL] Added more tests for various scenarios (#176160)
## Summary

More fixes for the AST walker, validation, autocomplete.

A list of areas:
* [x] Add fixes and tests for the `IS NULL` and `IS NOT NULL` which was
broken
* [x] Add fixes and tests for the `+/- value` scenario
* [x] Selecting a command from suggestions will now propose another
suggestion popup with the right list of things ™️
* [x] Add test suite to check who and when we trigger automatically a
new suggestion flow
* [x] Fix validation of no aggregation arguments in `STATS` ( `... |
STATS BY field` )


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Drew Tate <drewctate@gmail.com>
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-02-05 12:04:05 +01:00
Marco Liberati
af9951fb26
[ES|QL] Batch of fixes and new features for autocomplete and validation (#175986)
## Summary

This PR is a batch of fixes and (tiny) new features for validation and
autocomplete items in ES|QL client side area.
Content of the PR:
* 🐛 remove array/multi-value definition annotation for `mv_*`
functions - fix #174709
<img width="305" alt="Screenshot 2024-01-31 at 13 43 37"
src="2a458e74-9c87-4a67-8b42-0071e7a04f48">
<img width="287" alt="Screenshot 2024-01-31 at 13 43 25"
src="7205d984-d0c9-410b-8b39-c1d530c3f54f">
* while the type check has been relaxed for lists, the actual
non-multivalued argument type is retained and used for validation
<img width="758" alt="Screenshot 2024-01-31 at 13 44 06"
src="384e9dfa-aaf8-4e0f-953e-a2d656776ea7">

* 🐛 Remove array/multi-value definition annotation for `mv_expand`
command - fix #174709

<img width="556" alt="Screenshot 2024-01-31 at 14 36 19"
src="0debbccc-da9a-4e6a-bfc9-3fded61300b5">
<img width="277" alt="Screenshot 2024-01-31 at 14 36 13"
src="9438832b-d8d5-48c5-a030-b8983057546e">


*  add metadata fields validation + autocomplete (fields are
retrieved via Kibana `uiSettings`) ( part of #172646 )
  

![metadata_fix](958e6609-ab73-4949-8652-f368c6604a09)
  
<img width="760" alt="Screenshot 2024-01-31 at 13 45 43"
src="b3f13d99-3e12-4586-b39c-f4ea3691a2f1">
  *  Quick fixes now available also for metadata fields
  

![metadata_fixes](b273418f-a754-4c50-9539-a128f35fc4cd)

* 🐛 fixed autocomplete for `NOT` operation

<img width="549" alt="Screenshot 2024-01-31 at 13 46 43"
src="29b7aa7c-db66-485a-a5b0-329e66df842f">

* fixed autocomplete for `in` operation, with or without `not`:
*  now a missing list bracket is correctly detected and
suggested after `in`
*  the content for the list is suggested and takes into
account both the left side of the `in`/`not in` operator, but also the
current content of the list


![in_list_fix_2](50ea8db5-23da-411c-b81e-5ba3397b65c1)

![in_list_fix](cbb73ad2-4073-4eb6-9c12-61835858fd5e)

![not_in_list_fix](9d7fa756-3d34-49fe-ac7a-28e2edbe7fee)

* fixed `grok` and `dissect` in various ways
* the pattern provided by autocomplete for both was not valid
in `dissect` nor useful at all, so I've changed to something more useful
like `'"%{WORD:firstWord}"'` for `grok` and `'"%{firstWord}"'` for
`dissect` to match the first word in the text field.
* 🐛 there was a bug in the validation engine as both `grok` and
`dissect` could generate new columns based on matches, so now a new
field query is fired (only when either a `GROK` or a `DISSECT` command
is detected) which enriches the set of fields available (similar to the
enrich fields)
  *  Added tons of tests here


![grok_fix](a23c8edc-0702-4531-aaa5-6126e375913b)

![dissect_fix](d5591753-775e-4768-be00-31c4371be330)

* 🐛 fixed an issue with proposing an assign (`=`) operator when it
should not
  * `... EVAL var0 = round( ...) <here>` not within another assignment
  * `... EVAL var0 = 1 <here>` not within another assignment
  * `... EVAL var0 = 1 year + 2 <here>` not within another assignment
  * `... | WHERE field` should not shadow a field name in this case

* 🐛 fix an annoying auto trigger suggestion on field selection, and
kept it only for functions

![auto_trigger_fix](31d0c296-6338-450d-8f81-e08cd1c7526d)

* 🐛 fixed an error in console with autocomplete when a typed
function does not exists
*   Add tests for the hover feature
* 🔥 Removed some unused functions detected via code coverage
analysis


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
2024-02-01 16:18:06 +00:00
Marco Liberati
31026a0b65
[ES|QL] Add quick fixes feature to query validation errors (#175553)
## Summary

This PR improves the UX of a query editing experience via the quick fix
feature, typical of a full IDE.
This is a bit of an experiment and a small enhancement already, but I'm
curious on more use cases for this quick fixes option. I've addressed
some simple ones here, but let me know if you think there are scenarios
you would like to be covered.

Spellchecks fixes are computed using a levenshtein distance of 3, same
as on the ES counterpart.
 
Current supported features:
* index spellcheck quick fix

![fix_indexes](dfd74f3d-28c2-4880-b771-42ea42e418d2)
  * wildcard support

![fix_indexes_wildcard](058c1e03-f4ae-40d2-ac73-e6da2b1ccde3)
* policy spellcheck quick fix

![fix_policies](24340f0a-d349-4db2-b009-97193025cf66)
* field/column spellcheck quick fix

![fix_fields](dda7e1bb-13bc-410f-a578-ef0feaed0a0f)
* function spellcheck quick fix

![fix_functions](40fa240a-034d-4ced-a23d-b970c9ebdc27)
* wrong quotes quick fix for literal strings

![fix_wrong_quotes](5f471b53-39a7-4b07-be2a-d0da27a17315)
* unquoted field/column quick fix

![fix_unquoted](c2ed7b58-a10e-4fd2-b51d-484b3b2a09e7)

Testing this feature I've also found a subtle bug in the autocomplete
code on unknown functions 😅 .
This feature requires some monaco additional sub-dependencies, so bundle
size can increase.

I was looking for a `Fix all` action as well, but I suspect there's
another route for that as error markers provided to the codeAction
provider are scoped by the hovered area in the editor, so multiple fixes
are only possible for the same hovered area and in this case I'm already
handling that manually for specific cases (i.e. unquoted field triggers
2 syntax + 1 validation errors).

---------

Co-authored-by: Eyo Okon Eyo <eyo.eyo@elastic.co>
Co-authored-by: Aleh Zasypkin <aleh.zasypkin@elastic.co>
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
2024-01-31 09:52:03 -07:00
Marco Liberati
5c86438950
[ES|QL] Add support for =~ operator (#174732)
## Summary

Keep in sync with new ES|QL builtin function addition:
https://github.com/elastic/elasticsearch/pull/103656

Do not merge until the related ER PR is still in review.

### Checklist

- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
2024-01-30 15:36:49 +01:00
Marco Liberati
877c562ab8
[ES|QL] Add st_centroid agg function (#175506)
## Summary

Adds new agg function as in
https://github.com/elastic/elasticsearch/pull/104218


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
2024-01-29 03:48:55 -07:00
Marco Liberati
1847cb8638
[ES|QL] STATS nested expressions - second part (#175515)
## Summary

This is the second part of #175288 where nested expressions are
supported in STATS scope as well.
I've tweaked the previous test suite here to check all agg functions
with nested expressions in various scenarios.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
2024-01-29 11:10:35 +01:00
Marco Liberati
3f92578e61
[ES|QL] Stop autocomplete on non-existent function (#175675)
## Summary

This PR fixes a scenario where the user types a non-existent function
into the editor:
* before a JS error was logged into the console due to a forced case
into `isFunctionArgComplete` function
* before eval functions were suggested by default in this case, now the
service just stops with an early exit.



![fix_function_autocomplete](d551b470-fa5b-4cf1-b688-7b4ac6f75515)


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
2024-01-26 16:01:12 +01:00
Marco Liberati
9c0c22db96
[ES|QL] Add support for mv_first, mv_last, to_geoshape, to_cartesianshape (#175518)
## Summary

Add missing functions to ES|QL validation/autocomplete support.


### Checklist

- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
2024-01-25 10:00:23 -07:00