* Add separate io-ts types for endpoint exception entries
* Fix text typos
* Fix test
* address review comments
* Add extra entry validation when adding items to endpoint_list
* fix test
* fix tests again
* really actually fix the tests
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
In APM:
* Fix stories crashing with errors
* Hide some additional prop tables
* Fix node severites story to show correct node severites
* Fix Service Map Popover story
* Use knobs on sync badge story
In Observability:
* Remove an extra stray paren in decorators
There's additional refactoring and fixes that can be done but this just gets everything in working order.
* Set up App Search routes constants file
* Create new helper/generator for external URLs
* Update plugin to pass externalUrl helper in KibanaContext
* Update AS & WS navs to use new external url generator
* Update App Search views to use new externalUrl.getAppSearchUrl helper
* Update Workplace Search to use externalUrl.getWorkplaceSearchUrl helper
+ remove old useRoutes.getWSRoute helper, which was the inspiration for this
* Rename top-level enterpriseSearchUrl to config.host
- This allows us to more clearly separate concerns between the URL set in config.host and externalUrl.enterpriseSearchUrl (used for front-end links, may be a vanity/public URL)
- This change also enables us to not mutate Kibana's config obj, which is much cleaner
Misc tech debt:
- Reorder renderApp args (from least to most likely to change)
- Rename our public url methods/vars to more generic "init data" names - this is in preparation for upcoming changes where we pull more than just external_url from our client endpoint
* Fix broken Workplace Search nav links
- that require a hash for routing to work
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Drilldowns now support trigger picker. It allows to create a drilldown and specify which trigger it should be attached to.
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Handles the case where two operations for the same entity make it into a single batched bulk operation and avoid the clashing ID issue that could cause the poller to hang and stop poling for work).
* Added proxy support for action types
* Fixed tests
* added rejectUnauthorizedCertificates config setting
* removed slack not used code
* Fixed Slack proxy
* fixed typecheck errors
* Cleanup code
* Fixed slack
* Added unit tests
* added proxy server for test
* Fixed build
* Added functional tests
* fixed due to comments
* Fixed tests and some changes due to comments
* Fixed functional tests
* fixed circular deps
* Added proxy unit test to action type
Our tests shouldn't rely on the DOM structure of Resolver (when its arbitrary) because that will make them brittle. If the user doesn't care about the DOM structure, then neither should our tests.
Note: sometimes the user does care about the DOM structure, and in those cases the tests should as well.
* Add routes
* Add version for use in doc link
* Set up basic router layout + WorkplaceSearchNav
* Update views to account for Layout
* Move version to common folder
* Fix version path
* Remove product button
No longer needed since we have all top-level app links in Kibana as a part of this PR
* You know, for search
* Remove comment
* Remove unused i18n properties from JSON
Tests were failing after removing component:
https://kibana-ci.elastic.co/job/elastic+kibana+pipeline-pull-request/67797/execution/node/382/log/
* Revert button and i18n copy removal
This reverts commit ba0535187e.
* Move Overview out of layout to hide nav
For now, the route for groups was added to avoid having comment out the code. Will add the groups component in a future PR
* Revert layout changes to Overview
Since there is no nav, the padding was missing and the view looked off. Reverting to the 7.9, centered column view
* Remove extra Overview component
Was causing tests to fail
* Revert error state to use EuiPage
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This replaces the use of the old graphql-based `useSource` hook with the new plain JSON `useLogSource` hook.
It also fixes two more problems:
- A rendering problem with the source configuration loading screen and a `setState` race condition in the `useLogSource` hook.
- A non-backwards-compatible change of the `/link-to/:sourceId/logs` route in #61162.
* Initial work
* Expand generic support to alert instances
* Convert index threshold to use generics
* Make fixture alert types use generics
* Make alert instance related types use unknown
* Fix typecheck failures
* Cleanup + add instance generic support to registry.get API
* Shallow clone
* Rename some TS variables
* Fix failing api integration tests
* Change code for easier review and keep more history
* Fix
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* _cluster/state/metadata/* and added a comment to function
* add another comment regarding why we are asking for *
* update jest test
* refactor and clean up use of cluster status to get index state
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* Adding api test for custom link transaction example
* expecting specific fields
* expecting specific fields
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
The app can show more than 1 Resolver at a time. Each instance has a unique ID called the `resolverComponentInstanceID`.
When the user interacts with Resolver it will add values to the query string. The query string values will contain the `resolverComponentInstanceID`. This allows each Resolver to keep its state separate. When resolver unmounts it will remove any query string values related to it.
If Resolver's `resolverComponentInstanceID` changes it should remove query string values related to the old instance ID. It does not. This PR fixes that.
Note: I don't know if it was possible for this bug to actually happen. I can't make it happen, but depending on how Resolver is mounted by its consumers it *could*
* [Reporting] Update more Server Types for TaskManager
* remove some task manager references
* more strict
* more strict 2
* simplify
* fix test
* fix test
* routing validation unused types cleanup
* remove more casting in route handlers
* feedback changes
* original comment was fine
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* First few processors of the first batch
- Also refactored options to live in scoped objects to avoid
overriding type (important fix!)
- Have not polished copy or form layout.
* add type to shared imports
* Refactors for repeated fields and added forms
- date_index_name
- dissect
- dot_expander
- drop
Fields refactored:
- Field
- Ignore missing
* Fix broken imports and some other small refactors
* added text editor field and updated pattern and if fields
* Large copy improvements and updates and other small refactors
- Added help text for all fields
- Updated layout so that required fields are always on first
- Replaced circle radio group with a select drop down
* update circle shape type field to select
* Added "long" option for convert type
* fix path import
* fix types and i18n
* add validation for dot expander fix append value to be a combobox
* fix i18n
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Fixes flaky tests in Task Manager and Alerting.
The fix in #73244 was correct, but it missed an edge case which causes the already running task to be rescheduled over and over.
This prevents that edge case which was effecting both TM in general and Alerting specifically.
## Summary
This is the basics of end to end tests, so there could be a lot more, but this ties to cover the basics of the tests.
Test with:
```ts
node scripts/functional_tests --config x-pack/test/lists_api_integration/security_and_spaces/config.ts
```
Adds these tests for the route counter parts:
* create_exception_list_items.ts
* create_exception_lists.ts
* delete_exception_list_items.ts
* delete_exception_lists.ts
* find_exception_list_items.ts
* find_exception_lists.ts
* read_exception_list_items.ts
* read_exception_lists.ts
* update_exception_list_items.ts
* update_exception_lists.ts
Fixes a few minor strings, other tests, but no large bugs found with these tests
### 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
## Summary
Addresses https://github.com/elastic/kibana/issues/73567.
ML Users (role: `machine_learning_user`) were previously able to invoke the ML Recognizer API, which we use to get not-yet-installed ML Jobs relevant to our index patterns. As of https://github.com/elastic/kibana/pull/64662 this is not true, and so we receive errors from components using the underlying hook, `useSiemJobs`.
To solve this I've created two separate hooks to replace `useSiemJobs`:
* `useSecurityJobs`
* used on ML Popover
* includes uninstalled ML Jobs
* checks (and returns) `isMlAdmin` before fetching data
* `useInstalledSecurityJobs`
* used on ML Jobs Dropdown and Anomalies Table
* includes only installed ML Jobs
* checks (and returns) `isMlUser` before fetching data
Note that we while we now receive the knowledge to do so, we do not always inform the user in the case of invalid permissions, and instead have the following behaviors:
#### User has insufficient license
* ML Popover: shows an upgrade CTA
* Anomalies Tables: show no data
* Rule Creation: ML Rule option is disabled, shows upgrade CTA
* Rule Details: ML Job Id is displayed as text
#### User is ML User
* ML Popover: not shown
* Anomalies Tables: show no data
* Rule Creation: ML Rule option is disabled
* Rule Details: ML Job Id is displayed as text
#### User is ML Admin
* ML Popover: shown
* Anomalies Tables: show data __for installed ML Jobs__
* This is the same as previous logic, but worth calling out that you can't view historical anomalies
* Rule Creation: ML Rule option is enabled, all ML Jobs available
* Rule Details: ML Job Id is displayed as hyperlink, job status badge shown
### Checklist
- [x] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios
### For maintainers
- [ ] This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)
* Migrated last pieces of legacy fixture code
* Implemented own server for webhook simulator
* Fixed type checks. Moved slack simulator to own server
* close server after tests run
* Fixed due to comments
* fixed failing tests
* Add basic layout/sidebar blocking
- note: we should *not* set left: 0 / top: 0 etc., as this can interfere with Kibana's existing UI (e.g. docked navigation, telemetry callout)
* Add sidebar styles + static links
* Refactor SideNav to be a reusable component
- So that Workplace Search can reuse the same layout but pass in their own custom nav
+ Refactor AppSearch to use Layout in router
* Refactor all views to account for in-router Layout
* Fix root redirects not working as expected
- If enterpriseSearchUrl hasn't been set, all pages should redirect to SetupGuide, not just root
- The engines redirect simply wasn't working at all - it would always show a blank page when '/' was clicked in the Kibana breadcrumbs. Not sure if this is a Kibana issue - had to change to a component load to fix
+ Simplify index.test.tsx (probably unreasonable and not super helpful to add assertions for each new route)
* Implement active styling for links
* Fix failing location tests
- By adding a new useLocation mock
+ add SideNavLink active class test
TODO: I should probably rename react_router_history.mock to just react_router.mock
* Add responsive toggle + styling
* Add navigation accessibility attributes/controls
* [Feedback] Update mobile UX to close menu on link click/navigation
- This requires updating our EUI/React Router components to accept and run custom onClick events
- Also requires adding a new ReactContext to pass down closeNavigation, but that's not too onerous thanks to useContext
* pass originatingApp into App
* save and return top nav option
* clean up
* navigate to originating app
* functional test
* tslint
* cutOriginatingAppConnection
* add functional test for cutting originating app flow
* one more fix for cutting originator app and another functional test to verify
* typo
* review feedback
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* [Reporting] Fix and test for Listing of Reports
* add sleeps
* await selector instead of sleep
* reduce changes
* cleanup after csv generated
* fix snapshot
### Improved the simulator.
* Replace `mapStateTransitions` with `map`. The usage and interface are the same, but `map` is not dependent on redux state. This will work for parts of the app that don't use redux (aka EUI). `map` also forces any `AutoSizer` instances used by EUI to show their full contents. `AutoSizer` works but it doesn't behave as expected in JSDOM. With this hack in place, we can bypass `AutoSizer`. Going forward, we should make sure to use something other than `EuiSelectable` for the dropdowns
* Removed the `connectEnzymeWrapperAndStore` test helper. The new `map` simulator method doesn't rely on redux so we no longer need this explicit sync.
* The simulator can receive a memory history instance. This allows tests to pass in a precreated / controlled memory instance. Useful for testing the query string. This design is not final. Instead we could have an 'intiialHistorySearch' parameter that sets the query string on instantiation as well as 'pushHistory' and 'replaceHistory' methods?
* `findInDom` is now called `domNodes`.
* `processNodeElementLooksSelected` and `processNodeElementLooksUnselected` are gone. Instead use `selectedProcessNode` and `unselectedProcessNode` to find the wrappers and assert that they wrappers contain the nodes you are interested in.
* Added `processNodeSubmenu` method that gets the submenu that comes up when you click the events button on a process node.
* Added `nodeListElement` method. This returns the list of nodes that shows up in the panel. Name is not final.
* Added `nodeListItems` method. This returns the list item elements in the node list. Name is not final.
* Added `nodeListNodeLinks` method. This returns the links in the items in the node list. Name is not final.
* Added `nodeDetailElement` method. This gets the element that contains details about a node. Name is not final.
* Added `nodeDetailBreadcrumbNodeListLink` method. Returns the link rendered in the breadcrumbs of the node detail view. Takes the user to the node list. Name is not final.
* Added `nodeDetailViewTitle` method. This returns the title of the node detail view. Name is not final.
* Added `nodeDetailDescriptionListEntries` method. This returns an entries list of the details in the node detail view. Name is not final
* Added `resolveWrapper` method. Pass this a function that returns a `ReactWrapper`. The method will evaluate the returned wrapper after each event loop and return it once it isn't empty.
### Improved our mocks
* We had a DataAccessLayer and ResolverTree mock named 'one_ancestor_two_children` that actually had no ancestors. Renamed them to `no_ancestors_two_children`.
* New DataAccessLayer mock called `noAncestorsTwoChildrenWithRelatedEventsOnOrigin`
### Added new 'clickthrough' suite test
* Added new test in the 'clickthrough' suite that asserts that a user can click the 'related events' button on a node and see the list of related event categories in the submenu.
### Improved the Resolver event model
* Added `timestampAsDateSafeVersion` to the event model. This gets a `Date` object for the timestamp. (We still need make it clear that this model is ResolverSpecific)
### New `urlSearch` test helper.
Use `urlSearch` when testing Resolver's interaction with the browser location. It calculates the expected 'search' value based on some Resolver specific parameters.
* Use this to calculate a URL and then populate the memory history with this URL. This will allow you to see if Resolver loads correctly based on the URL state.
* Use this to calculate the expected URL based on Resolver's current state.
### Added new 'panel' test
* If Resolver is loaded with a url search parameter that selects a node, the node's details are shown in the panel.
* When a history.push occurs that sets a search parameter that selects a node, the details of that node are shown.
* Check that the url search is updated when the user interacts with the panel
* Check that the panel shows the correct details for a node. (except for the timestamp. See TODO)
### Changed `data-test-subj`s
* Removed `resolver:panel`. This was used on a wrapper element that we expect to remove soon.
* Added `resolver:node-detail:breadcrumbs:node-list-link` for the buttons in the breadcrumb in the panel.
* Added `resolver:node-detail:title` for the title element in the node detail view.
* Added `resolver:node-detail:entry-title` and `resolver:node-detail:entry-description` for the details shown about a process in the node detail view.
* Added `resolver:node-list:node-link`. This is the link shown for each node in the node list.
* added `resolver:node-list:item` to each list item in the node list view.
### Removed dead code
* `map.tsx` wasn't being used. It was renamed but the old version wasn't deleted.
### Improved the node detail view
* Show the timestamp for a node's process event even if the timestamp is the unix epoch. Note: this is technically a bug fix but the bug is very obscure.
* Show the PID for a node's process event when the PID is 0. Note: this is a bug fix.
* [Lens] Add styling options for x axis on the settings popover
* ts related changes
* Changes to the popover's design and y-axis implementatin
* fix types and add unit tests
* Add extra translations
* Fix functional test and change the logic of the yTitle
* fixes
* fix showTitle settings bug
* Fix ticklabels bug on y axes
* fix some tests
* Change the user flow on x and y titles on settings popover and enable the gridlines by default
* disable linter warning
* PR Comments
* Add a comment to callback to explain the decision to listen only to open changes
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* [Maps] add initial location option that fits to data bounds
* update navigation_panel snapshot
* add functional test to ensure sync is called when auto fit to bounds with no data
* add functional test for auto fit to bounds on map load
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
## Summary
Adds initial set of end to end tests for lists
You can run all of these with the command from kibana root:
```ts
node scripts/functional_tests --config x-pack/test/lists_api_integration/security_and_spaces/config.ts
```
Fixes a few minor bugs found such as...
* Validation for importing lists was not checking if the indexes were created first
* Some wording for the error messages had duplicate words within them
### Checklist
- [x] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios
Introduces a pluggable API to Event Log which allows custom Providers for Saved Objects which is used to ensure a user is authorised to get the Saved Object referenced in the Event Log whenever the find api is called.
- Introduce `indexPattern.fields.getAll()` and use where possible
- Rename `index_patterns/fields/fields.mocks.ts.ts => index_patterns/fields/fields.mocks.ts`
- FieldSpec - make `count` and `scripted` fields optional
- use `indexPattern.fields.getByName` instead of filter where possible
* wip on fixing processor names
* added comment
* fix Jest test element selector
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* [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
* 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`
Our jobs summary call returns all installed jobs regardless of group;
passing groups as jobIds does not perform group filtering.
This adds a helper predicate function on which to filter these results,
and updates tests accordingly.
* add edit analytics functional test
* adds edit test service
* update edit test wording for clarity
* check flyout closes after edit
* rename testSubj for consitency
Many changes went into the registry and the packages recently. This is updating to the most recent version of the registry distribution currently in production.
Co-authored-by: Sonja Krause-Harder <sonja.krause-harder@elastic.co>
* i18n refactor
- DRY out plugin details to constants and correctly i18n-ize front-end-facing strings
* DRY out new i18n constants
- refactor instances of i18n.translate to use new constants
* Fix non-i18n'd breadcrumb strings
* PR feedback: swap out more plugin ID strings for constants
This PR addresses two issues which caused several tests to be flaky in TM.
When `runNow` was introduced to TM we added a pinned query which returned specific tasks by ID.
This query does not have the filter applied to it which causes task to return when they're already marked as `running` but we didn't address these correctly which caused flakyness in the tests.
This didn't cause a broken beahviour, but it did cause beahviour that was hard to reason about - we now address them correctly.
It seems that sometimes, especially if the ES queue is overworked, it can take some time for the update to the underlying task to be visible (we don't user `refresh:true` on purpose), so adding a wait for the index to refresh to make sure the task is updated in time for the next stage of the test.
## Summary
- updates the builder nested entries so that the children do not display the parent path - so instead of `parent.child` it just shows `child`
- updates the builder to fix overflow issue
* [Ingest Manager] Adjust dataset aggs to use datastream fields instead
Elastic Agent and Elasticsearch are switching over from using dataset.* to datastream.*. This adjust the aggregation on the dataset page to get the datastreams.
For this to work properly, the most recent version of Elasticsearch 7.9 must be used and is pending updates on all the packages to ship also the datastream fields, see https://github.com/elastic/integrations/pull/213
* Update datastream to data_stream
* Update data stream name generation
* Fix typo
* Temporarily use datastream instead of data_stream
* updating to use `data_stream` instead of `datastream`
Co-authored-by: ruflin <spam@ruflin.com>
Co-authored-by: Jen Huang <its.jenetic@gmail.com>
## Summary
Fixes an issue where the `Severity Override` would not match for the `Elastic Endpoint Security` rule. This is a temporary fix until we can provide more robust comparisons between the user provided `severityMapping.value` (string) and the `severityMapping.field`'s type.
### Checklist
- [x] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios
### Summary
- Updates logic for deleting exception item entries in the builder - found that there was a bug in deleting nested entries
- Adds more unit tests
* Fixed Alert details does not update page title and breadcrumb
* Added alert name to details breadcrumb as a dynamic title
* Update x-pack/plugins/triggers_actions_ui/public/application/lib/breadcrumb.ts
Co-authored-by: Mike Côté <mikecote@users.noreply.github.com>
Co-authored-by: Mike Côté <mikecote@users.noreply.github.com>
* Ensure setup mode works on cloud but only for alerts
* Update snapshot
* Update translations
* Restructure tests to understand the failure better
* PR feedback
* Backwards, whoops
* Remove commented out code
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>