* [ML] Refactor in preparation for new es client
* removing commented out code
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* handle group id in url for anomaly detection
* filter analytics list by group id.
* handle list of groupIds
* ensure analytics can handle jobid in url. rename util function
* add tests for getSelectedIdFromUrl and getGroupQueryText
* keep groupIds as array of strings and jobId as single string
* fix tests and update types
* Rename kibana_breadcrumbs to kibana_chrome
- in anticipation of upcoming refactor where SetPageChrome now handles document title as well as Kibana breadcrumbs
+ cleanup exports
* Add generate_title helpers
- will be used by new set_chrome helper
* Add setDocTitle context + behavior to set_chrome
+ refactor set_chrome.test.tsx:
- add title tests
- add SetWorkplaceSearchChrome test to increase coverage
- clean up inner/outer call in favor of simpler mocks/imports
- simplify isRoot tests
* Update plugins to set product titles
- on mount but before render
* Copy feedback - change pipe separator to hyphen
- to match ' - Elastic'
* Add functional tests confirming that document titles updated
* Allow prerelease in version
* Adding integration test for prerelease version of a package
* Tests for invalid package key
* Removing inter-test dependency
- Better distinction and relationship between IndexPatternField and its spec
- IndexPatternField class is no longer defined via object mutation
- Reduction of dependencies
- UI code moved into Index Pattern class (will be removed in next ticket)
- IndexPattern field list was previously composed of IndexPatternFields or specs, now only IndexPatternFields
- IndexPattern field list was previously redefined when loading fields, now only its contents are replaced.
* Change the way the resolver simulator works
* refactor resolver tree and data access layer mocks
* Fix bug where timestamp and pid sometimes don't show in the node detail view
* add a few tests for the panel (not done, but worth committing.)
## Summary
Using the `formatErrors` util would result in duplicate error messages sometimes. Was noticing this in particular when using union types, where the type validation would check every item in a union and report an error for each one. This resulted in large, repeating errors.
Used `uniq` to filter out duplicates. Updated unit tests.
The analytics job page in the Kibana management section didn't have the context provided by React Router and Kibana's own history object so the page crashed on load. The context is necessary to construct the correct URLs to navigate to the ML plugin itself.
This PR fixes it by wrapping the management page in <Router history={history} />. Also adds functional tests to cover navigating to the jobs list pages in stack management.
Fixes#71461 regression since 7.7
New state syncing utils didn't properly handle errors,
Errors happening during URL parsing or writing wasn't handled, so state syncing could stop or in worth case blow out. (see #71461)
There are not much scenarios where missing proper error handling could really impact users, except the one described in #71461:
Kibana users state:storeInSessionStorage
Users often intuitively share hashed dashboard urls directly
When someone opens those urls - there is a blank screen with warning
In 7.6 - dashboard would still load with default state.
Since 7.7 these still could be achieved by removing query params for URL, but it is not obvious for regular users.
This PR makes sure that behaviour is similar to one we had before 7.7.
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
All mappings in Elasticsearch support arrays. They can also return null values or be missing. For example, a `keyword` mapping could return `null` or `[null]` or `[]` or `'hi'`, or `['hi', 'there']`. We need to handle these cases in order to avoid throwing an error.
Specific and nuanced handling of these cases isn't the goal of this PR. This PR just introduces some helper types that can be used to assist you in writing defensive code.
When dealing with an value that comes from ES, wrap the underlying type in `ECSField`. For example, if you have a `keyword` or `text` value coming from ES, cast it to `ECSField<string>`.
### Added New Resolver specific types
`ResolverEvent` has a new safe equivalent `SafeResolverEvent`. The constituent parts of `ResolverEvent` also have safe equivalents: `SafeEndpointEvent` and `SafeLegacyEndpointEvent`. Use these in your code for added type safety.
### New safe event methods
The event methods accept the unsafe `ResolverEvent`. Create new methods that accept the safe `SafeResolverEvent`. By keeping copies of both methods around we can gradually transition to the safe versions:
* `isLegacyEvent` has `isLegacyEventSafeVersion`
* `eventTimestamp` has `timestampSafeVersion`
* `eventName` has `processNameSafeVersion`
* `eventId` has `eventIDSafeVersion`
* `entityId` has `entityIDSafeVersion`
* `parentEntityId` has `parentEntityIDSafeVersion`