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

[Alerting UI][License] Disable alert types in UI when the license doesn't support it. #85496

Conversation

YulNaumenko
Copy link
Contributor

@YulNaumenko YulNaumenko commented Dec 10, 2020

Current PR covers the licensing UI for the alert types.

  1. In the Alert flyouts (Create and Edit), alert types disabled by the license restriction is displayed similarly as unavailable action types in the Connector flyout:
    img
    The sort order is a bit more complicated then for action types, because we have groups of alert types by the solution.
    Current PR implements sort order by keeping the solutions alphabet order if the solution contains at least one available alert type and if all alert types under solution is disabled by the license restriction it will be sorted after the solutions with available alert types.
    Then inside the solution group we sort solution items inside by the license availability and then alphabetically by alert type name.
  2. Alerts, which has alert type belongs to the higher order license displayed disabled with explanation icon in the alerts list in Managment UI, similarly as it designed for connectors list.

Screen Shot 2020-12-09 at 10 26 24 PM

  1. User still have a possibility to delete alerts with the higher order alert type license (same as for the action types).

  2. There is a possibility to navigate to the alert details page. Should we support this?

Screen Shot 2020-12-09 at 10 39 44 PM

  1. All messages for licensing tooltips are corresponding to the action types design.

@arisonl, @alexfrancoeur please let me know if you have any objections on the current licensing implementation.

Resolve #85496

@YulNaumenko YulNaumenko requested a review from a team as a code owner December 10, 2020 00:02
@YulNaumenko YulNaumenko changed the title [Alerting UI][License] Disable alert types in UI when the license doe… [Alerting UI][License] Disable alert types in UI when the license doesn't support it. Dec 10, 2020
@YulNaumenko YulNaumenko self-assigned this Dec 10, 2020
@YulNaumenko YulNaumenko added Feature:Alerting Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) labels Dec 10, 2020
@elasticmachine
Copy link
Contributor

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

@YulNaumenko YulNaumenko added v7.11.0 v8.0.0 release_note:skip Skip the PR/issue when compiling release notes labels Dec 10, 2020
@YulNaumenko YulNaumenko requested a review from a team as a code owner December 10, 2020 06:41
@YulNaumenko YulNaumenko requested a review from kindsun December 10, 2020 06:44
Comment on lines 31 to 33
// .sort(([a], [b]) =>
// solutions ? solutions.get(a)!.localeCompare(solutions.get(b)!) : a.localeCompare(b)
// )
Copy link
Contributor

Choose a reason for hiding this comment

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

dead code

Copy link
Contributor

@gmmorris gmmorris left a comment

Choose a reason for hiding this comment

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

Works well, but I'm a little worried about the maintainability of alert_type_compare.ts.

I'd appreciate if we can rethink some of the naming in there and add unit tests around it.

alertTypeItem: AlertTypeModel;
}>
],
solutions: Map<string, string> | undefined
Copy link
Contributor

Choose a reason for hiding this comment

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

It isn't quite clear what a solution is.
Is there a more descriptive name we can use here?

Additionally, can we add some unit tests around this please?

Comment on lines 36 to 44
const alertTypeItemsA = a[1].find((alertTypeItem) => alertTypeItem.checkEnabledResult.isEnabled);
const alertTypeItemsB = b[1].find((alertTypeItem) => alertTypeItem.checkEnabledResult.isEnabled);

if (!!alertTypeItemsA && !alertTypeItemsB) {
return -1;
}
if (!alertTypeItemsA && !!alertTypeItemsB) {
return 1;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The mix of !! and ! makes this a little hard to follow... can we make this a little clearer?
A couple of suggestions that might help:

  1. Can we rename A and B to something more descriptive? Perhaps AlertTypesListA? It's common to use Left and Right rather than A and B. So perhaps LeftAlertTypesList and RightAlertTypesList?
  2. change alertTypeItemsA to a more descriptive name perhaps? Maybe enabledAlertTypeInList?
  3. perhaps, to avoid the mix of !! with !, we do something like:
 const hasEnabledAlertTypeInListA = a[1].find((alertTypeItem) => alertTypeItem.checkEnabledResult.isEnabled) != undefined;

Something like that?

Copy link
Contributor

@ymao1 ymao1 left a comment

Choose a reason for hiding this comment

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

LGTM after adding the tests that @gmmorris suggested. Works as expected.

Copy link
Contributor

@mdefazio mdefazio left a comment

Choose a reason for hiding this comment

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

Looks good. A few minor things:

  • We should have a way for the user to solve the error if they are reaching the detail view. I think if the phrase 'Please upgrade your license' is linked to the appropriate place then that solves it.

  • Ideally, I think we would show a modal warning when reaching the detail view that provides the reason for the error with the option to upgrade or delete the alert. Alternatively, we provide the context / fix for the error on the list view and not allow them to get to the detail view. As discussed, we can handle in a follow-up PR.

Copy link
Contributor

@mdefazio mdefazio left a comment

Choose a reason for hiding this comment

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

Added review comment about the tooltip/icon as discussed—Let's just wrap the name with the tooltip and remove the info icon.

@YulNaumenko YulNaumenko requested a review from mdefazio December 10, 2020 18:42
@YulNaumenko
Copy link
Contributor Author

YulNaumenko commented Dec 10, 2020

Looks good. A few minor things:

  • We should have a way for the user to solve the error if they are reaching the detail view. I think if the phrase 'Please upgrade your license' is linked to the appropriate place then that solves it.
  • Ideally, I think we would show a modal warning when reaching the detail view that provides the reason for the error with the option to upgrade or delete the alert. Alternatively, we provide the context / fix for the error on the list view and not allow them to get to the detail view. As discussed, we can handle in a follow-up PR.

I opened follow up issue on this. Currently not able to add a link to the error message text 'Please upgrade your license'. But instead of this I've added button Manage license, for the licensing Error reason, similar as we have on the connector flyout.

Screen Shot 2020-12-10 at 11 02 21 AM

Copy link
Contributor

@mdefazio mdefazio left a comment

Choose a reason for hiding this comment

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

Just a small tweak to the button style...

Copy link
Contributor

@myasonik myasonik left a comment

Choose a reason for hiding this comment

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

In the PR checklist, we have a couple a11y items in there, could you please verify them?

  • Any UI touched in this PR is usable by keyboard only (learn more about keyboard accessibility)
  • Any UI touched in this PR does not create any new axe failures (run axe in browser: FF, Chrome)

labelAppend={
hasDisabledByLicenseAlertTypes && (
<EuiTitle size="xxs">
<h5>
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure how to get all the way to this screen in the UI but an h5 strikes me as an odd choice. Do we already have an h1 - h4 on this page?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

Copy link
Contributor

@mdefazio mdefazio left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@kindsun kindsun left a comment

Choose a reason for hiding this comment

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

Geo alerts changes lgtm!

  • code review
  • tested locally in chrome

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

‼️ ERROR: no builds found for mergeBase sha [93614af]

History

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

@YulNaumenko YulNaumenko merged commit 3921475 into elastic:alerts/license-checks Dec 10, 2020
YulNaumenko added a commit that referenced this pull request Dec 15, 2020
* [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 <[email protected]>
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:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Alerting UI][License] Disable alert types in UI when the license doesn't support it.
8 participants