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

[Security Solution][Case][Bug] Removing empty collections when filtering on status #92048

Merged

Conversation

jonathan-buttner
Copy link
Contributor

This PR addresses an issue where empty collections were returned in the /_find cases API. Instead we only want to return empty collections if the API request did not include a status to filter with. If no status was not included all collections will be returned regardless of whether they have sub cases.

Filtering on non status fields should behave the same. For example if we're looking for cases/collections with a particular tag this honors that.

Issue: #91843

@jonathan-buttner jonathan-buttner added v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.12.0 Team:Threat Hunting Security Solution Threat Hunting Team Feature:Cases Cases feature labels Feb 19, 2021
@jonathan-buttner jonathan-buttner requested a review from a team as a code owner February 19, 2021 17:16
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting (Team:Threat Hunting)

@angorayc
Copy link
Contributor

I have a question about calculating the total count for each status (x-pack/plugins/case/server/services/index.ts Line 418). Seems we haven't take empty collections into counts, wondering if there's a way to get the count of empty collections .

@jonathan-buttner
Copy link
Contributor Author

@elasticmachine merge upstream

@jonathan-buttner
Copy link
Contributor Author

I have a question about calculating the total count for each status (x-pack/plugins/case/server/services/index.ts Line 418). Seems we haven't take empty collections into counts, wondering if there's a way to get the count of empty collections .

Hey Angela, what do we need the count of empty collections for? Currently the backend doesn't provide a count for them. Since collections technically don't have a status anymore we're not including them in the status totals. Empty case collections will be included in the array if the user doesn't filter on status.

@angorayc
Copy link
Contributor

The status filters show open, in-progress and closed counts in the dropdown. Given that we decided not to show counts for status all, no worries about it then.

@@ -291,10 +294,20 @@ export class CaseService implements CaseServiceSetup {
const subCasesForCase = subCasesResp.subCasesMap.get(caseInfo.id);

/**
* This will include empty collections unless the query explicitly requested type === CaseType.individual, in which
* case we'd not have any collections anyway.
* If this case is an individual add it to the return map
Copy link
Contributor

Choose a reason for hiding this comment

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

awesome description here, thank you

@jonathan-buttner
Copy link
Contributor Author

@elasticmachine merge upstream

@jonathan-buttner jonathan-buttner changed the title [Security Solution][Case][Bug] Removing empty collections when not filtering on status [Security Solution][Case][Bug] Removing empty collections when filtering on status Feb 23, 2021
@jonathan-buttner
Copy link
Contributor Author

@elasticmachine merge upstream

@jonathan-buttner
Copy link
Contributor Author

@elasticmachine merge upstream

@jonathan-buttner
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 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
triggersActionsUi 1.6MB 1.5MB -23.9KB

Page load bundle

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

id before after diff
triggersActionsUi 104.0KB 104.1KB +82.0B
Unknown metric groups

async chunk count

id before after diff
triggersActionsUi 41 42 +1

History

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

@jonathan-buttner jonathan-buttner merged commit d9043c1 into elastic:master Mar 1, 2021
@jonathan-buttner jonathan-buttner deleted the remove-empty-collections branch March 1, 2021 19:47
jonathan-buttner added a commit to jonathan-buttner/kibana that referenced this pull request Mar 1, 2021
…ing on status (elastic#92048)

* Removing empty collections when not filtering on status

* Fixing add comment response

Co-authored-by: Kibana Machine <[email protected]>
jonathan-buttner added a commit to jonathan-buttner/kibana that referenced this pull request Mar 1, 2021
…ing on status (elastic#92048)

* Removing empty collections when not filtering on status

* Fixing add comment response

Co-authored-by: Kibana Machine <[email protected]>
jonathan-buttner added a commit that referenced this pull request Mar 1, 2021
…ing on status (#92048) (#93097)

* Removing empty collections when not filtering on status

* Fixing add comment response

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

Co-authored-by: Kibana Machine <[email protected]>
jonathan-buttner added a commit that referenced this pull request Mar 1, 2021
…ing on status (#92048) (#93096)

* Removing empty collections when not filtering on status

* Fixing add comment response

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

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:Cases Cases feature release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting Security Solution Threat Hunting Team v7.12.0 v7.13.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants