Commit graph

2249 commits

Author SHA1 Message Date
James Gowdy
a5620cdb98
[ML] Fixing time range selector in recognizer wizard (#160910)
Fixing issue where the time range selectors would get stuck in a
infinite render loop.


![image](eb86f958-0dec-4ce9-8550-a0d3b75b1cb2)
2023-06-30 09:53:48 +01:00
David Kyle
679de5548f
[ML] Add a 16 threads option to start model deployment (#160743) 2023-06-29 10:03:34 +01:00
Melissa Alvarez
0a6f5b88cf
[ML] Anomaly detection: fixes time format used in query for datafeed chart (#160325)
## Summary

Fixes https://github.com/elastic/kibana/issues/159730

This PR ensures the range query specifies the format.


### 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
- [ ] 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)

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-06-28 08:32:08 -06:00
Dima Arnautov
4064e2b7d4
[ML] Hide inference stats for PyTorch models (#160599)
## Summary

Resolves https://github.com/elastic/kibana/issues/157385

Hides inference stats for the PyTorch models. 

- The salient information (`inference_count`, `timestamp`) is a repeat
of what is already displayed in the Deployment Stats section.
- `missing_all_fields_count` is confusing as the PyTorch models take a
single input field rather than multiple fields as DFA models do, hence
omitted.
- The deployment stats have an
[error_count](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-trained-models-stats.html)
field, hence it has been added to the Deployment Stats and
`failure_count` has been removed.
- Displays the stats tab by default for expanded rows if the model has
started deployments
2023-06-28 05:55:28 -07:00
Nathan Reese
2fb4d5fff8
[maps] remove IVectorSource.getFieldNames (#159747)
`IVectorSource` interface has many similar sounding methods that are
used for different purposes. These lead to confusion and an unclear API
* getFieldNames
* getFields
* getFieldByName

Although `getFieldNames` sounds similar to `getFields`, the 2 are used
for very different purposes.
* getFieldNames returns a string array that is used to trigger source
re-fetch
* getFields returns an array of fields to drive UI such as field
selection for data driven styling

`getFieldNames` overlaps 100% in functionality with `getSyncMeta` and is
not needed. Combining output of `getFieldNames` into `getSyncMeta`
simplifies the `IVectorSource` API and removes some confusion.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-06-27 11:36:43 -06:00
Melissa Alvarez
6bbb49706c
[ML] Custom urls: ensure interval input is aligned (#160557)
## Summary

Only show tooltip in data frame analytics as it isn't relevant to
Anomaly Detection.
Ensure the interval time range input is aligned even when there's an
error message.

<img width="682" alt="image"
src="15057bef-43d1-46b1-b0ce-34e46fb3258c">

<img width="689" alt="image"
src="0ee4d889-d63c-4c14-b1da-16cd7f196429">



### 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
2023-06-27 09:42:33 -06:00
Melissa Alvarez
1fa9ab9503
[ML] Outlier detection results: ensure feature influence color persists on column position change (#160470)
## Summary

Fixes https://github.com/elastic/kibana/issues/147768
This PR ensures the color for the cells persist on column position
update.

### 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
- [ ] 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)

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-06-27 08:59:01 -06:00
Dima Arnautov
59bd9f6459
[ML] Accessibility: Make links on job validation step distinguished from surrounding text (#160608)
## Summary

Resolves https://github.com/elastic/kibana/issues/160379

Adds heading to the validation messages to make all links rendered as
part of the text content.

<img width="1224" alt="image"
src="47416d44-7b3a-4694-88e2-43605bacc04f">


### Checklist

- [x] 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))
2023-06-27 15:35:19 +01:00
renovate[bot]
b2c6c71a8d
Update dependency @elastic/charts to v58 (main) (#159082)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@elastic/charts](https://togithub.com/elastic/elastic-charts) |
[`57.0.1` ->
`58.2.0`](https://renovatebot.com/diffs/npm/@elastic%2fcharts/57.0.1/58.2.0)
|
[![age](https://badges.renovateapi.com/packages/npm/@elastic%2fcharts/58.2.0/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/npm/@elastic%2fcharts/58.2.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/npm/@elastic%2fcharts/58.2.0/compatibility-slim/57.0.1)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/npm/@elastic%2fcharts/58.2.0/confidence-slim/57.0.1)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>elastic/elastic-charts</summary>

#
[58.2.0](https://github.com/elastic/elastic-charts/compare/v58.1.0...v58.2.0)
(2023-06-23)


### Bug Fixes

* `Chart` component `children` type
([#2071](https://github.com/elastic/elastic-charts/issues/2071))
([525c782](525c782829))
* **deps:** update dependency @elastic/eui to v82
([#2074](https://github.com/elastic/elastic-charts/issues/2074))
([69a655f](69a655f0da))


### Features

* **flame:** expose search field text and search text change listener
([#2068](https://github.com/elastic/elastic-charts/issues/2068))
([c339947](c339947c39))
* support native chart title and description
([#2002](https://github.com/elastic/elastic-charts/issues/2002))
([341a990](341a990c5d))

#
[58.1.0](https://github.com/elastic/elastic-charts/compare/v58.0.0...v58.1.0)
(2023-06-08)


### Features

* **flame:** expose search control
([#2064](https://github.com/elastic/elastic-charts/issues/2064))
([011b56b](011b56b3f5))

#
[58.0.0](https://github.com/elastic/elastic-charts/compare/v57.0.1...v58.0.0)
(2023-06-06)


### Bug Fixes

* **axis:** reduce number of y axis ticks on linear scale
([#2005](https://github.com/elastic/elastic-charts/issues/2005))
([0ef828b](0ef828b535))
* **deps:** update dependency @elastic/eui to v81
([#2052](https://github.com/elastic/elastic-charts/issues/2052))
([4c55e01](4c55e0119e))


### BREAKING CHANGES

* **axis:** the default number of desired ticks in the Y-Axis was
changed from `10` to `5`

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/elastic/kibana).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xMTAuMCIsInVwZGF0ZWRJblZlciI6IjM1LjExMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: nickofthyme <nicholas.partridge@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Nick Partridge <nick.ryan.partridge@gmail.com>
Co-authored-by: Marco Vettorello <marco.vettorello@elastic.co>
2023-06-26 11:41:49 -07:00
Patryk Kopyciński
a1d02824f1
[shared-ux-router] Add Router and Routes components (#159834)
## Summary

Why?

To simplify the process of migration to react-router@6.
https://github.com/remix-run/react-router/discussions/8753

What problems exactly it solves?

- In my previous PR I added `CompatRouter`
https://github.com/elastic/kibana/pull/159173, which caused changes in
~50 files and pinged 15 Teams. And this is just meant to be a temporary
change, so when we're done with the migration I would have to revert
these changes and engage everyone to review the PR again. And it is just
a single step in the migration strategy. So to make our lives easier I
think it would be better to have a common place where we do import our
router components because it will allow us to surface some extra logic
in single place instead of going through the whole source code again.

- `react-router@6` doesn't support a custom `Route` component, so that
means our custom `Route` component that we're using almost everywhere
today, will need to be replaced by a different solution. I have decided
to add `Routes` component, which will be responsible for rendering the
proper component (`react-router@6` renamed `Switch` to `Routes`, so I
have named this component to align with the dictionary of the new
router) and also is going to add the logic that today is done in `Route`
(moving logic to `Routes` will be done in the follow-up PR, here I just
wanted to focus on using the common router components to make the review
process easier)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-06-23 10:02:06 -05:00
Julia Rechkunova
7f0d57d9fd
[UnifiedFieldList] Convert from a plugin into a package (#158718)
- Closes https://github.com/elastic/kibana/issues/149336

## Summary

This PR converts `unifiedFieldList` plugin into a new
`@kbn/unified-field-list` package.

Had to also move some deps:
- from `uiActions` plugin to the existing `@kbn/ui-actions-browser`
package
- from `data` plugin to a new `@kbn/data-service` package

Please test that Field Stats from the package are still working on your
pages.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-06-23 14:28:12 +02:00
James Gowdy
7aa1dcadf1
[ML] Fix saved object sync check for jobs which are hidden from the user (#160266)
Fixes a bug introduced in PR
https://github.com/elastic/kibana/pull/146155
A user who cannot see all spaces will incorrectly be told that jobs
which only exist in spaces they cannot see are in need of
synchronisation.
The problem was caused by an accident replacement of the
`internalSavedObjectsClient` function (which can see all spaces) with
the cached saved objects client which can only see the user's allowed
spaces.
The fix is to revert to the original code.

This particular scenario was not covered by API tests. The tests have
also been updated in 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
2023-06-23 09:43:58 +01:00
James Gowdy
cf92a67fa9
[ML] Fix links to dashboards in Lens created anomaly detection jobs (#160156)
When creating a job from a Lens visualisation, a link back to the
original dashboard is added to the job's custom URLs.
This has recently become broken due to the dashboard ID retrieved from
the lens embeddable not matching the real dashboard ID.
Rather than rely on this ID, the actual dashboard is retrieved from
kibana using the dashboard service and the ID acquired from there.

The dashboard service also contains the dashboard url locator which we
can use rather than use the `share` plugin.
2023-06-22 21:03:10 +01:00
Dima Arnautov
4079366ee8
[ML] Hide cache_miss_count for pytorch models (#160265)
## Summary

Resolves https://github.com/elastic/kibana/issues/157385

<img width="1355" alt="image"
src="cb779fb5-f9d5-4222-af38-e636724867a3">

### Checklist

- [ ] [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
2023-06-22 07:32:47 -07:00
Melissa Alvarez
3d68e071bd
[ML] Data Frame Analytics: Allow interval time range selection in custom URLs (#159874)
## Summary

Related PR https://github.com/elastic/kibana/issues/156025

This PR adds the option to in Data Frame Analytics custom urls to add an
interval time range to a custom url.

<img width="831" alt="image"
src="0e9ee00b-d67e-49a7-93eb-3b452e715762">


### 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
- [ ] 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)

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Walter Rafelsberger <walter.rafelsberger@elastic.co>
2023-06-21 09:55:01 -06:00
Quynh Nguyen (Quinn)
9366d1b0b3
[ML] Increase limit of anomaly charts embeddables to max of 50 (#159816) 2023-06-20 10:55:21 -05:00
Dima Arnautov
e4b8f0f0bf
[ML] Update the Overview page (#160032)
## Summary


[Cherry-pick](36c9a0cdff)
of the original PR https://github.com/elastic/kibana/pull/159609 with
the
[fixed](d444ca4654)
`css` import.
2023-06-20 08:52:01 -07:00
Quynh Nguyen (Quinn)
d81db01444
[ML] Remove usage of SavedObjectClient in ML client side (#159625)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-06-20 08:38:13 -07:00
Tiago Costa
bd38b4861c
Revert "[ML] Update the Overview page (#159609)"
This reverts commit 6ac52fb9ec.
2023-06-20 14:45:34 +01:00
Dima Arnautov
6ac52fb9ec
[ML] Update the Overview page (#159609)
## Summary

Resolves https://github.com/elastic/kibana/issues/154294 and updates the
UI of the Overview page

- Updates panels layout 
- Stores expand/collapsed state of the panels in the local storage 
- Update empty states text and layout 

<img width="1341" alt="image"
src="8833fa2a-b574-44ee-bacb-e974186dd35f">


### Checklist

- [ ] 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
- [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
- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] 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))
- [x] 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))
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)
2023-06-20 13:56:00 +02:00
Quynh Nguyen (Quinn)
03f86a9450
[ML] Enable auto-complete on filter by influencer search box on anomaly explorer page (#159739)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-06-15 13:54:04 -05:00
Jean-Louis Leysens
2b81164ff9
[http] Only allow 2023-10-31 when registering public versions (#159553)
## Summary

Adds logic (and tests) to ensure that all registered public routes are
set to `2023-10-31` for now. This check is only performed in dev mode
which allows us to test our existing route default logic.

### Notes

This works best as a runtime check given the versioned router API, but
perhaps I missed a way to do this with just type checking?
2023-06-15 11:50:54 -04:00
Melissa Alvarez
5751f29f58
[ML] Explain Log Rate Spikes: allow sticky histogram (#159412)
## Summary

Related issue: https://github.com/elastic/kibana/issues/156605

This PR adds some ELRS style updates:

- adds options prop to allow 'stickyHistogram' - defaults to false for
now - until page restructure work is done to allow for smooth
interaction
- Moves the 'Clear' functionality to 'Reset' button in line with the
progress controls

<img width="1273" alt="image"
src="50bd3512-cad6-498e-b7a2-740a01151004">


### 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
- [ ] 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)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-06-15 07:26:33 -06:00
Sébastien Loix
fb41ca56f9
[SharedUxChromeNavigation] Use deeplink id instead of href (#159125) 2023-06-13 10:10:10 -07:00
Dima Arnautov
bf6848888b
[ML] Update route resolvers (#159176)
## Summary

Resolves #153932

Updates route resolver callback to track license and ML capabilities
requirements.

- The logic for resolving the data view and saved search has been moved
to the dedicated context `DataSourceContextProvider` and only applies to
pages that need it. It also shows an error callout in case of an error
during the data view fetch.
- ML License class has been updated to track license changes and logic
for redirects has been moved to the route resolver
- `MlCapabilitiesService` has been updated to periodically fetch
capabilities
- Most of the static usages of `checkPermission` have been replaced with
`usePermissionCheck`


### Notes for reviewers 

- Now it's obvious what license and capabilities requirements each route
has. We should carefully review it because I assume legacy resolvers
were not entirely correct in the same cases.

### 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
2023-06-13 13:53:42 +02:00
Melissa Alvarez
f2da36215c
[Maps][ML] Add hyperlink to anomaly explorer for job from anomaly layer in maps (#159268)
## Summary

Related issue: https://github.com/elastic/kibana/issues/148665

This PR adds a link to the anomaly explorer for the job corresponding to
the anomalies layer in maps. The link is found under 'Source details'
once the anomalies layer is created.

<img width="1291" alt="image"
src="f109ce21-1aec-40c4-8cf1-fc3dedaef199">

## NOTE

This is dependent on the changes in maps
https://github.com/elastic/kibana/pull/159255

### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-06-09 14:31:28 -06:00
Walter Rafelsberger
9492c932bd
[ML] Package @kbn/ml-data-grid (#155530)
Refactors outdated approach of sharing the custom data grid component
from the `ml` plugin to the `transform` plugin to use packages instead.

Creates the following packages:

- `@kbn/ml-data-grid`
- `@kbn/ml-date-utils`
- `@kbn/ml-runtime-field-utils`
----

- Imports have been refactored so the `transform` plugin no longer
imports code from packages `@kbn/ml-anomaly-utils` and
`@kbn/ml-data-frame-analytics-utils`.
- Removed again auto-generated `@type` related JSDoc comments. Within
the code those annotations are quite redundant, would be cumbersome to
maintain and they are not necessary to satisfy the "missing comments"
check.
- The `renderCellPopover` callback has been refactored out of the
`DataGrid` component and can now be passed in as an optional prop. It is
only used for Data Frame Analytics and this way we can avoid some
dependency of the transform plugin on DFA related code.
- Some more code has been moved to `@kbn/ml-anomaly-utils` to make
available via packages what's needed for the data grid.
2023-06-06 11:20:37 +02:00
James Gowdy
73226d5d70
[ML] Fixing saved object sync in a serverless environment when apis are missing part 2 (#158749)
Follow on from https://github.com/elastic/kibana/pull/156585

Temporarily fixes https://github.com/elastic/kibana/issues/156500

With the ability to run a serverless elasticsearch locally, it was now
possible to debug and fix the remaining bugs.

The try/catches added in these PRs will probably be removed once we have
the ability to know what apis we are allowed to call in the serverless
project.
2023-06-06 09:14:29 +01:00
renovate[bot]
be244835e6
Update dependency @elastic/charts to v57.0.1 (main) (#155749)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@elastic/charts](https://togithub.com/elastic/elastic-charts) |
[`55.0.0` ->
`57.0.1`](https://renovatebot.com/diffs/npm/@elastic%2fcharts/55.0.0/57.0.1)
|
[![age](https://badges.renovateapi.com/packages/npm/@elastic%2fcharts/57.0.1/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/npm/@elastic%2fcharts/57.0.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/npm/@elastic%2fcharts/57.0.1/compatibility-slim/55.0.0)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/npm/@elastic%2fcharts/57.0.1/confidence-slim/55.0.0)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Bug fixes

- Fixes #148872 relating to multilayer time axes.
- Fixes #158580 relating to heatmap selection with small multiples.

---

### Release Notes

<details>
<summary>elastic/elastic-charts</summary>

###
[`v57.0.1`](https://togithub.com/elastic/elastic-charts/blob/HEAD/CHANGELOG.md#&#8203;5700-httpsgithubcomelasticelastic-chartscomparev5700v5701-2023-04-19)

[Compare
Source](https://togithub.com/elastic/elastic-charts/compare/v57.0.0...v57.0.1)

##### Bug Fixes

* **axes:** start of week label on multilayer time axis
([#2035](https://github.com/elastic/elastic-charts/issues/2035))
([9711233](9711233cbf))
* **deps:** update dependency @elastic/eui to ^77.2.0
([#2032](https://github.com/elastic/elastic-charts/issues/2032))
([93cadcb](93cadcb7ae))
* **deps:** update dependency @elastic/eui to v78
([#2038](https://github.com/elastic/elastic-charts/issues/2038))
([3feff2c](3feff2c5bc))
* **deps:** update dependency @elastic/eui to v79
([#2042](https://github.com/elastic/elastic-charts/issues/2042))
([8015830](8015830f20))
* **deps:** update dependency @elastic/eui to v80
([#2047](https://github.com/elastic/elastic-charts/issues/2047))
([e6042f3](e6042f3da3))
* **heatmap:** brushing selection values
([#2028](https://github.com/elastic/elastic-charts/issues/2028))
([6a877b4](6a877b431e))
* **heatmap:** wrong axes labels on hover
([#2033](https://github.com/elastic/elastic-charts/issues/2033))
([045fb03](045fb037a9))

###
[`v57.0.0`](https://togithub.com/elastic/elastic-charts/blob/HEAD/CHANGELOG.md#&#8203;5700-httpsgithubcomelasticelastic-chartscomparev5600v5700-2023-04-19)

[Compare
Source](82f6750196...v57.0.0)

##### Code Refactoring

- enable `noUncheckedIndexedAccess`
([#&#8203;2006](https://togithub.com/elastic/elastic-charts/issues/2006))
([f446cca](f446cca169))

##### BREAKING CHANGES

-   Enables stricter type option in src and could have
    unexpected changes. This release is meant to serve as a clean break
    in case any issues arise.

###
[`v56.0.1`](https://togithub.com/elastic/elastic-charts/compare/v56.0.0...82f67501967a1fad80253889462e3aaac724e060)

[Compare
Source](https://togithub.com/elastic/elastic-charts/compare/v56.0.0...82f67501967a1fad80253889462e3aaac724e060)

###
[`v56.0.0`](https://togithub.com/elastic/elastic-charts/blob/HEAD/CHANGELOG.md#&#8203;5600-httpsgithubcomelasticelastic-chartscomparev5500v5600-2023-04-18)

[Compare
Source](https://togithub.com/elastic/elastic-charts/compare/v55.0.0...v56.0.0)

##### Bug Fixes

- **deps:** update dependency
[@&#8203;elastic/eui](https://togithub.com/elastic/eui) to ^76.4.0
([#&#8203;2008](https://togithub.com/elastic/elastic-charts/issues/2008))
([95176e1](95176e1429))
- **deps:** update dependency
[@&#8203;elastic/eui](https://togithub.com/elastic/eui) to v77
([#&#8203;2018](https://togithub.com/elastic/elastic-charts/issues/2018))
([c079730](c079730dd8))
- **interactions:** brushing over origin coordinates
([#&#8203;2013](https://togithub.com/elastic/elastic-charts/issues/2013))
([937feb0](937feb0fcf))
- **tooltip:** custom tooltip header context
([#&#8203;1989](https://togithub.com/elastic/elastic-charts/issues/1989))
([1e5b861](1e5b86106f))

##### Features

- **metric:** trend with string value
([#&#8203;2011](https://togithub.com/elastic/elastic-charts/issues/2011))
([91d7695](91d76957d8))

##### BREAKING CHANGES

- **tooltip:** The `header` property of `TooltipInfo` type was
simplified to `PointerValue` as to include only relevant properties.
This change is propagated to all other types using `header` as a
`TooltipValue`. The `TooltipInfo.values` used to conditionally pass only
highlighted `TooltipValue`s when using a `customTooltip` and now
*always* passes all `values`.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/elastic/kibana).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS41OC4yIiwidXBkYXRlZEluVmVyIjoiMzUuOTguNCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: nickofthyme <nicholas.partridge@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
Co-authored-by: Nick Partridge <nick.ryan.partridge@gmail.com>
2023-06-05 18:11:56 -07:00
Cee Chen
c52ff7f425
Upgrade EUI to v81.2.0 (#158781)
## Summary

`eui@81.0.0`  `eui@81.2.0`

- Most changes to source code in this PR are CSS cleanups/deprecations
in `EuiSuperDatePicker`/`EuiDatePickerRange`
- One team (ML) had a `inline` specific usage of `EuiDatePickerRange`
that they reached out to us about via Slack, and that we have fixed in
this PR.
- All other usages of date picker components should have remained
working as-is with no changes, but please ping us if you see otherwise!

___

## [`81.2.0`](https://github.com/elastic/eui/tree/v81.2.0)

- Updated `EuiSuperDatePicker` to accept an object configuration for
`isDisabled` ([#6821](https://github.com/elastic/eui/pull/6821))

**Bug fixes**

- Fixed broken `EuiSuperDatePicker` styles
([#6821](https://github.com/elastic/eui/pull/6821))

## [`81.1.0`](https://github.com/elastic/eui/tree/v81.1.0)

- Added `EuiInlineEditText` and `EuiInlineEditTitle` components
([#6757](https://github.com/elastic/eui/pull/6757))
- Updated `EuiDatePickerRange` to support `inline` display
([#6795](https://github.com/elastic/eui/pull/6795))
- Added an `onError` callback prop to `EuiErrorBoundary`
([#6810](https://github.com/elastic/eui/pull/6810))
- Updated `EuiDataGrid` to only render screen reader text announcing
cell position if the cell is currently focused. This should improve the
ability to copy and paste multiple cells without SR text.
([#6817](https://github.com/elastic/eui/pull/6817))

**Bug fixes**

- Fixed `EuiDatePicker`'s `inline` display to correctly render and
prevent user interaction when `disabled` or `readOnly`
([#6795](https://github.com/elastic/eui/pull/6795))
- Fixed `EuiDatePicker`'s `inline` display to correctly render
`isInvalid` and `isLoading` icons
([#6795](https://github.com/elastic/eui/pull/6795))

**CSS-in-JS conversions**

- Converted `EuiDatePickerRange` to Emotion
([#6795](https://github.com/elastic/eui/pull/6795))

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-06-05 13:51:40 -07:00
Dima Arnautov
21f42fb27b
[ML] Support pipelines deletion and force flag for delete action (#158671) 2023-06-05 13:46:27 +02:00
Matthew Kime
22ccf83d66
[saved search] Content management integration (#158006)
## Summary

- Saved searches use content management api
- Saved search plugin provides proper plugin api instead of static
exports
- Discover no longer re-exports static content from saved search plugin
- ML no longer works directly with the saved search saved object
- saved object conflicts are thrown via the api, rather than the api
consumer
- Content management api logs failed requests a bit better, helpful for
tests failing in CI

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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-06-02 18:55:52 -07:00
James Gowdy
e4be759437
[ML] Increasing calendar events request limit (#158726)
Fixes https://github.com/elastic/kibana/issues/158712

Increasing the limit for getting all events, the default is `100`, which
can easily be passed.
Also increasing the size for getting all calendars, for consistency.
2023-06-01 11:24:59 +01:00
Walter Rafelsberger
9febf5de21
[ML] Package @kbn/ml-data-frame-analytics-utils (#155976)
Creates Package `@kbn/ml-data-frame-analytics-utils` via `node
scripts/generate package @kbn/ml-data-frame-analytics-utils --web --dir
./x-pack/packages/ml/data_frame_analytics_utils`.

Moves some of the constants, types and utilities for Data Frame
Analytics to its own package. This is in preparation to move our data
grid related code to a package too. Since this code for now is only used
by our team I didn't do any renaming related to for example consistent
prefixing, this should be revisited in a follow up. Another opportunity
for a follow up might be a clean up of the types and check which ones
can be replaced by types from `estypes`.
2023-05-31 13:54:50 +02:00
Yan Savitski
815fddb9f0
[Search Application] Use ES JS client instead of Transport (#158446)
- ✔️ Update es client version
- ✔️ Replace transport api to es client
- ✔️ Update tests
- ✔️ Fix TS issues
2023-05-30 05:16:40 -07:00
Dima Arnautov
59b1ba9767
[ML] Disable delete action for deployed models (#158533)
## Summary

Fixes https://github.com/elastic/kibana/issues/157692.

Disables delete action for deployed models.

<img width="1506" alt="image"
src="8e44dcca-789e-41c3-9dca-87034f84390b">


### Checklist

- [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
2023-05-26 08:17:38 -07:00
Dima Arnautov
c5eee26671
[ML] Apply theme based on the User Profile settings (#158258)
## Summary

With the release of Per User Dark Mode, code should no longer rely on
calling `uiSettings` to determine which theme Kibana is displayed with.

With theme settings now configurable from User Profiles and Adv.
Settings, the code that was calling uiSettings to determine the Kibana
theme will not take into account which theme is currently being
displayed.


Applies an appropriate EUI theme based on the profile settings. In
particular for the following components:
- Anomaly swim lane (Fixes #158155 )
- Job tree map view (Fixes
https://github.com/elastic/kibana/issues/158304)
- Charts-related theme settings, e.g. the Single Metric Viewer
2023-05-25 11:57:48 +02:00
James Gowdy
0a79002d73
[ML] Adding version to the http service (#158358)
Adds `version` to the `getFetchOptions` response which is passed to
`http.fetch`
Refactors the code to remove duplicate functions which do not need to be
methods in `HttpService`.
2023-05-24 12:54:54 +01:00
James Gowdy
203d3068e8
[ML] Versioning all ML APIs (#156949)
Adds versioning to all of the ML kibana APIs.
Versions are added to the server side routes and to the client side
functions which call the routes.
Makes some small refactors to ensure only the functions inside
`ml/public/application/services/ml_api_service/` are where the ML APIs
are called.
Updates external plugins which call ML APIs to add the new versioning.
Updates API tests to add the API version to the request headers.

Our one public API has been given the version `'2023-05-15'`, all of the
internal APIs have been given the version `'1'`.

**Public APIs:**
`/api/ml/saved_objects/sync`

**Internal APIS:**
`/internal/ml/alerting/preview`
`/internal/ml/annotations`
`/internal/ml/annotations/index`
`/internal/ml/annotations/delete/{annotationId}`
`/internal/ml/anomaly_detectors`
`/internal/ml/anomaly_detectors/{jobId}`
`/internal/ml/anomaly_detectors/_stats`
`/internal/ml/anomaly_detectors/{jobId}/_stats`
`/internal/ml/anomaly_detectors/{jobId}`
`/internal/ml/anomaly_detectors/{jobId}/_update`
`/internal/ml/anomaly_detectors/{jobId}/_open`
`/internal/ml/anomaly_detectors/{jobId}/_close`
`/internal/ml/anomaly_detectors/{jobId}/_reset`
`/internal/ml/anomaly_detectors/{jobId}`
`/internal/ml/anomaly_detectors/_validate/detector`
`/internal/ml/anomaly_detectors/{jobId}/_forecast`
`/internal/ml/anomaly_detectors/{jobId}/results/records`
`/internal/ml/anomaly_detectors/{jobId}/results/buckets/{timestamp?}`
`/internal/ml/anomaly_detectors/{jobId}/results/overall_buckets`
`/internal/ml/anomaly_detectors/{jobId}/results/categories/{categoryId}`
`/internal/ml/anomaly_detectors/{jobId}/model_snapshots`
`/internal/ml/anomaly_detectors/{jobId}/model_snapshots/{snapshotId}`

`/internal/ml/anomaly_detectors/{jobId}/model_snapshots/{snapshotId}/_update`
`/internal/ml/anomaly_detectors/{jobId}/model_snapshots/{snapshotId}`
`/internal/ml/calendars`
`/internal/ml/calendars/{calendarIds}`
`/internal/ml/calendars`
`/internal/ml/calendars/{calendarId}`
`/internal/ml/calendars/{calendarId}`
`/internal/ml/data_frame/analytics`
`/internal/ml/data_frame/analytics/{analyticsId}`
`/internal/ml/data_frame/analytics/_stats`
`/internal/ml/data_frame/analytics/{analyticsId}/_stats`
`/internal/ml/data_frame/analytics/{analyticsId}`
`/internal/ml/data_frame/_evaluate`
`/internal/ml/data_frame/analytics/_explain`
`/internal/ml/data_frame/analytics/{analyticsId}`
`/internal/ml/data_frame/analytics/{analyticsId}/_start`
`/internal/ml/data_frame/analytics/{analyticsId}/_stop`
`/internal/ml/data_frame/analytics/{analyticsId}/_update`
`/internal/ml/data_frame/analytics/{analyticsId}/messages`
`/internal/ml/data_frame/analytics/jobs_exist`
`/internal/ml/data_frame/analytics/map/{analyticsId}`
`/internal/ml/data_frame/analytics/new_job_caps/{indexPattern}`
`/internal/ml/data_frame/analytics/validate`
`/internal/ml/data_visualizer/get_field_histograms/{indexPattern}`
`/internal/ml/datafeeds`
`/internal/ml/datafeeds/{datafeedId}`
`/internal/ml/datafeeds/_stats`
`/internal/ml/datafeeds/{datafeedId}/_stats`
`/internal/ml/datafeeds/{datafeedId}`
`/internal/ml/datafeeds/{datafeedId}/_update`
`/internal/ml/datafeeds/{datafeedId}`
`/internal/ml/datafeeds/{datafeedId}/_start`
`/internal/ml/datafeeds/{datafeedId}/_stop`
`/internal/ml/datafeeds/{datafeedId}/_preview`
`/internal/ml/fields_service/field_cardinality`
`/internal/ml/fields_service/time_field_range`
`/internal/ml/filters`
`/internal/ml/filters/{filterId}`
`/internal/ml/filters`
`/internal/ml/filters/{filterId}`
`/internal/ml/filters/{filterId}`
`/internal/ml/filters/_stats`
`/internal/ml/indices/field_caps`
`/internal/ml/job_audit_messages/messages/{jobId}`
`/internal/ml/job_audit_messages/messages`
`/internal/ml/job_audit_messages/clear_messages`
`/internal/ml/jobs/force_start_datafeeds`
`/internal/ml/jobs/stop_datafeeds`
`/internal/ml/jobs/delete_jobs`
`/internal/ml/jobs/close_jobs`
`/internal/ml/jobs/reset_jobs`
`/internal/ml/jobs/force_stop_and_close_job`
`/internal/ml/jobs/jobs_summary`
`/internal/ml/jobs/jobs_with_geo`
`/internal/ml/jobs/jobs_with_time_range`
`/internal/ml/jobs/job_for_cloning`
`/internal/ml/jobs/jobs`
`/internal/ml/jobs/groups`
`/internal/ml/jobs/update_groups`
`/internal/ml/jobs/blocking_jobs_tasks`
`/internal/ml/jobs/jobs_exist`
`/internal/ml/jobs/new_job_caps/{indexPattern}`
`/internal/ml/jobs/new_job_line_chart`
`/internal/ml/jobs/new_job_population_chart`
`/internal/ml/jobs/all_jobs_and_group_ids`
`/internal/ml/jobs/look_back_progress`
`/internal/ml/jobs/categorization_field_examples`
`/internal/ml/jobs/top_categories`
`/internal/ml/jobs/datafeed_preview`
`/internal/ml/jobs/revert_model_snapshot`
`/internal/ml/jobs/bulk_create`
`/internal/ml/validate/estimate_bucket_span`
`/internal/ml/validate/calculate_model_memory_limit`
`/internal/ml/validate/cardinality`
`/internal/ml/validate/job`
`/internal/ml/validate/datafeed_preview`
`/internal/ml/json_schema`
`/internal/ml/management/list/{listType}`
`/internal/ml/model_management/nodes_overview`
`/internal/ml/model_management/memory_usage`
`/internal/ml/modules/recognize/{indexPatternTitle}`
`/internal/ml/modules/get_module/{moduleId?}`
`/internal/ml/modules/setup/{moduleId}`
`/internal/ml/modules/jobs_exist/{moduleId}`
`/internal/ml/notifications`
`/internal/ml/notifications/count`
`/internal/ml/results/anomalies_table_data`
`/internal/ml/results/category_definition`
`/internal/ml/results/max_anomaly_score`
`/internal/ml/results/category_examples`
`/internal/ml/results/partition_fields_values`
`/internal/ml/results/anomaly_search`
`/internal/ml/results/{jobId}/categorizer_stats`
`/internal/ml/results/category_stopped_partitions`
`/internal/ml/results/datafeed_results_chart`
`/internal/ml/results/anomaly_charts`
`/internal/ml/results/anomaly_records`
`/internal/ml/saved_objects/status`
`/internal/ml/saved_objects/initialize`
`/internal/ml/saved_objects/sync_check`
`/internal/ml/saved_objects/update_jobs_spaces`
`/internal/ml/saved_objects/update_trained_models_spaces`
`/internal/ml/saved_objects/remove_item_from_current_space`
`/internal/ml/saved_objects/jobs_spaces`
`/internal/ml/saved_objects/trained_models_spaces`
`/internal/ml/saved_objects/can_delete_ml_space_aware_item/{jobType}`
`/internal/ml/_has_privileges`
`/internal/ml/ml_capabilities`
`/internal/ml/ml_node_count`
`/internal/ml/info`
`/internal/ml/es_search`
`/internal/ml/index_exists`
`/internal/ml/trained_models/{modelId?}`
`/internal/ml/trained_models/_stats`
`/internal/ml/trained_models/{modelId}/_stats`
`/internal/ml/trained_models/{modelId}/pipelines`
`/internal/ml/trained_models/{modelId}`
`/internal/ml/trained_models/{modelId}`
`/internal/ml/trained_models/{modelId}/deployment/_start`

`/internal/ml/trained_models/{modelId}/{deploymentId}/deployment/_update`
`/internal/ml/trained_models/{modelId}/{deploymentId}/deployment/_stop`
`/internal/ml/trained_models/pipeline_simulate`
`/internal/ml/trained_models/infer/{modelId}/{deploymentId}`
2023-05-23 21:21:22 +01:00
Pierre Gayvallet
8453fe820a
Cleanup spread operators in reduce calls (#157471)
## Summary

The spread operator is costly and put pressure on GC. It should be
avoided when possible, especially in loops.

This PR adapts a lot of `reduce` calls in the codebase to remove the
usages of the diabolic spread operator, when possible.

Note: the PR is not fully exhaustive. I focused on the server-side, as
we're more directly impacted than on browser-side code regarding
performances.

## Removing `...` usages in `kittens.reduce()`

For `reduce` loops, the spread operator can usually easily be replaced:

#### - setting a value on the accum object and returning it

#### BAD
```ts
  return this.toArray().reduce(
      (acc, renderer) => ({
        ...acc,
        [renderer.name]: renderer,
      }),
      {} as Record<string, ExpressionRenderer>
    );
```

#### GOOD
```ts
  return this.toArray().reduce((acc, renderer) => {
      acc[renderer.name] = renderer;
      return acc;
    }, {} as Record<string, ExpressionRenderer>);
```


#### - assigning values to the accum object and returning it 

#### BAD
```ts
  const allAggs: Record<string, any> = fieldAggRequests.reduce(
      (aggs: Record<string, any>, fieldAggRequest: unknown | null) => {
        return fieldAggRequest ? { ...aggs, ...(fieldAggRequest as Record<string, any>) } : aggs;
      },
      {}
    );
```

#### GOOD
```ts
  const allAggs = fieldAggRequests.reduce<Record<string, any>>(
      (aggs: Record<string, any>, fieldAggRequest: unknown | null) => {
        if (fieldAggRequest) {
          Object.assign(aggs, fieldAggRequest);
        }
        return aggs;
      },
      {}
    );
```

#### - pushing items to the accum list and returning it 

#### BAD
```ts
  const charsFound = charToArray.reduce(
    (acc, char) => (value.includes(char) ? [...acc, char] : acc),
    [] as string[]
  );
```

#### GOOD
```ts
  const charsFound = charToArray.reduce((acc, char) => {
    if (value.includes(char)) {
      acc.push(char);
    }
    return acc;
  }, [] as string[]);
```

## Questions

#### Are you sure all the changes in this are strictly better for
runtime performances?

Yes, yes I am.

#### How much better?

Likely not much.

#### Are you planning on analyzing the perf gain?

Nope.

#### So why did you do it?

I got tired of seeing badly used spread operators in my team's owned
code, and I had some extra time during on-week, so I spent a few hours
adapting the usages in all our runtime/production codebase.

#### Was it fun?

Take your best guess.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-05-22 04:50:24 -07:00
Nathan Reese
596c7b3e70
[maps] distance spatial join (#156618)
Fixes https://github.com/elastic/kibana/issues/154605

PR adds new layer wizard for spatial join. Wizard provides an easy
interface to create spatial join as well as advertising the capability
in the main layer creation work flow.
<img width="200" alt="Screen Shot 2023-05-04 at 12 16 45 PM"
src="https://user-images.githubusercontent.com/373691/236293473-8a740171-0910-4574-8e38-0ba1ab38a5fd.png">
<img width="400" alt="Screen Shot 2023-05-04 at 12 17 07 PM"
src="https://user-images.githubusercontent.com/373691/236293475-ad04cb1c-b49f-46aa-8ae6-2df62123b516.png">

PR renames `Terms joins` editor panel to `Joins` and updates panel to
accommodate spatial joins. Displays UI for creating, editing and
deleting spatial joins.
<img width="200" alt="Screen Shot 2023-05-04 at 12 17 20 PM"
src="https://user-images.githubusercontent.com/373691/236293486-49aa8063-0860-4aa7-af85-e47f899a3885.png">
<img width="400" alt="Screen Shot 2023-05-04 at 12 41 39 PM"
src="https://user-images.githubusercontent.com/373691/236298721-e237b801-0539-4960-82e6-d992f5bd8bb4.png">
<img width="300" alt="Screen Shot 2023-05-04 at 12 17 25 PM"
src="https://user-images.githubusercontent.com/373691/236293489-b18c7a0a-b339-42f0-870d-88785175c1f6.png">
<img width="300" alt="Screen Shot 2023-05-04 at 12 17 37 PM"
src="https://user-images.githubusercontent.com/373691/236293492-f4ea3b9b-d28d-46d8-a243-c0e82cb5efda.png">

PR also updates inspector request registration name and description to
provide less technical names that provide better meaning of what request
is fetching and how everything fits together. I think this really helps
understandability of join requests
<img width="500" alt="Screen Shot 2023-05-04 at 12 22 56 PM"
src="https://user-images.githubusercontent.com/373691/236294739-53d32f65-a5e5-4b6d-b41a-7f76fcd731b5.png">


#### Known issues
Issues discovered by this PR that are in main and will be resolved
separately.
* When using spatial join wizard, if there are no matches to left source
then layer gets stuck in loading state
https://github.com/elastic/kibana/issues/156630
* Term join left field change not applied as expected
https://github.com/elastic/kibana/issues/156631

#### Developer level changes

LayerDescriptor
* Changes joins from `JoinDescriptor` to `Partial<JoinDescriptor>`. This
did not change the content, just updated the type to better reflect
contents.

JoinDescriptor
* Changes right from `JoinSourceDescriptor` to
`Partial<JoinSourceDescriptor>`. This did not change the content, just
updated the type to better reflect contents.

IVectorLayer interface changes
* Remove getJoinsDisabledReason
* Remove showJoinEditor

IVectorSource interface changes
* Replaced showJoinEditor with supportsJoins
* Removed getJoinsDisabledReason

Replaced GeoIndexPatternSelect prop `value` with `dataView`.
1) provides better symmetry since on change return DataView
2) First time GeoIndexPatternSelect need to use a pre-loaded data view.
By passing in DataView, loading state can be more easily handled.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Nick Peihl <nickpeihl@gmail.com>
2023-05-17 06:20:04 -06:00
Pete Harverson
15f3a0f418
[ML] Use auto layout for anomalies table columns (#157687)
## Summary

Switches the layout of the anomalies table, as used in the Anomaly
Explorer and Single Metric Viewer, to use an `auto` layout rather than
the default `fixed` layout, so that the column widths better adapt to
the length of content in the columns.

### Before - narrow widths of `Found for` and `Influenced by` columns

<img width="1030" alt="anomalies_table_fixed_layout"
src="bf4a4cbb-8150-44d8-b2e5-87e2bd529d23">

### After - auto layout

<img width="1036" alt="anomalies_table_auto_layout"
src="6e83f19f-6e51-4179-9957-6852b21cfd2a">

Note that the `fixed` layout is retained where the table is showing
categorization examples, as columns which have `truncateText` set to
`true` do not work with the EUI table `fixed` layout. e.g. if layout was
set to `auto` the examples column could be very wide and result in the
Action column going off-screen:

<img width="1048" alt="anomalies_table_auto_layout_category"
src="456f95bf-2bbd-4c21-807a-5a0c2c39b032">

### Checklist

- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

Closes #134227
2023-05-16 17:20:49 +01:00
Cee Chen
b9ea4ce4f5
Upgrade EUI to v79.0.1 (#156925)
## Summary

`eui@77.2.2`  `eui@79.0.1`

🦴 The primary changes in this upgrade are around the deprecated
`EuiLoadingContent` being removed in favor of `EuiSkeletonText`.
- Most instances have been a [direct swap of
usage](327626a7be),
but [some replacements were a bit more
opinionated](e6ceb36a75)
as I saw them as potential to take advantage of `EuiSkeletonText`'s
syntactical sugar and screen reader announcements for when state
switches to loaded.

---

## [`79.0.1`](https://github.com/elastic/eui/tree/v79.0.1)

**Bug fixes**

- Fixed broken push `EuiFlyout` behavior
([#6764](https://github.com/elastic/eui/pull/6764))


## [`79.0.0`](https://github.com/elastic/eui/tree/v79.0.0)

- Updated all `EuiSkeleton` components with new props that allow for
more control over screen reader live announcements:
`announceLoadingStatus`, `announceLoadedStatus`, and `ariaLiveProps`
([#6752](https://github.com/elastic/eui/pull/6752))
- Improved keyboard accessibility in `EuiPageHeader` by ensuring the
right side menu items come into focus from left to right.
([#6753](https://github.com/elastic/eui/pull/6753))

**Breaking changes**

- Removed deprecated `EuiLoadingContent`. Use the `EuiSkeleton`
components instead. ([#6754](https://github.com/elastic/eui/pull/6754))


## [`78.0.0`](https://github.com/elastic/eui/tree/v78.0.0)

- Improved the contrast ratio of `EuiCheckbox`, `EuiRadio`, and
`EuiSwitch` in their unchecked states to meet WCAG AA guidelines.
([#6729](https://github.com/elastic/eui/pull/6729))
- Added React Testing Library `*ByTestSubject` custom commands to
`within()`. RTL utilities can be imported from
`@elastic/eui/lib/test/rtl`.
([#6737](https://github.com/elastic/eui/pull/6737))
- Updated `EuiAvatar` to support a new letter `casing` prop that allow
customizing text capitalization
([#6739](https://github.com/elastic/eui/pull/6739))
- Updated `EuiFocusTrap` to support the `gapMode` prop configuration
(now defaults to `padding`)
([#6744](https://github.com/elastic/eui/pull/6744))

**Bug fixes**

- Fixed inconsistency in `EuiSearchBar`'s AND/OR semantics between DSL
and query string generation
([#6717](https://github.com/elastic/eui/pull/6717))
- Fixed `EuiFieldNumber`'s native browser validity detection causing
extra unnecessary rerenders
([#6741](https://github.com/elastic/eui/pull/6741))
- Fixed the `scrollLock` property on `EuiFocusTrap` (and other
components using `EuiFocusTrap`, such as `EuiFlyout` and `EuiModal`) to
no longer block scrolling on nested portalled content, such as combobox
dropdowns ([#6744](https://github.com/elastic/eui/pull/6744))

**Breaking changes**

- `EuiAvatar`s with the default `user` type will now default to
capitalizing all initials in uppercase
([#6739](https://github.com/elastic/eui/pull/6739))

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-05-15 16:09:31 -05:00
Nathan Reese
b803ba9d7b
fix console errors in inspector (#156894)
Steps to view problem
* install sample data set
* Open lens visualization
* Open inspector. Notice console errors
<img width="300" alt="Screen Shot 2023-05-05 at 11 03 25 AM"
src="https://user-images.githubusercontent.com/373691/236521366-d8fb9302-e93b-4047-a0bf-d7c09dcc3ffb.png">

https://github.com/elastic/eui/pull/6566 removed `closeButtonAriaLabel`
prop from [EuiFlyout](https://elastic.github.io/eui/#/layout/flyout) EUI
75.0.0 (Effecting 8.8 and 8.9). FlyoutService spreads options into
`EuiFlyout`, resulting in `closeButtonAriaLabel` getting added to dom
and causing error.

`OverlayFlyoutOpenOptions` type added by
https://github.com/elastic/kibana/issues/37894. I replaced
`OverlayFlyoutOpenOptions` with `EuiFlyoutProps` to make it more clear
what props are accepted and provide stronger typing that stays in sync
with EUI typings

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-05-15 09:02:27 -06:00
Lisa Cawley
467681a89f
[ML] Fix insufficient license message (#156762) 2023-05-05 07:59:41 -07:00
James Gowdy
14f5b9e883
[ML] Fixing expired license redirection (#156703)
Fixes https://github.com/elastic/kibana/issues/150539

When handling route resolver errors, we now check to see if the error
was triggered by an expired license, if so we redirect to the license
management page rather than the access denied page.

This is hard to test as you need an expired license. One way to spoof
this is by editing code in the licensing plugin to inject expired
license details.

```
response.license.expiry_date_in_millis = 1683205426704;
response.license.status = 'expired';
```
Adding this below [this
line](411ff0d0ae/x-pack/plugins/licensing/server/plugin.ts (L184)).
2023-05-05 10:56:30 +01:00
James Gowdy
bc159fdea9
[ML] Fixing saved object sync in a serverless environment when apis are missing (#156585)
Temporarily fixes https://github.com/elastic/kibana/issues/156500

In a serverless environment various elasticsearch apis may be missing
depending on the project. We should allow these errors and ensure that
saved objects related to the missing api are not synced.

In the near future we should hopefully be able to determine which apis
are missing before attempting to call them.
2023-05-05 10:38:49 +01:00
Dima Arnautov
3f42de3f5f
[ML] Rename curated model type to elastic (#156684)
## Summary

Rename the `curated` model type and tag to `elastic`
2023-05-05 08:57:50 +02:00
Melissa Alvarez
22f01bfa0e
[ML] Data Frame Analytics creation wizard: ensure preview datagrid displays expected fields (#156435)
## Summary

Fixes https://github.com/elastic/kibana/issues/154009

This PR ensures the column field check for the data grid preview in DFA
uses the Data view fields.

BEFORE:

<img width="1214" alt="image"
src="https://user-images.githubusercontent.com/6446462/228678497-ffe65bf9-1b4c-4f56-bb3d-fe69ac941e62.png">

AFTER: 

<img width="1178" alt="image"
src="https://user-images.githubusercontent.com/6446462/235797816-34425648-a470-4631-b6c2-ba453f62752d.png">

### 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
- [ ] 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)
2023-05-03 11:10:47 -06:00
Walter Rafelsberger
3f52ff6fce
[ML] Transforms/DFA: Render EuiDataGrad for more than 0 rows. (#156403)
Fixes the React dev mode warning "Warning: Can't perform a React state
update on an unmounted component." by only rendering `EuiDataGrid` if
there's more than 0 rows.
2023-05-03 12:22:39 +02:00