* first pass
* migrate more plugins
* migrate yet more plugins
* more oss plugins
* fix test file
* change Plugin signature on the client-side too
* fix test types
* migrate OSS client-side plugins
* migrate OSS client-side test plugins
* migrate xpack client-side plugins
* revert fix attempt on fleet plugin
* fix presentation start signature
* fix yet another signature
* add warnings for server-side async plugins in dev mode
* remove unused import
* fix isPromise
* Add client-side deprecations
* update migration examples
* update generated doc
* fix xpack unit tests
* nit
* (will be reverted) explicitly await for license to be ready in the auth hook
* Revert "(will be reverted) explicitly await for license to be ready in the auth hook"
This reverts commit fdf73feb
* restore await on on promise contracts
* Revert "(will be reverted) explicitly await for license to be ready in the auth hook"
This reverts commit fdf73feb
* Revert "restore await on on promise contracts"
This reverts commit c5f2fe51
* add delay before starting tests in FTR
* update deprecation ts doc
* add explicit contract for monitoring setup
* migrate monitoring plugin to sync
* change plugin timeout to 10sec
* use delay instead of silence
* add helptext to of expressions
* Make helptext optional as a prop for of expressions
* Add help text to metric threshold alert form
* Add test for helptext in of expression
* Accept JSX elements as helptext in of expressions
* Remove usage of useEuiI18n and use FormattedMessage component for translations
* Follow writing guidelines and fix typo
* Update translation keys
* Update documentation link
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Adding dropdown for selecting different connector of same type
* Updating design
* Cleanup and i18n
* Adding functiional test
* Fixing unit test
* Fixing functional test
* Updating design
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Adding es query alert type to server with commented out executor
* Adding skeleton es query alert to client with JSON editor. Pulled out index popoover into component for reuse between index threshold and es query alert types
* Implementing alert executor that performs query and matches condition against doc count
* Added tests for server side alert type
* Updated alert executor to de-duplicate matches and create instance for every document if threshold is not defined
* Moving more index popover code out of index threshold and es query expression components
* Ability to remove threshold condition from es query alert
* Validation tests
* Adding ability to test out query. Need to add error handling and it looks ugly
* Fixing bug with creating alert with threshold and i18n
* wip
* Fixing tests
* Simplifying executor logic to only handle threshold and store hits in action context
* Adding functional test for es query alert
* Types
* Adding functional test for query testing
* Fixing unit test
* Adding link to ES docs. Cleaning up logger statements
* Adding docs
* Updating docs based on feedback
* PR fixes
* Using ES client typings
* Fixing unit test
* Fixing copy based on comments
* Fixing copy based on comments
* Fixing bug in index select popover
* Fixing unit tests
* Making track_total_hits configurable
* Fixing functional test
* PR fixes
* Added unit test
* Removing unused import
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* [Alerts][Actions] Changed isESOUsingEphemeralEncryptionKey determination. Set ESO plugin as an optional dependancy for actions and alerts plugins.
* fixed faling typechecks
* fixed faling typechecks
* fixed health framework status message
* fixed due to comments
* fixed faling test
* changed approach
* fixed due to comments
* fixed due to comments
* fixed tests
* fixed tests
* fixed tests
* fixed wrong commit
* fixed lang issue
* Fixed to remove eso check
* Fixed tests
* Fixed due to comments.
* add refresh button to alerts list
* add refresh button to Alerts Details Page
* fix: add EuiFlexItem tag
* add tests for refresh button in alerts_list and alert_details
* fix: add test for requestRefresh and loadAlerts
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Making kibanaFeatures an optional parameter and catching error on plugin start
* Gracefully handle 404 errors when no access to features endpoint
* Adding functional test
* Showing all broken connectors and updating all matching broken connectors on new connector create
* Adding unit test
* Adding functional test
* Fixing functional test
* Simplifying logic
* Fixing functional test
* Fixing functional test
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Alert and Connector flyouts Save and Save&Test buttons should be active by default.
* fixed typechecks
* fixed typechecks
* refactored repeted code
* fixed typechecks
* fixed typechecks
* fixed typechecks
* fixed due to comments
* fixed failing tests
* fixed due to comments
* fixed due to comments
* fixed due to comments
* fixed typescript checks
This PR tightens the typing on the Alerting framework's `AlertType` and its deeper typing around `AlertServices ` and `AlertExecutorOptions`.
This ensures the following:
1. It's now impossible<sup>✴</sup> to schedule actions on any ActionGroup other than the groups specified on the AlertType (including the Recovery group)
2. It's now impossible<sup>✴</sup> to schedule actions with incorrect `InstanceState` or `InstanceContext`
✴ Unless they bypass the Typescript typing, which is an explicit choice to bypass type safety
This PR makes the `actionParamsFields` field required, as it is in use by all plugins anyway and only tests were omitting it.
To make this change more streamlined I've added a `createMockActionTypeModel` helper which generates a basic mock `ActionTypeModel`.
This PR encourages type safe usage of the Alerting framework by replacing the current default Params/State/InstanceState/InstanceContext types (which are `AlertTypeParams`/`AlertTypeState`/etc.) with `never`.
This means that code can continue to omit the specific types for these fields, as long as they aren't referenced.
Once an alert developer wishes to actually reference the parameters (or state/context), then they have to specify the type.
This PR also changed the typing of the `AlertTypeParams` and `AlertTypeState` from `Record<string, any>` to `Record<string, unknown>`, to ensure that where these catch-all types are used they will at least enforce `unknown` rather than `any`.
This change broke some usage in both @elastic/kibana-alerting-services plugins, but also other plugins in the Stack/Solutions. I tried to fix these where I could, but some of these require new types and refactoring in other teams' code, which I decided is best done by the team who own and maintain that code - I've added explicit `TODO` comments in all of these places, describing the required fix.
This PR also introduced a Generics based typing for the `Alert` type so that the `params` field can be typed as something other than `AlertTypeParams`.
* Removed a possibility to define two different names for Alert types on API and UI level
* fixed typechecks
* fixed typechecks
* fixed due to comments
* fixed typechecks
* fixed jest tests
* fixed typechecks
* Creating shared loading spinner component
* Using section loading component where it makes sense
* Fixing tests
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* [Alerts][License] Define minimum license required for each alert type (#84997)
* Define minimum license required for each alert type
* fixed typechecks
* fixed tests
* fixed tests
* fixed due to comments
* fixed due to comments
* removed file
* removed casting to LicenseType
* [Alerts][License] Add license checks to alerts HTTP APIs and execution (#85223)
* [Alerts][License] Add license checks to alerts HTTP APIs and execution
* fixed typechecks
* resolved conflicts
* resolved conflicts
* added router tests
* fixed typechecks
* added license check support for alert task running
* fixed typechecks
* added integration tests
* fixed due to comments
* fixed due to comments
* fixed tests
* fixed typechecks
* [Alerting UI][License] Disable alert types in UI when the license doesn't support it. (#85496)
* [Alerting UI][License] Disable alert types in UI when the license doesn't support it.
* fixed typechecks
* added licensing for alert list and details page
* fixed multy select menu
* fixed due to comments
* fixed due to comments
* fixed due to comments
* fixed typechecks
* fixed license error message
* fixed license error message
* fixed typechecks
* fixed license error message
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* plugged Task Manager lifecycle into status reactively
* fixed tests
* Revert "fixed tests"
This reverts commit e9f2cd05bd.
* made action group fields optional
* revert deletion
* again
* extracted action type for mto its own component
* extracted more sections of the action form to their own components
* updated icon
* added docs
* fixed always firing alert
* fixed export of components
* fixed react warning
* Adding flag for notifying on state change
* Updating logic in task runner
* Starting to update tests
* Adding tests
* Fixing types check
* Tests and types
* Tests
* Tests
* Tests
* Tests
* Tests
* Renaming field to a more descriptive name. Adding migrations
* Renaming field to a more descriptive name. Adding migrations
* Fixing tests
* Type check and tests
* Moving schedule and notify interval to bottom of flyout. Implementing dropdown from mockup in new component
* Changing boolean flag to enum type and updating in triggers_actions_ui
* Changing boolean flag to enum type and updating in alerts plugin
* Fixing types check
* Fixing monitoring jest tests
* Changing last references to old variable names
* Moving form inputs back to the top
* Renaming to alert_notify_when
* Updating functional tests
* Adding new functional test for notifyWhen onActionGroupChange
* Updating wording
* Incorporating action subgroups into logic
* PR fixes
* Updating functional test
* Fixing types check
* Changing default throttle interval to hour
* Fixing types check
Co-authored-by: Gidi Meir Morris <github@gidi.io>
* Adding disabled action groups to action type definition
* Adding tests
* Adding tests
* renamed Resolved to Recovered
* fixed missing import
* fixed buggy default message behaviour
* added missing test
* fixed typing
* fixed resolved in tests
* allows alert types to specify their own custom recovery group name
* removed unnecesery field on always fires
* allows alert types to specify their own custom recovery group
* fixed mock alert types throughout unit tests
* fixed typing issues
* reduce repetition of mock data
* fixed alert type list test
* support legacy event log alert recovery syntax
* added doc
* removed unneeded change in jira
* correct callback name in siem
* renamed resolved to recovered
* fixed mistaken rename
* Moving to alert plugin
* Updating tests
* elvated default params to alert concern instead of actions concern
* made default params optional
* Adding test
* Moving where default action params are retrieved
* Revert "Moving where default action params are retrieved"
This reverts commit 76e7608229.
* Moving where default action params are retrieved
* Cleanup
* Fixing test
* PR fixes
Co-authored-by: Gidi Meir Morris <github@gidi.io>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Update widths on columns
* Add custom class for truncation fix
* Use euiTruncate mixin and shrink column width of status column
* Update imports to fix checks
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
In this PR we introduce a new `recoveryActionGroup` field on AlertTypes which allows an implementor to specify a custom action group which the framework will use when an alert instance goes from _active_ to _inactive_.
By default all alert types will use the existing `RecoveryActionGroup`, but when `recoveryActionGroup` is specified, this group is used instead.
This is applied across the UI, event log and underlying object model, rather than just being a label change.
To support this we also introduced the `alertActionGroupName` message variable which is the human readable version of existing `alertActionGroup` variable.
Reapplies the #84123 PR:
This PR changes the default term from “Resolved” to “Recovered”, as it fits most use cases and we feel users are most likely to understand its meaning across domains.
This PR changes the default term from “Resolved” to “Recovered”, as it fits most use cases and we feel users are most likely to understand its meaning across domains.
This PR addresses some weird UX we've identified with default values in Action Params components and their inferred defaults when placed inside of an Alerts flyout.
Key changes:
1. Typing of these components has been corrected to reflect that we expect these parameters to only be _partial_, as the form is used to set these values (for example, the `message` field of the Server Log action, might or might not be set, so it should be nullable, but in the typing we treated it as the _final_ valid state, which is message not being nullable).
2. When a default message is set by the params components, the are tracked against the value of the default, which means that if the default changes, then so will the value in the field. Custom values provided by the user will not be overridden when the default changes. This has to be handled by the component itself at the moment (hopefully in the future we can make this a concern of the flyout and not each component).
3. The concept of the "Recovered" action group has been removed from these components - that's an Alerting concern, not actions, and shouldn't appear in the action components' code.
* Replaced AppContextProvider introduced by the plugin with KibanaContextProvider
* Removed unused files
* Fixed jest test
* Removed ActionsConnectorContext
* exposed addConnectorFlyout and editConnectorFlyouts as a plugin start result
* removed rest of unused connectors context
* fixed capabilities
* fixed jest tests
* fixed jest tests
* fixed jest tests
* fixed uptime
* fixed typecheck errors
* fixed typechecks
* fixed jest tests
* fixed type
* fixed uptime settings by pathing the correct plugin dependancy
* fixed security detection rules
* fixed due to commetns
* fixed jest tests
* fixed type check
* removed orig files
* fixed cases UI issues
* fixed due to comments
* fixed due to comments
* fixed kibana crash
* fixed es-lint
This PR wraps the components injected by Alert Type and Action in `EuiErrorBoundary` components, which ensures you can still edit the Alert and other Actions when these components fail.
* Added default dedupKey value as an {{alertInstanceId}} to provide grouping functionality for PagerDuty incidents. Set default savedObjectId as {{alertInstanceId}} for ServiceNow, Resilient and Jira
* fixed comment
* fixed due to comments
* fixed doc
* fixed due to comments
This PR adds two components to aid in creating a uniform UI for specifying the conditions for Action Groups:
1. `AlertConditions`: A component that generates a container which renders custom component for each Action Group which has had its _conditions_ specified.
2. `AlertConditionsGroup`: A component that provides a unified container for the Action Group with its name and a button for resetting its condition.
This can be used by any Alert Type to easily create the UI for adding action groups with whichever UI is specific to their component.
resolves: https://github.com/elastic/kibana/issues/67389
Adds new variables to the existing set of variables that can be used in mustache templates to be used in action parameters when creating alerts.
- `alertActionGroup` - the action group associated with the alert scheduling actions
- `date` - the current date, in ISO format
* update deps
* update rules
use type-aware @typescript-eslint/no-shadow instead of no-shadow. do not use no-undef, rely on TypeScript instead
* fix or mute all lint errors
* react-hooks eslint plugin fails on ? syntax
* fix wrong typings in viz
* remove React as a global type
* fix eslint errors
* update version to 4.8.1
* fix a new error
Jest tests are currently organized into main configuration files (src/dev/jest/config.js and x-pack/dev-tools/jest/create_jest_config.js). Both of these are similar, but very slightly due to previously being in separate repositories. This change consolidates the scripts referenced in those configs and moves them to the `@kbn/test` project.
OSS contained an alias for `test_utils`. Those aliases have been removed in favor of importing these utilities from `@kbn/test/jest`
Blocker to #72569
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
This PR includes the following refactors:
1. Moves the Index Pattern Api from _Stack Alerts_ to the _Server_ plugin of _Trigger Actions UI_. This fixes a potential bug where a user could disable the _Stack Alerts_ plugin and inadvertently break the UI of the _ES Index _ action type.
2. Extracts the UI components for _Index Threshold_ and _Geo Threshold_ from the _Trigger Actions UI_ plugin and moves them into _Stack Alerts_.
* Update layout to rows for alert types
* Fix gutter usage
* Update heading, remove icons
* Non-working update to the combo box
* Add incorrect updates with questions to fix
* Fix combo box
* Cleanup changes to specific to this module
* fixed type checks and made combobox always visible
* Added groups by producer
* Added get producer name from kibana features names
* Added search bar with list of alert types
* Added search support functionality
* fixed links to alert type
* added alert type title
* Fixed failing tests
* Design updates to list
* Remove unsed items in import list
* fixed merge issue
* Fixed due to comments
* fixed tests
* Design fixes
Co-authored-by: Yuliia Naumenko <yuliia.naumenko@elastic.com>
* resolves https://github.com/elastic/kibana/issues/78148
Adds a `defaultActionMessage` to the index threshold alert, so that the `message` parameter for actions will be pre-filled with a useful message
Adds a `RunsWhen` field to actions in the Alerts Flyout when creating / editing an Alert which allows the user to assign specific actions to a certain Action Groups
* Implemented Alerting health status pusher by using task manager and status pooler for Kibana status plugins 'kibanahost/api/status'
* Exposed health task registration to alerts plugin
* Fixed type error
* Extended health API endpoint with info about decryption failures, added correct health task implementation
* adjusted query
* Tested locally and got it working as expected, fixed tests and type check
* Added unit tests
* Changed AlertExecutionStatusErrorReasons to be enum
* Uppercase the enum
* Replaced string values to enum
* Fixed types
* Extended AlertsClient with getHealth method
* added return type to healthStatus$
* Added configurable health check interval and timestamps
* Extended update core status interval to 5mins
* Fixed failing tests
* Registered alerts config
* Fixed date for ok health state
* fixed jest test
* fixed task state
* Fixed due to comments, moved getHealth to a plugin level
* fixed type checks
* Added sorting to the latest Ok state last update
* adjusted error queries
* Fixed jest tests
* removed unused
* fixed type check
* Adding action group id to event log. Showing action group as part of status in alert details view
* Simplifying getting action group id
* Cleanup
* Adding unit tests
* Updating functional tests
* Updating test
* Fix types check
* Updating test
* PR fixes
* PR fixes
* Init connector
* Add test
* Improve comment type
* Add integration tests
* Fix i18n
* Improve tests
* Show unknown when username is null
* Improve comment type
* Pass connector to case client
* Improve type after PR #82125
* Add comment migration test
* Fix integration tests
* Fix reporter on table
* Create case connector ui
* Add connector to README
* Improve casting on executor
* Translate name
* Improve test
* Create comment type enum
* Fix type
* Fix i18n
* Move README to cases
* Filter out case connector from alerting
Co-authored-by: Mike Côté <mikecote@users.noreply.github.com>
Co-authored-by: Mike Côté <mikecote@users.noreply.github.com>
* wip
* wip
* Adding aggregation option to find function and using those results in UI
* Requesting aggregations from client instead of hard-coding in route
* alert_api test
* i18n fix
* Adding functional test
* Adding unit test for filters
* Splitting into two API endpoints
* Fixing test
* Fixing test
* Adding comment
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
We've had several bugs over the past few months due to flyouts retaining state between renders.
This ensure we remove these flyouts entirely in between usage to avoid such issues recurring.
* Adding hasAuth to server and client
* Adding migration and fixing tests
* Fixing test
* Adding spacing
* Adding functional test
* Fixing migration
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Added functional test for alerts list filters by status, alert type and action type. Did a code refactoring and splitting for alerts tests.
* -
* fixed failing tests
* fixed type checks
* minor naming fixes
* Adding hasAuth to server and client
* Adding migration and fixing tests
* Fixing test
* Adding spacing
* Adding functional test
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* wip
* Adding health context provider and option to block waiting for health check
* Adding tests
* Removing forced lag
* Fixing action form not rendering pre selected action
* PR fixes
* Updating i18n ids
Co-authored-by: Mike Côté <mikecote@users.noreply.github.com>
* Applying i18n fix
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Mike Côté <mikecote@users.noreply.github.com>