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

[ResponseOps][Cases] Setting rule info to null for 8.0 #123096

Merged

Conversation

jonathan-buttner
Copy link
Contributor

This is a manual "backport" of this PR: #123094

This is needed because there are multiple features/refactoring that did not go into 8.0.0 but are currently in 8.1. This will cause the above PR's backport to fail so I manually pulled in the changes file by file 😬

Testing

To test I would attach an alert to the case, then grab the alertId and case ID information to use with a postman request like this:

{
    "alertId": [<add a valid alertId here>],
    "index": [".internal.alerts-security.alerts-default-000001"],
    "rule": { "id": null, "name": null },
    "type": "alert",
    "owner": "securitySolution"
}

You should see the rule's name show up for both alerts and clicking on it should take you to the rule's page.

@jonathan-buttner jonathan-buttner added v8.0.0 release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Feature:Cases Cases feature labels Jan 14, 2022
@jonathan-buttner jonathan-buttner changed the title Setting rule information to null [ResponseOps][Cases] Setting rule info to null for 8.0 Jan 14, 2022
@@ -458,3 +461,55 @@ export interface Alert {
signal: Signal;
[key: string]: unknown;
}

export const getFirstItem = (items?: string | string[] | null): string | null => {
if (items == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: this kind of code can be confusing as items could be undefined and can also be null. I'd recommend the more verbose but clear and type safe way:

if (item === undefined || item === null) {

@jonathan-buttner
Copy link
Contributor Author

@elasticmachine merge upstream

@jonathan-buttner jonathan-buttner marked this pull request as ready for review January 18, 2022 14:05
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops-cases (Feature:Cases)

@jonathan-buttner jonathan-buttner enabled auto-merge (squash) January 18, 2022 18:30
Copy link
Member

@cnasikas cnasikas left a comment

Choose a reason for hiding this comment

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

Tested by running a 7.16 instance and then upgrading to 8.0. All is working as expected. Thank you so much for the fix and the effort you put into it 🚀

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
cases 312.9KB 312.8KB -60.0B

History

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

@jonathan-buttner jonathan-buttner merged commit ec5cc62 into elastic:8.0 Jan 18, 2022
@jonathan-buttner jonathan-buttner deleted the cases-remove-rule-fields branch January 18, 2022 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Cases Cases feature release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants