Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow registered alert types to be non-editable #65606

Merged
merged 20 commits into from
May 12, 2020

Conversation

YulNaumenko
Copy link
Contributor

@YulNaumenko YulNaumenko commented May 7, 2020

Resolve #65549

In the scope of this PR:

  1. Extended UI AlertTypeModel with the additional property: isEditable (boolean). isEditable property is responsible for displaying Edit button on alert details page.
  2. Extended server API AlertType with producer string property, which correcpond to the application owner of the alert type.
  3. Changed Create Alert flyout behavior to display alert type select options based on the equality of the alert consumer and alert type producer. If the alert consumer is alerting Create Alert flyout display all alert types (not depends on the producer value) with isEditable setting true. If alert consumer is some other plugin(application), Create Alert flyout display only alert types with the same producer value.
    This changes should handle mixing up alert types between plugins and hide alert types which is not ready to be created/edited from Alert Management UI.

@YulNaumenko YulNaumenko added Feature:Alerting v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v7.8.0 labels May 7, 2020
@YulNaumenko YulNaumenko requested review from a team as code owners May 7, 2020 05:48
@YulNaumenko YulNaumenko self-assigned this May 7, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-alerting-services (Team:Alerting Services)

@botelastic botelastic bot added Team:APM All issues that need APM UI Team support Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability labels May 7, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui (Team:apm)

@elasticmachine
Copy link
Contributor

Pinging @elastic/uptime (Team:uptime)

Copy link
Member

@dgieselaar dgieselaar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @YulNaumenko! Thank you for getting a fix ready so quick 😀

…le-edit

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
Copy link
Contributor

@justinkambic justinkambic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for Uptime.

For summary, I reviewed the Uptime code changes and when running this patch locally, I created two Uptime alerts (TLS and monitor status) and attempted to edit them, the UI didn't allow for it. 👍

image

…mer can display other consumers alert types, but in case if it isEditable
Copy link
Contributor

@phillipb phillipb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics changes look good.

Copy link
Contributor

@rylnd rylnd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SIEM changes look good; I'm still able to CRUD Rule Alerts from within Detections.

I was seeing some errors when viewing Detections Rule Alerts in the Alerting UI:
Elastic

It was unclear to me whether this was related to this branch, some weird local state of mine, or neither. Regardless, I was able to enable/disable the alert from the Alerting UI, albeit with multiple of those toaster errors.

@YulNaumenko
Copy link
Contributor Author

SIEM changes look good; I'm still able to CRUD Rule Alerts from within Detections.

I was seeing some errors when viewing Detections Rule Alerts in the Alerting UI:
Elastic

It was unclear to me whether this was related to this branch, some weird local state of mine, or neither. Regardless, I was able to enable/disable the alert from the Alerting UI, albeit with multiple of those toaster errors.

@rylnd , this error message come up because siem alert types is not registered in the alerting UI registry. @mikecote are we planning to show alert details for alert types which doesn't have an alerting UI registry?

@mikecote
Copy link
Contributor

@mikecote are we planning to show alert details for alert types which doesn't have an alerting UI registry?

I would say yes unless there's some technical challenges that prevent us from supporting this today.

Copy link
Contributor

@mikecote mikecote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a few suggestions and a comment about isEditable based on our conversation.

x-pack/plugins/alerting/README.md Outdated Show resolved Hide resolved
x-pack/plugins/triggers_actions_ui/public/types.ts Outdated Show resolved Hide resolved
@@ -14,5 +14,6 @@ export function getAlertType(): AlertTypeModel {
iconClass: 'alert',
alertParamsExpression: IndexThresholdAlertTypeExpression,
validate: validateExpression,
requiresAppContext: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all the values of requiresAppContext need to be inverted now right? Since index threshold alert doesn't require app context so can be created / edited from management UIs.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@YulNaumenko YulNaumenko merged commit 5ed5fda into elastic:master May 12, 2020
YulNaumenko added a commit to YulNaumenko/kibana that referenced this pull request May 12, 2020
* Allow registered alert types to be non-editable

* Fixed isUiEditEnabled values

* Fixed due to comments

* fixed failing tests

* Enable alert type selection per alert consumer, only 'alerting' consumer can display other consumers alert types, but in case if it isEditable

* fixed tests

* Removed consumer property from the client side alert type registry and added server side property producer which purpose is to manage a feature logic

* fixed type check

* Fixed tests and type checks

* Removed error message for non registered plugins

* Fixed failing tests

* Fixed due to comments

* fixed test

* -

* revert logic for requiresAppContext

* Added close toast after saving alert
# Conflicts:
#	x-pack/plugins/triggers_actions_ui/public/types.ts
YulNaumenko added a commit to YulNaumenko/kibana that referenced this pull request May 12, 2020
* Allow registered alert types to be non-editable

* Fixed isUiEditEnabled values

* Fixed due to comments

* fixed failing tests

* Enable alert type selection per alert consumer, only 'alerting' consumer can display other consumers alert types, but in case if it isEditable

* fixed tests

* Removed consumer property from the client side alert type registry and added server side property producer which purpose is to manage a feature logic

* fixed type check

* Fixed tests and type checks

* Removed error message for non registered plugins

* Fixed failing tests

* Fixed due to comments

* fixed test

* -

* revert logic for requiresAppContext

* Added close toast after saving alert
# Conflicts:
#	x-pack/plugins/triggers_actions_ui/public/types.ts
#	x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/server/plugin.ts
YulNaumenko added a commit to YulNaumenko/kibana that referenced this pull request May 13, 2020
* Allow registered alert types to be non-editable

* Fixed isUiEditEnabled values

* Fixed due to comments

* fixed failing tests

* Enable alert type selection per alert consumer, only 'alerting' consumer can display other consumers alert types, but in case if it isEditable

* fixed tests

* Removed consumer property from the client side alert type registry and added server side property producer which purpose is to manage a feature logic

* fixed type check

* Fixed tests and type checks

* Removed error message for non registered plugins

* Fixed failing tests

* Fixed due to comments

* fixed test

* -

* revert logic for requiresAppContext

* Added close toast after saving alert
YulNaumenko added a commit that referenced this pull request May 13, 2020
* Allow registered alert types to be non-editable

* Fixed isUiEditEnabled values

* Fixed due to comments

* fixed failing tests

* Enable alert type selection per alert consumer, only 'alerting' consumer can display other consumers alert types, but in case if it isEditable

* fixed tests

* Removed consumer property from the client side alert type registry and added server side property producer which purpose is to manage a feature logic

* fixed type check

* Fixed tests and type checks

* Removed error message for non registered plugins

* Fixed failing tests

* Fixed due to comments

* fixed test

* -

* revert logic for requiresAppContext

* Added close toast after saving alert
YulNaumenko added a commit to YulNaumenko/kibana that referenced this pull request May 13, 2020
* Allow registered alert types to be non-editable

* Fixed isUiEditEnabled values

* Fixed due to comments

* fixed failing tests

* Enable alert type selection per alert consumer, only 'alerting' consumer can display other consumers alert types, but in case if it isEditable

* fixed tests

* Removed consumer property from the client side alert type registry and added server side property producer which purpose is to manage a feature logic

* fixed type check

* Fixed tests and type checks

* Removed error message for non registered plugins

* Fixed failing tests

* Fixed due to comments

* fixed test

* -

* revert logic for requiresAppContext

* Added close toast after saving alert
# Conflicts:
#	x-pack/plugins/triggers_actions_ui/public/types.ts
#	x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/server/plugin.ts
YulNaumenko added a commit that referenced this pull request May 14, 2020
* Allow registered alert types to be non-editable (#65606)

* Allow registered alert types to be non-editable

* Fixed isUiEditEnabled values

* Fixed due to comments

* fixed failing tests

* Enable alert type selection per alert consumer, only 'alerting' consumer can display other consumers alert types, but in case if it isEditable

* fixed tests

* Removed consumer property from the client side alert type registry and added server side property producer which purpose is to manage a feature logic

* fixed type check

* Fixed tests and type checks

* Removed error message for non registered plugins

* Fixed failing tests

* Fixed due to comments

* fixed test

* -

* revert logic for requiresAppContext

* Added close toast after saving alert
# Conflicts:
#	x-pack/plugins/triggers_actions_ui/public/types.ts
#	x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/server/plugin.ts

* Fixed merge issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Alerting release_note:skip Skip the PR/issue when compiling release notes Team:APM All issues that need APM UI Team support Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v7.8.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow registered alert types to be non-editable