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] Don't wait for health check before showing Create Alert flyout #80996

Merged
merged 11 commits into from
Oct 26, 2020

Conversation

ymao1
Copy link
Contributor

@ymao1 ymao1 commented Oct 19, 2020

Resolves #77472

Summary

Added optional input prop waitForCheck to HealthCheck component to determine if it should immediately render its children or wait for the health check to complete. I thought it only made sense to use the waitForCheck override in the AlertAdd component, but I can update the other components (AlertEdit, AlertList, ActionConnectorList) if we feel like it also makes sense there.

Created a HealthContextProvider to hold the state of whether or not the health check has returned. This allows the AlertAdd component to disable the 'Save' button until the health check has completed.

Checklist

Delete any items that are not applicable to this PR.

@ymao1 ymao1 changed the title Alerting/slow alert flyout [Alerting UI] Don't wait for health check before showing Create Alert flyout Oct 19, 2020
@ymao1 ymao1 self-assigned this Oct 19, 2020
@ymao1 ymao1 added 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 labels Oct 19, 2020
@ymao1 ymao1 marked this pull request as ready for review October 19, 2020 22:53
@ymao1 ymao1 requested a review from a team as a code owner October 19, 2020 22:53
@elasticmachine
Copy link
Contributor

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

@ymao1 ymao1 requested a review from sorenlouv October 19, 2020 22:55
Copy link
Member

@sorenlouv sorenlouv left a comment

Choose a reason for hiding this comment

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

This is awesome. Thank you so much!

Copy link
Contributor

@YulNaumenko YulNaumenko left a comment

Choose a reason for hiding this comment

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

Changes LGTM! Tested it locally with adding delay to the health API route and it works as expected - flyout is loaded immediately and Save button is disabled till health check is completed.
I have a couple of nits, but it shouldn't be a blocker. Great work!

@@ -149,6 +149,10 @@ export const AlertForm = ({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

useEffect(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this changes related to the current issue? Did you want to fix something by adding it?
I suppose it can replace the default state from this line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change was to handle a pre-selected alert being passed into the alert form (as in the case of uptime alerts). Previously, there was a delay in rendering the alert form because the health check loading indicator rendered first (however briefly). That allows the pre-selected alert to render when the alert form was first rendered. With the change to show the alert form immediately in the add alert flyout, this useEffect is needed to re-render the form to show the selected alert type.

@ymao1
Copy link
Contributor Author

ymao1 commented Oct 21, 2020

@elasticmachine merge upstream

@ymao1
Copy link
Contributor Author

ymao1 commented Oct 26, 2020

@elasticmachine merge upstream

@mikecote mikecote self-requested a review October 26, 2020 14:15
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.

Changes LGTM, great work!

Regarding the waitForCheck in other areas, I think I'm good waiting and seeing if they're needed. I have a feeling there's some UX scenarios to think through (Ex: save button disabled in edit form until request completes, TLS banner displaying after a few seconds, etc).

ymao1 and others added 2 commits October 26, 2020 11:08
Co-authored-by: Mike Côté <mikecote@users.noreply.github.com>
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

@kbn/optimizer bundle module count

id before after diff
triggersActionsUi 284 286 +2

async chunks size

id before after diff
triggersActionsUi 1.5MB 1.5MB +7.9KB

History

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

@ymao1 ymao1 merged commit 7e34bf2 into elastic:master Oct 26, 2020
ymao1 added a commit to ymao1/kibana that referenced this pull request Oct 26, 2020
… flyout (elastic#80996)

* 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>
ymao1 added a commit that referenced this pull request Oct 26, 2020
… flyout (#80996) (#81665)

* 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>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Mike Côté <mikecote@users.noreply.github.com>
gmmorris added a commit to gmmorris/kibana that referenced this pull request Oct 27, 2020
* master: (37 commits)
  [ILM] Migrate Warm phase to Form Lib (elastic#81323)
  [Security Solutions][Detection Engine] Fixes critical bug with error reporting that was doing a throw (elastic#81549)
  [Detection Rules] Add 7.10 rules (elastic#81676)
  [kbn/optimizer] ignore missing metrics when updating limits with --focus (elastic#81696)
  [SECURITY SOLUTIONS] Bugs overview page + investigate eql in timeline (elastic#81550)
  [Maps] fix unable to edit cluster vector styles styled by count when switching to super fine grid resolution (elastic#81525)
  Fixed migration issue for case specific actions, by extending email action migrator checks (elastic#81673)
  [CI] Preparation for APM tracking on CI (elastic#80399)
  [Home] Fixes Kibana app description order on home page and updates Canvas copy (elastic#80057)
  Make sure `to` is 'now' and not the same as `from` (elastic#81524)
  Nitpicking the 8.0 Breaking Change issue template (elastic#81678)
  [SECURITY_SOLUTION] Fix text on onboarding screen (elastic#81672)
  [data.search] Skip async search tests in build candidates and production builds (elastic#81547)
  Fix previousStartedAt by not changing when execution fails (elastic#81388)
  [Monitoring] Fix a couple of issues with the cpu usage alert (elastic#80737)
  Telemetry collection xpack to ts project references (elastic#81269)
  Elasticsearch: don't use url authentication for new client (elastic#81564)
  [App Search] Credentials: implement working flyout form (elastic#81541)
  Properly encode links to edit user page (elastic#81562)
  [Alerting UI] Don't wait for health check before showing Create Alert flyout (elastic#80996)
  ...
@ymao1 ymao1 deleted the alerting/slow-alert-flyout branch February 4, 2021 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Alerting release_note:enhancement 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] Opening an alerting flyout is very slow
6 participants