From 542e317cae8fd2050f741dc4c664713cab8964d2 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Tue, 20 Dec 2022 11:04:14 -0800 Subject: [PATCH] Filtered findings shown in alert details (#229) (#244) * filtered findings Signed-off-by: Amardeepsingh Siglani * fixed cypress test Signed-off-by: Amardeepsingh Siglani * removed breaking change Signed-off-by: Amardeepsingh Siglani Signed-off-by: Amardeepsingh Siglani (cherry picked from commit 8d9e3708ef29f53509a566d481eff9757a32764c) Co-authored-by: Amardeepsingh Siglani Signed-off-by: AWSHurneyt --- cypress/integration/3_alerts.spec.js | 4 ++-- public/pages/Alerts/components/AlertFlyout/AlertFlyout.tsx | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cypress/integration/3_alerts.spec.js b/cypress/integration/3_alerts.spec.js index a40037503..374261563 100644 --- a/cypress/integration/3_alerts.spec.js +++ b/cypress/integration/3_alerts.spec.js @@ -159,12 +159,12 @@ describe('Alerts', () => { cy.get('[data-test-subj="text-details-group-content-detector"]').contains(testDetector.name); // Wait for the findings table to finish loading - cy.contains('Findings (4)', TWENTY_SECONDS_TIMEOUT); + cy.contains('Findings (1)', TWENTY_SECONDS_TIMEOUT); cy.contains('USB Device Plugged', TWENTY_SECONDS_TIMEOUT); // Confirm alert findings contain expected values cy.get('tbody > tr', TWENTY_SECONDS_TIMEOUT) - .should(($tr) => expect($tr, '4 rows').to.have.length(4)) + .should(($tr) => expect($tr, '1 row').to.have.length(1)) .each(($el, $index) => { expect($el, `row number ${$index} timestamp`).to.contain(date); expect($el, `row number ${$index} rule name`).to.contain('USB Device Plugged'); diff --git a/public/pages/Alerts/components/AlertFlyout/AlertFlyout.tsx b/public/pages/Alerts/components/AlertFlyout/AlertFlyout.tsx index 8f30e9d5a..ebedd1215 100644 --- a/public/pages/Alerts/components/AlertFlyout/AlertFlyout.tsx +++ b/public/pages/Alerts/components/AlertFlyout/AlertFlyout.tsx @@ -82,7 +82,10 @@ export class AlertFlyout extends React.Component + this.props.alertItem.finding_ids.includes(finding.id) + ); + this.setState({ findingItems: relatedFindings }); } else { errorNotificationToast(notifications, 'retrieve', 'findings', findingRes.error); }