* Use modern mount context in Dev Tools and Console, and clean up plugin definitions of Grok Debugger, Search Profiler, and Painless Lab.
* Remove return value from Console lifecycle method.
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* Refactor generator for ancestry support
* Adding optional ancestry array
* Fixing tests and type errors
* Removing useAncestry field
* Fixing test
* An empty array will be returned because that's how ES will do it too
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* Add wrapper function to make an AbortSignal arg optional
Components commonly do not care about aborting a request, but are
required to pass `{ signal: new AbortController().signal }` anyway. This
addresses that use case.
* Adds hook for retrieving the component's mount status
This is useful for dealing with asynchronous tasks that may complete
after the invoking component has been unmounted. Using this hook,
callbacks can determine whether they're currently unmounted, i.e.
whether it's safe to set state or not.
* Add our own implemetation of useAsync
This does not suffer from the Typescript issues that the react-use
implementation had, and is generally a cleaner hook than useAsyncTask as
it makes no assumptions about the underlying function.
* Update exported Lists API hooks to use useAsync and withOptionalSignal
Removes the now-unused useAsyncTask as well.
* Add some JSDoc for our new functions
* add _meta field to index templates
* fix typescript issue
* make package an object
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* refactor: 💡 rename folder to "explore_data"
* style: 💄 check for "share" plugin in more semantic way
"explore data" actions use Discover URL generator, which is registered
in "share" plugin, which is optional plugin, so we check for its
existance, because otherwise URL generator is not available.
* refactor: 💡 move KibanaURL to a separate file
* feat: 🎸 add "Explore underlying data" in-chart action
* fix: 🐛 fix imports after refactor
* feat: 🎸 add start.filtersFromContext to embeddable plugin
* feat: 🎸 add type checkers to data plugin
* feat: 🎸 better handle empty filters in Discover URL generator
* feat: 🎸 implement .getUrl() method of explore data in-chart act
* feat: 🎸 add embeddable.filtersAndTimeRangeFromContext()
* feat: 🎸 improve getUrl() method of explore data action
* test: 💍 update test mock
* fix possible stale hashHistory.location in discover
* style: 💄 ensureHashHistoryLocation -> syncHistoryLocations
* docs: ✏️ update autogenerated docs
* test: 💍 add in-chart "Explore underlying data" unit tests
* test: 💍 add in-chart "Explore underlying data" functional tests
* test: 💍 clean-up custom time range after panel action tests
* chore: 🤖 fix embeddable plugin mocks
* chore: 🤖 fix another mock
* test: 💍 add support for new action to pie chart service
* feat: 🎸 enable "Explore underlying data" action for Lens vis
* test: 💍 make tests green again
* refactor: 💡 rename trigger contexts
* chore: 🤖 fix TypeScript errors
Co-authored-by: Anton Dosov <anton.dosov@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* remove unused piece of state
* Move related event total calculation to selector
* rename xScale
* remove `let`
* Move `dispatch` call out of HTTP try-catch
* add POC logic to modify the 'from' param in the search
* fixes formatting for appending gap diff to from
* computes new max signals based on how many intervals of rule runs were missed when gap in consecutive rule runs is detected
* adds logging, fixes bug where we could end up with negative values for diff, adds calculatedFrom to the search after query
* remove console.log and for some reason two eslint disables were added so i removed one of them
* rename variables, add test based on log message - need to figure out a better way to test this
* remove unused import
* fully re-worked the algorithm for searching discrete time periods, still need search_after because a user could submit a rule with a custom maxSignals so that would still serve a purpose. This needs heavy refactoring though, and tests.
* updated loop to include maxSignals per time interval tuple, this way we guarantee maxSignals per full rule interval. Needs some refactoring though.
* move logic into utils function, utils function still needs refactoring
* adds unit tests and cleans up new util function for determining time intervals for searching to occur
* more code cleanup
* remove more logging statements
* fix type errors
* updates unit tests and fixes bug where search result would return 0 hits but we were accessing property on non-existent hit item
* fix rebase conflict
* fixes a bug where a negative gap could exist if a rule ran before the lookback time, also fixes a bug where the search and bulk loop would return false when successful.
* gap is a duration, not a number.
* remove logging variable
* remove logging function from test
* fix type import from rebase with master
* updates missed test when rebased with master, removes unused import
* modify log statements to include meta information for logged rule events, adds tests
* remove unnecessary ts-ignores
* indentation on stringify
* adds a test to ensure we are parsing the elapsed time correctly
* Switches mount callbacks to only use start deps
Fixes#58014
* Sets up skeleton logs data fetchers for overview
* Fixes type hacks for logs fetcher
* Prevent kibana from crashing on initial load
* Fixes types and linting errors
* Fixes some linting import/export issues
Co-authored-by: Alejandro Fernández Gómez <alejandro.fernandez@elastic.co>
Fixes a race condition where the ML plugin would be mounted before receiving its first license information update and thus redirecting to a fallback page (Kibana Home, Space-Chooser or Data Visualizer page depending on the setup).
* ts-ignore --> ts-expect-error
* fix error with mutable array
* fix errors in consumers code
* update SOM
* fix FeatureConfig & Feature compatibility
* do not re-export from code. it breaks built version
* update docs
* add eslint rule for platform team code
* remove test. this is covered by ts-expect-error in unit tests
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
## Summary
* Moves querying and tests from server to common
The function we are interested using on the front end is:
```ts
export const getQueryFilter = (
query: Query,
language: Language,
filters: Array<Partial<Filter>>,
index: Index,
lists: ExceptionListItemSchema[]
) => {
```
### 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
* Add pure API functions and react hooks for value list APIs
This also adds a generic hook, useAsyncTask, that wraps an async
function to provide basic utilities:
* loading state
* error state
* abort/cancel function
* Fix type errors in hook tests
These were not caught locally as I was accidentally running typescript
without the full project.
* Document current limitations of useAsyncTask
* Defines a new validation function that returns an Either instead of a tuple
This allows callers to further leverage fp-ts functions as needed.
* Remove duplicated copyright comment
* WIP: Perform request/response validations in the FP style
* leverages new validateEither fn which returns an Either
* constructs a pipeline that:
* validates the payload
* performs the API call
* validates the response
and short-circuits if any of those produce a Left value.
It then converts the Either into a promise that either rejects with the
Left or resolves with the Right.
* Adds helper function to convert a TaskEither back to a Promise
This cleans up our validation pipeline considerably.
* Adds request/response validations to findLists
* refactors private API functions to accept the encoded request schema
(i.e. snake cased)
* refactors validateEither to use `schema.validate` instead of
`schema.decode` since we don't actually want the decoded value, we just
want to verify that it'll be able to be decoded on the backend.
* Refactor our API types
* Add request/response validation to import/export functions
* Fix type errors
* Continue to export decoded types without a qualifier
* pull types used by hooks from their new location
* Fix errors with usage of act()
* Attempting to reduce plugin bundle size
By pulling from the module directly instead of an index, we can
hopefully narrow down our dependencies until tree-shaking does this for
us.
* useAsyncFn's initiator does not return a promise
Rather than returning a promise and requiring the caller to handle a
rejection, we instead return nothing and require the user to watch the
hook's state.
* success can be handled with a useEffect on state.result
* errors can be handled with a useEffect on state.error
* Fix failing test
Assertion count wasn't updated following interface changes; we've now
got two inline expectations so this isn't needed.
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* Works-ish
* Load the default view without throwing error
* Design feedback
* Update Saved Views design on Metrics explorer
* Fix types
* UX improvements when saving and editng
* Only load default view if there is no state from anywhere else.
* Add loading indicator and other polish
* Hide saved view menu when opening modals
* Fix typecheck
* Fix typo
* Fix translations
* using test_user with limited read permission to search profiler test
* gitcheck
* search profiler test using test_user
* using limited roles and privileges for CCR
* changed the global ccr role kibana section to be consistent with other roles with no feature controls
* removed canvas role
* changes to include pagination for 100 rows
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* Update EPM package registry typings to reflect registry changes
* Change `dataset.id` references to `dataset.name`
* Fix RegistryStream
* Fix packageToConfigDatasourceInputs service
* Fix assignPackageStream service
* Fix validateDatasource service
* Fix configure data source components
* Fix variable
* Fix stream template installation
* Add support for `input[].dataset.type` and change `stream.dataset` mapping to be object containing `name` with instead of just a string
* Nest package information under `meta` in agent config yaml
* Move `dataset.type` to stream level instead of input level
* Make single call to fetch registry package information instead of doing it per stream
* Fix type issues
* Update endpoint test assertion
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* [ui-shared-deps] include styled-components
* update snapshots caused by react-is upgrade
* fix jest snapshots
* declare react-is dep in x-pack too so it uses the right version
Co-authored-by: spalger <spalger@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* fixes 'sets and reads the url state for timeline by id' test
* fixes merge issue
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* refactor: 💡 rename folder to "explore_data"
* style: 💄 check for "share" plugin in more semantic way
"explore data" actions use Discover URL generator, which is registered
in "share" plugin, which is optional plugin, so we check for its
existance, because otherwise URL generator is not available.
* refactor: 💡 move KibanaURL to a separate file
* feat: 🎸 add "Explore underlying data" in-chart action
* fix: 🐛 fix imports after refactor
* feat: 🎸 add start.filtersFromContext to embeddable plugin
* feat: 🎸 add type checkers to data plugin
* feat: 🎸 better handle empty filters in Discover URL generator
* feat: 🎸 implement .getUrl() method of explore data in-chart act
* feat: 🎸 add embeddable.filtersAndTimeRangeFromContext()
* feat: 🎸 improve getUrl() method of explore data action
* test: 💍 update test mock
* fix possible stale hashHistory.location in discover
* style: 💄 ensureHashHistoryLocation -> syncHistoryLocations
* docs: ✏️ update autogenerated docs
* test: 💍 add in-chart "Explore underlying data" unit tests
* test: 💍 add in-chart "Explore underlying data" functional tests
* test: 💍 clean-up custom time range after panel action tests
* chore: 🤖 fix embeddable plugin mocks
* chore: 🤖 fix another mock
* test: 💍 add support for new action to pie chart service
* feat: 🎸 add kibana.yml to disable in-chart "explore data" actio
Co-authored-by: Anton Dosov <anton.dosov@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* move last snapshot to inline
* move legacy files to legacy subfolder
* move request types out of legacy
* export Headers from http instead of elasticsearch
* renaming - first pass
* renaming - second pass
* fix core mocks
* adapt new calls
* update generated doc
* fix IT test mocks
* fix new usages
* Update Canvas Plugin documentation
* Small fix
* Update x-pack/plugins/canvas/README.md
Co-authored-by: Clint Andrew Hall <clint@clintandrewhall.com>
* Update x-pack/plugins/canvas/README.md
Co-authored-by: Clint Andrew Hall <clint@clintandrewhall.com>
* Update x-pack/plugins/canvas/README.md
Co-authored-by: Clint Andrew Hall <clint@clintandrewhall.com>
* Update x-pack/plugins/canvas/README.md
Co-authored-by: Clint Andrew Hall <clint@clintandrewhall.com>
* Update x-pack/plugins/canvas/README.md
Co-authored-by: Clint Andrew Hall <clint@clintandrewhall.com>
* Update x-pack/plugins/canvas/README.md
Co-authored-by: Clint Andrew Hall <clint@clintandrewhall.com>
* Update x-pack/plugins/canvas/README.md
Co-authored-by: Clint Andrew Hall <clint@clintandrewhall.com>
* Update x-pack/plugins/canvas/README.md
Co-authored-by: Clint Andrew Hall <clint@clintandrewhall.com>
* Update x-pack/plugins/canvas/README.md
Co-authored-by: Clint Andrew Hall <clint@clintandrewhall.com>
Co-authored-by: Clint Andrew Hall <clint@clintandrewhall.com>
* rollover data stream when index template mappings are not compatible
* update error messages
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* Partially disable test files.
* Use DockerServers in EPM tests.
* Only run tests when DockerServers have been set up
* Reenable ingest manager API integration tests
* Pass new test_packages to registry container
* Enable DockerServers tests in CI.
* Correctly serve filetest package for file tests.
* Add helper to skip test and log warning.
* Reenable further file tests.
* Add developer documentation about Docker in Kibana CI.
* Document use of yarn test:ftr
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* [APM] Use licensing from context
We added the usage of `featureUsage.notifyUsage` from the licensing plugin in #69455.
This required us to use `getStartServices to add `licensing` to `context.plugins`.
In #69838 `featureUsage` was added to `context.licensing`, so we don't need to add it to `context.plugins`.
## [Security] `Investigate in Resolver` Timeline Integration
This PR adds a new `Investigate in Resolver` action to the Timeline, and all timeline-based views, including:
- Timeline
- Alert list (i.e. Signals)
- Hosts > Events
- Hosts > External alerts
- Network > External alerts
![investigate-in-resolver-action](https://user-images.githubusercontent.com/4459398/85886173-c40d1c80-b7a2-11ea-8011-0221fef95d51.png)
### Resolver Overlay
When the `Investigate in Resolver` action is clicked, Resolver is displayed in an overlay over the events. The screenshot below has placeholder text where Resolver will be rendered:
![resolver-overlay](https://user-images.githubusercontent.com/4459398/85886309-10f0f300-b7a3-11ea-95cb-0117207e4890.png)
The Resolver overlay is closed by clicking the `< Back to events` button shown in the screenshot above.
The state of the timeline is restored when the overlay is closed. The scroll position (within the events), any expanded events, etc, will appear exactly as they were before the Resolver overlay was displayed.
### Case Integration
Users may link directly to a Timeline Resolver view from cases via the `Attach to new case` and `Attach to existing case...` actions show in the screenshot below:
![case-integration](https://user-images.githubusercontent.com/4459398/85886773-e3587980-b7a3-11ea-87b6-b098ea14bc5f.png)
![investigate-in-resolver](https://user-images.githubusercontent.com/4459398/85885618-daff3f00-b7a1-11ea-9356-2e8a1291f213.gif)
When users click the link in a case, Timeline will automatically open to the Resolver view in the link.
### URL State
Users can directly share Resolver views (in saved Timelines) with other users by copying the Kibana URL to the clipboard when Resolver is open.
When another user pastes the URL in their browser, Timeline will automatically open and display the Resolver view in the URL.
### Enabling the `Investigate in Resolver` action
In this PR, the `Investigate in Resolver` action is only enabled for events where all of the following are true:
- `agent.type` is `endpoint`
- `process.entity_id` exists
### Context passed to Resolver
The only context passed to `Resolver` is the `_id` of the event (when the user clicks `Investigate in Resolver`)
### What's next?
- @oatkiller will replace the placeholder text shown in the screenshots above with the actual call to Resolver in a separate PR
- I will follow-up this PR with additional tests
- The action text `Investigate in Resolver` may be changed in a future PR
- Hide the `Add to case` action in timeline-based views (it's currently visible, but disabled)
* hide timeline on Management pages
* adjust managment page view styles
* Added additional tests for validating no timeline button on management views
* centralize API Path responses and reuse across some tests
* Fix state being reset incorrectly
### Summary
This PR is a follow up to #68864 . That PR used a partial to differentiate between new and existing comments, this meant that comments could be updated when they shouldn't. It was decided in our discussion of exception list schemas that comments should be append only. This PR assures that's the case, but also leaves it open to editing comments (via API). It checks to make sure that users can only update their own comments.
This pr adds convenient license support to dynamic uiActions in x-pack.
Works for actions created with action factories & drilldowns.
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* First round of UX tweaks
- Fixed potential text overflow issue on descriptions
- Removed border around text input when editing description
* Updated the on-failure pipeline description copy
* Properly encode URI component pipeline names
* use xjson editor in flyout
* also hide the test flyout if we are editing a component
* add much stronger dimming effect when in edit mode
* also added dimming effect to moving state
* remove box shadow if dimmed
* add tooltips to dropzones
* fix CITs after master merge
* fix nested rendering of processors tree
* only show the tooltip when the dropzone is unavaiable and visible
* keep white background on dim
* hide controls when moving
* fix on blur bug
* Rename variables and prefix booleans with "is"
* Remove box shadow on all nested tree items
* use classNames as it is intended to be used
* Refactor SCSS values to variables
* Added cancel move button
- also hide the description in move mode when it is empty
- update and refactor some shared sass variables
- some number of sass changes to make labels play nice in move
mode
- changed the logic to not render the buttons when in move mode
instead of display: none on them. The issue is with the tooltip
not hiding when when we change to move mode and the mouse event
"leave" does get through the tooltip element causing tooltips
to hang even though the mouse has left them.
* Fixes for monaco XJSON grammar parser and update form copy
- Monaco XJSON worker was not handling trailing whitespace
- Update copy in the processor configuration form
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* [Endpoint] use rbush to only render resolver nodes that are in view in the DOM
* Add related events code back
* Change processNodePositionsAndEdgeLineSegments selector to return a function that takes optional bounding box
* Refactor selectors to not break original, and not run as often
* Memoize rtree search selector, fix tests
* Update node styles to use style hook, update jest tests
* Fix type change issue in jest test
* redirect app/security to app/security/overview
* missing re-naming initialization
* add unit test for intialization value of indicesExists
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* refactor: 💡 rename folder to "explore_data"
* style: 💄 check for "share" plugin in more semantic way
"explore data" actions use Discover URL generator, which is registered
in "share" plugin, which is optional plugin, so we check for its
existance, because otherwise URL generator is not available.
* refactor: 💡 move KibanaURL to a separate file
* feat: 🎸 add "Explore underlying data" in-chart action
* fix: 🐛 fix imports after refactor
* feat: 🎸 add start.filtersFromContext to embeddable plugin
* feat: 🎸 add type checkers to data plugin
* feat: 🎸 better handle empty filters in Discover URL generator
* feat: 🎸 implement .getUrl() method of explore data in-chart act
* feat: 🎸 add embeddable.filtersAndTimeRangeFromContext()
* feat: 🎸 improve getUrl() method of explore data action
* test: 💍 update test mock
* fix possible stale hashHistory.location in discover
* style: 💄 ensureHashHistoryLocation -> syncHistoryLocations
* docs: ✏️ update autogenerated docs
* test: 💍 add in-chart "Explore underlying data" unit tests
* test: 💍 add in-chart "Explore underlying data" functional tests
* test: 💍 clean-up custom time range after panel action tests
* chore: 🤖 fix embeddable plugin mocks
* chore: 🤖 fix another mock
* test: 💍 add support for new action to pie chart service
Co-authored-by: Anton Dosov <anton.dosov@elastic.co>
This PR migrates all old alerts with the `alerting` consumer to have `alerts` instead.
This is because in 7.9 we changed the feature ID and we need these to remain in sync otherwise the RBAC work (https://github.com/elastic/kibana/pull/67157) will break old alerts.
* Add store class
* fix tests
* fix the createIndex bug
* add reportingstore test
* change function args
* nits
* add test for automatic index creation failure recovery
* [APM] Add callout
Showing a callout to inform the user we have detected a high cardinality in unique transaction names and enabling them how to fix it.
* Changed color and icon
* Updated copy and styling
* Check number of returned buckets
* Add translations and docs
* Update docs link
Co-authored-by: Brandon Morelli <bmorelli25@gmail.com>
* Fix tests
Co-authored-by: Casper Hübertz <casper@formgeist.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Brandon Morelli <bmorelli25@gmail.com>
Introduces migrations into Encrypted Saved Objects.
The two main changes here are:
1. The addition of a createMigration api on the EncryptedSavedObjectsPluginSetup.
2. A change in SavedObjects migration to ensure they don't block the event loop.
Relates to #69642. If the user doesn't have the appropriate privileges for the annotations index, instead of failing with a 500, we now catch the error and log a warning to the console.
* Ingest: Rename datasource Layout prop to `onCancel`
* Endpoint: Policy list - swap use of endpoint package hook for redux middleware
* Endpoint: Add tests cases for `sendGetEndpointSecurityPackage()` method
* Endpoint: add policy list store tests for new action
* Updates list entry schema, exposes exception list client, updates tests
* create new de list schema and unit tests
* updated route unit tests and types to match new list schema
* updated existing DE exceptions code so it should now work as is with updated schema
* test and types cleanup
* cleanup
* update unit test
* updates per feedback
This modifies the routes related to log rate and category analysis to use the new programmatic APIs provided by the `ml` plugin to access the results index and job info. Because that access is facilitated via the request context, the log analysis lib was converted from classes to plain functions.
At the same time the routes have been updated to use the most recent validation and error handling patterns.
* Pulls out existing ML integration from the service maps
* - removes ML job creation flyout in integrations menu on the service details UI
- removes ML searches and transforms in the transaction charts API
- removes unused shared functions and types related to the legacy ML integration
* removes unused translations for APM anomaly detection
* Adds tags to TODOs for easy searching later
* Ingest: Expose `registerExternalCallback()` method out of Ingest server `start` lifecycle
* Ingest: Add support for External Callbacks on REST `createDatasourceHandler()`
* Ingest: expose DatasourceServices to Plugin start interface
* Endpoint: Added Endpoint Ingest handler for Create Datasources
- Also moved the temporary logic from the middleware
to the handler (still temporary)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* add progress indicator to creation wizard page
* only show progress bar if job is started immediately
* add title and switch to timeout
* fix progress check
* clean up interval on unmount
* fix types
* clear interval if stats undefined. show progress if job created
* Exclude glob-only (*) index pattern from map layers
This pattern is a special case that our map should ignore, as including
it causes all indexes to be queried.
* Ignore CCS glob pattern in our embedded map
Users may have this pattern for cross-cluster search, and it should
similarly be excluded when matching Security indexes.
As security_solution continues to integrate with lists, the absents of
these types will lead to lots of implicit anys and false positives.
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* [APM] Storybook theme fixes
The changes adding theme support in #69362 broke some of the Storybook stories.
Add decorators to wrap some of the stories in the theme context.
This should be done in a global decorator, but our current storybook setup doesn't support this. It also would be nice to be able to switch between light/dark mode, but that's something we can add in the future.
* Remove unused import
* Adds missing decorator to cytoscape examples + adds a new real-world example
Co-authored-by: Oliver Gupte <olivergupte@gmail.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* Return attributes when telemetry created instead of whole saved object. Update integration test
* Change 'maps-telemetry' to 'maps'
* No need to create a saved object anymore. This is leftover from task manager telemetry mgmt
* Add test confirming attrs undefined. Change tests to check for 'maps' iso 'maps-telemetry'
* Add two more tests confirming expected telemetry shape
* Review feedback. Use TELEMETRY_TYPE constant and set to APP_ID