Commit graph

132 commits

Author SHA1 Message Date
ymao1 f3d7d37294
[Alerting] Allow user to select existing connector of same type when fixing broken connector (#89062)
* 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>
2021-02-02 07:58:02 -05:00
ymao1 049135192e
[Alerting] Search alert (#88528)
* 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>
2021-01-29 07:45:00 -05:00
Patrick Mueller 14fa82dc54
[alerts] adds support for index threshold index param string type (#88540)
resolves https://github.com/elastic/kibana/issues/68575

The index threshold alert defines an `index` parameter which is
typed as `string | string[]`.  However the UI for this alert has
been typing it as only `string[]`.

This PR changes the UI to work with an incoming string value for
this parameter.  If the parameter is edited in the UI, it will always
be set as an array, even if there is only one element.
2021-01-25 16:43:46 -05:00
Gidi Meir Morris dfd96d62c4
ebsure we always select the correct index (#88876)
At times we find the driver controlling the ComboBox in our UI tests can select the wrong item, this ensures we always select the correct index in the Connector tests.
2021-01-21 12:09:19 +00:00
Tiago Costa 55d4331a2b
skip flaky suite (#88796) 2021-01-20 13:27:37 +00:00
ymao1 6d1c010607
[Alerting] Fixing broken Alerts view when no Global All Kibana privilege (#88727)
* Making kibanaFeatures an optional parameter and catching error on plugin start

* Gracefully handle 404 errors when no access to features endpoint

* Adding functional test
2021-01-19 18:14:56 -05:00
spalger 3953f9647e skip flaky suite (#88177) 2021-01-13 08:38:41 -07:00
ymao1 2c8b518f69
Fixes Failing test: Chrome X-Pack UI Functional Tests.x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/alerts_list·ts - Actions and Triggers app alerts list should display total alerts by status and error banner only when exists alerts with status error (#88119)
* Unskipping test

* Adding refresh before checking status
2021-01-13 08:01:08 -05:00
ymao1 666af32be4
[Alerting] Showing confirmation modal on Alert Add/Edit when flyout closed without saving and changes made. (#86370)
* Adding hasChanged check and showing confirmation modal if something has changed

* Showing confirmation always on close

* Adding functional test

* Setting name and tags for APM alerts using initial values instead of setAlertProperty

* Checking for alert param changes separately

* Checking for alert param changes separately

* Fixing functional test

* Resetting initial alert params on alert type change

* Fixing duplicate import

* Cloning edited alert

* PR fixes

* PR fixes

* Updating modal wording

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-01-11 16:16:10 -05:00
Tyler Smalley 91d73cf981 skip flaky suite (#87105) 2021-01-07 15:32:01 -08:00
ymao1 ff2d0f4659
[Alerting] Edit alert should show and update all actions with deleted connectors (#86838)
* 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>
2021-01-06 15:11:28 -05:00
Gidi Meir Morris b99ca969e0
[Alerting] revert the revert of Enforces typing of Alert's ActionGroups (#87382)
The https://github.com/elastic/kibana/pull/86761 PR was reverted due to a small typing issue.

This PR reverts that revert and adds a commit to address the issue: 9e4ab2002c.
2021-01-06 10:38:33 +00:00
Yuliia Naumenko dddd8e4fe7
[Alerting UI] Alert and Connector flyouts Save and Save&Test buttons should be active by default. (#86708)
* 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
2021-01-05 11:49:44 -08:00
Jonathan Budzenski 051be28c69 Revert "[Alerting] Enforces typing of Alert's ActionGroups (#86761)"
This reverts commit 76b8c491ee.
2021-01-05 13:24:59 -06:00
Gidi Meir Morris 76b8c491ee
[Alerting] Enforces typing of Alert's ActionGroups (#86761)
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
2021-01-05 18:44:57 +00:00
Yuliia Naumenko 9d12b1c71b
Flaky test fix for Actions and Triggers app alerts should delete all selection (#86175)
* Removed skip test for delete all alerts integration test

* fixed typechecks

* reduced nuber of selected alert to delete to a single one

* fixed due to comments

* removed long timing retry

* fixed typechecks

* fixed failing tests
2021-01-05 10:10:52 -08:00
ymao1 b22210d7e3
[Alerting] Saved object remover for all e2e triggers_actions_ui tests (#86837)
* wip

* Using object remover for alerts list

* wip - using supertest instead of axios

* wip - using supertest instead of axios

* Removing custom services in favor of supertest

* Fixing test

* Fixing test

* Fixing types check

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-01-04 09:59:41 -05:00
Gidi Meir Morris 2db76660ce
[Alerting] Encourage type safe usage of Alerting (#86623)
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`.
2020-12-21 19:17:04 +00:00
Yuliia Naumenko 396018fd4d
Removed a possibility to define two different names for Alert types on API and UI level. (#86236)
* 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
2020-12-20 08:52:54 -08:00
ymao1 7933f0458c
Fixes Failing test: Chrome X-Pack UI Functional Tests.x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/alert_create_flyout·ts - Actions and Triggers app create alert should show save confirmation before creating alert with no actions (#85623)
* Unskipping test

* Using simpler alert type during test

* Fixing test

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-16 14:04:21 -05:00
Yuliia Naumenko 37525f80a0
License checks for alerts plugin (#85649)
* [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>
2020-12-14 19:29:39 -08:00
Jonathan Budzenski eee237baff skip 'alerts should delete all selection' #77401 2020-12-14 16:10:56 -06:00
ymao1 ab082647ac
[Actions] Notify only on action group change (#82969)
* 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>
2020-12-10 15:51:52 -05:00
Tiago Costa 60b96d6e1d
skip flaky suite (#85105) 2020-12-10 13:54:14 +00:00
Shahzad 2a8c609bf9
[Uptime]Refactor header and action menu (#83779)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-09 12:45:40 +01:00
Gidi Meir Morris 249a1a41aa
[Alerting] Enables AlertTypes to define the custom recovery action groups (#84408)
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.
2020-12-04 13:54:48 +00:00
ymao1 82abb05722
[Alerting UI] Updating defaultActionMessage for Index Threshold Alert (#83934)
* Renaming function to conditions

* Making comparators human readable. Tests

* i18n fix

* Fixing tests

* Fixing tests

* i18n fix

* PR comments
2020-11-23 16:02:06 -05:00
ymao1 a2598ea711
Fixes Failing test: Chrome X-Pack UI Functional Tests.x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details·ts - Actions and Triggers app Alert Details Alert Instances renders the active alert instances (#83478)
* Unskipping test

* Unskipping test

* Making action group name lookup dynamic

* Removing comment

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-20 07:58:49 -05:00
Patrick Mueller f83e06f718
[alerts] adds action group and date to mustache template variables for actions (#83195)
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
2020-11-19 12:01:44 -05:00
Dhruv Bodani c78cf35ba8
Added defaultActionMessage to index threshold alert UI type definition (#80936)
* 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
2020-11-09 08:35:05 -05:00
Tiago Costa d1ef0d6704
skip flaky suite (#57426) 2020-11-09 13:11:51 +00:00
Gidi Meir Morris 3c525d7341
[Alerting] adds an Run When field in the alert flyout to assign the action to an Action Group (#82472)
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
2020-11-09 12:56:56 +00:00
ymao1 dae28519e6
[Alerting] Display Action Group in Alert Details (#82645)
* 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
2020-11-06 07:28:08 -05:00
Mike Côté 1ecd12cdf3
Add description and documentation link in alert flyout (#81526)
* Add description and documentation URL in alert flyout

* Add unit tests

* Fix type check

* Add horizontal rule

* Design fixes

* Fix uptime alert link

* Fix uptime urls

* Add anchor tag

* Fix jest test failures

* Fix monitoring links
2020-11-05 19:50:50 -05:00
Mike Côté eb43158bdd
Add descriptions to alert types (#81850)
* Initial attempt at adding descriptions to alert types

* Fix typecheck failures

* Fix i18n check

* Fix failing jest test

* Fix i18n check again

* Apply changes for Uptime

* Update x-pack/plugins/apm/public/components/alerting/register_apm_alerts.ts

Co-authored-by: Casper Hübertz <casper@formgeist.com>

* Update x-pack/plugins/apm/public/components/alerting/register_apm_alerts.ts

Co-authored-by: Casper Hübertz <casper@formgeist.com>

* Fix jest test

* Update geo threshold description

* Update description of some alert types based on feedback from Gail

* Update description of some alert types based on feedback from Gail

* Fix i18n

* Fix i18n

* Fix ESLint

* Update some copy

* Update uptime alert description

* Fix typos

Co-authored-by: Casper Hübertz <casper@formgeist.com>
2020-11-03 14:09:41 -05:00
Tiago Costa 0eeaafa722
chore(NA): move into single pkg json (#80015)
* chore(NA): update gitignore to include first changes from moving into a single package.json

* chore(NA): update gitignore

* chore(NA): move all the dependencies into the single package.json and apply changes to bootstrap

* chore(NA): fix types problems after the single package json

* chore(NA): include code to find the dependencies used across the code

* chore(NA): introduce pure lockfile for install dependencies on build

* chore(NA): update clean task to not delete anything from xpack node_modules

* chore(NA): update gitignore to remove development temporary rules

* chore(NA): update notice file

* chore(NA): update jest snapshots

* chore(NA): fix whitelisted licenses to include a new specify form of an already included one

* chore(NA): remove check lockfile symlinks from child projects

* chore(NA): fix eslint and add missing declared deps on single pkg json

* chore(NA): correctly update notice

* chore(NA): fix failing jest test for storyshots.test.tsx

* chore(NA): fix cypress multi reporter path

* chore(NA): fix Project tests check

* chore(NA): fix problem with logic to detect used dependes on oss build

* chore(NA): include correct x-pack plugins dep discovery

* chore(NA): discover entries under dynamic requires on vis_type_timelion

* chore(NA): remove canvas

* test(NA): fix jest unit tests

* chore(NA): remove double react declaration from storyshot test file

* chore(NA): try removing isOSS check

* chore(NA): support for plugin development

* chore(NA): update logic to fix unit tests and typechecking

* chore(NA): support to run npm scripts in child kbn projects across all envs

* chore(NA): support github checks reporter on x-pack and remove cpy types as the package correctly provides them

* chore(NA): update cpy version

* chore(NA): include last kbn pm changes

* chore(NA): update style on build_production_projects.ts

* chore(NA): remove any cast fom telemetry opt in stats

* chore(NA): remove del and re-use rm -rf again

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-02 21:18:52 +00:00
Yuliia Naumenko bb51156c5c
[Alerting UI] Grouped list of alert types using producers in Types filter of Alerts tab (#81876)
* Grouped list of alert types using producers in Types filter of Alerts tab

* Added e2e test

* fixed deps for test utils
2020-10-30 14:46:48 -07:00
ymao1 d6b006ff2f
[Alerting UI] Removing beta labels (#81919)
* Removing beta labels

* i18n fix

* Fixing test
2020-10-29 07:40:18 -04:00
Yuliia Naumenko 313c026853
Added functional test for alerts list filters by status, alert type and action type. Did a code refactoring and splitting for alerts tests. (#81422)
* 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
2020-10-27 08:39:47 -07:00
Søren Louv-Jansen 35e21dbf37
[Alerting] Improve toast when alert is created (#80327) 2020-10-20 16:20:30 +02:00
Yuliia Naumenko ea7c255ed1
Fixed alerts ui test timeout issue, related to the multiple server calls for delete all alerts, by reducing the number of alerts to the two and increasing retry timeout. (#81067) 2020-10-19 17:18:44 -07:00
ymao1 3704b1d301
[Actions] Back Button on Add Connector Flyout (#80160)
* Adding back button to add connector flyout

* Adding tests

* Adding tests

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-10-16 13:15:47 -04:00
ymao1 7b00052c5b
[Alerting] Prompt for confirmation when saving alert with no action (#79892)
* Adding save confirmation for new alerts with no associated actions

* Adding functional tests

* Fixing uptime alert test

* Fixing uptime alert test

* PR fixes

* Updating confirmation modal wording

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-10-13 07:36:53 -04:00
Yuliia Naumenko 4996020087
[Alerting UI] Fixed flaky alerting e2e tests (#79533)
* Removed skip on alerting e2e tests

* Reduced alerting tests execution time by removing page reload for each test. Added server side cleanup fo each test with createAlert. Removed long waiting toast method for reduce flakiness.

* Added additional cleanup and retry method for delete single alert
2020-10-06 14:11:05 -07:00
Saravanan Selvamohan 663175c8c4
Change plugin id for triggers_actions_ui to triggersActionsUi (#78555)
* Rename triggers_actions_ui plugin id to triggersActionsUi

* Rename triggers_actions_ui plugin id to triggersActionsUi

* Removed disable linting line

* ran docs generation script

* Fixed type check issue

* FIxed eslint error

Co-authored-by: Yuliia Naumenko <yuliia.naumenko@elastic.com>
2020-10-05 14:17:06 -07:00
Gidi Meir Morris 727d62611b
[Actions] fixes error in UI in the Edit Flyout for PreConfigured Connectors (#78994)
Ensures only User Configured Connectors can be validated and edited by the UI to avoid these kinds of errors in the future.
2020-10-01 14:24:10 +01:00
spalger 886ad8504b skip flaky suite (#77401) 2020-09-30 15:37:31 -07:00
Shahzad 2fbf9b947a
[Uptime] Ml anomaly alert edit (#76909)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-09-29 12:23:39 +02:00
Yuliia Naumenko 12153a436a
Removed delete confirmation timeout to avoid flaky failing because deletion to be a little slower on CI (#77963)
* Removed delete confirmation timeout to avoid flaky failing because deletion to be a little slower on CI

* Changed delete flow to close confim dialog immediately and set data to the loading state
2020-09-23 09:41:35 -07:00
Gidi Meir Morris 41a7f1a1c2
[Actions] adds a Test Connector tab in the Connectors list (#77365)
Adds a tab in the _Edit Alert_ flyout which allows the user to _test_ their connector by executing it using an example action. The execution relies on the connector being updated, so is only enabled when there are no saved changes in the Connector form itself.
2020-09-22 11:18:33 +01:00