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] Update rules detail page to resolve SO IDs if necessary #108091

Merged
merged 16 commits into from
Aug 19, 2021

Conversation

ymao1
Copy link
Contributor

@ymao1 ymao1 commented Aug 10, 2021

Resolve #108074

Summary

This PR:

  • Adds an internal resolve HTTP API that calls the saved objects resolve function
  • Updates the rule details page to handle 404 Not found errors from the existing GET API and try to resolve those rule IDs using the new internal resolve API. Handling for non-404 errors is unchanged.
  • Uses the provided spacesOss UI components to
    • redirect to new URL and show toaster message when resolve outcome is aliasMatch
    • show warning callout when resolve outcome is conflict

To Verify

const migrationActions800 = createEsoMigration(
    encryptedSavedObjects,
    (doc: SavedObjectUnsanitizedDoc<RawAlert>): doc is SavedObjectUnsanitizedDoc<RawAlert> => true,
    (doc) => doc // no-op
  );

'8.0.0': executeMigrationWithErrorHandling(migrationActions800, '8.0.0'),
  • Run this branch using the same data from 7.14
  • Go to the bookmarked URLs from before and make sure your network tab is open
  • For rules in the default space, you should see a successful GET request when you go to the bookmarked URL
  • For rules in the non-default space, you should see a 404 for the GET and then a successful resolve request when you go to the bookmarked URL. You should be redirected to the rule details page for the updated rule ID and you should see a toaster pop up.
  • Not sure how to recreate a conflict outcome but if you want to see the conflict callout, you could modify x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details_route.tsx to set the outcome to conflict after the resolve call.

Checklist

@ymao1 ymao1 changed the title Adding internal resolve API to resolve rules given an ID [Alerting] Update rules detail page to resolve SO IDs if necessary Aug 12, 2021
@ymao1 ymao1 self-assigned this Aug 12, 2021
@ymao1 ymao1 added Feature:Alerting Feature:Alerting/RulesManagement Issues related to the Rules Management UX 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.15.0 v8.0.0 labels Aug 12, 2021
@ymao1
Copy link
Contributor Author

ymao1 commented Aug 12, 2021

Left a comment about adding a e2e test for this when the changes are made to the alerting SO to make it share-capable for 8.0

@ymao1 ymao1 marked this pull request as ready for review August 12, 2021 17:09
@ymao1 ymao1 requested a review from a team as a code owner August 12, 2021 17:09
@elasticmachine
Copy link
Contributor

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

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.

LGTM. Works as described.

@ymao1
Copy link
Contributor Author

ymao1 commented Aug 16, 2021

@elasticmachine merge upstream

Copy link
Contributor

@chrisronline chrisronline left a comment

Choose a reason for hiding this comment

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

LGTM! Great work!

@ymao1 ymao1 added v7.16.0 and removed v7.15.0 labels Aug 17, 2021
@ymao1
Copy link
Contributor Author

ymao1 commented Aug 18, 2021

@elasticmachine merge upstream

@ymao1
Copy link
Contributor Author

ymao1 commented Aug 18, 2021

@elasticmachine merge upstream

@ymao1 ymao1 added the auto-backport Deprecated - use backport:version if exact versions are needed label Aug 18, 2021
@ymao1
Copy link
Contributor Author

ymao1 commented Aug 18, 2021

@elasticmachine merge upstream

@ymao1
Copy link
Contributor Author

ymao1 commented Aug 19, 2021

@elasticmachine merge upstream

@ymao1 ymao1 enabled auto-merge (squash) August 19, 2021 01:04
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
triggersActionsUi 361 362 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
triggersActionsUi 1.6MB 1.6MB +2.1KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
triggersActionsUi 89.3KB 89.3KB +33.0B
Unknown metric groups

API count

id before after diff
alerting 247 248 +1
triggersActionsUi 238 239 +1
total +2

API count missing comments

id before after diff
alerting 239 240 +1
triggersActionsUi 229 230 +1
total +2

History

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

cc @ymao1

@ymao1 ymao1 merged commit 48ce73d into elastic:master Aug 19, 2021
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Aug 19, 2021
…lastic#108091)

* Adding internal resolve API to resolve rules given an ID

* Updating after merge

* Updating after merge

* Adding resolveRule api to client and adding spacesOss plugin dependency

* Handling 404 errors by calling resolve. Updating unit tests

* Handling aliasMatch and conflict results

* Fixing types

* Unit tests for spaces oss components

* Adding audit event for resolve

Co-authored-by: Kibana Machine <[email protected]>
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request Aug 19, 2021
…108091) (#109194)

* Adding internal resolve API to resolve rules given an ID

* Updating after merge

* Updating after merge

* Adding resolveRule api to client and adding spacesOss plugin dependency

* Handling 404 errors by calling resolve. Updating unit tests

* Handling aliasMatch and conflict results

* Fixing types

* Unit tests for spaces oss components

* Adding audit event for resolve

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: ymao1 <[email protected]>
@ymao1 ymao1 deleted the alerting/use-resolve-in-rule-details branch August 30, 2021 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed Feature:Alerting/RulesManagement Issues related to the Rules Management UX 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.16.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Alerting][7.x] Update rules detail page to use new saved object resolve API when necessary
5 participants