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

Fix data source picker for threat alerts card #1206

Conversation

jowg-amazon
Copy link
Contributor

Description

  • Fixes the data source picker for the threat alerts card so it loads alerts from different selected clusters
  • Loads the default cluster by default
Screen.Recording.2024-10-28.at.2.52.49.PM.mov

Issues Resolved

[List any issues this PR will resolve]

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Joanne Wang <jowg@amazon.com>
@@ -58,7 +60,7 @@ export class AlertsStore {
} while (
// If we get 10,000 alerts as part of the previous call then there might be more alerts to fetch,
// hence we make another call until the number of alerts is less then 10,000
alertsCount === maxAlertsReturned
alertsCount > maxAlertsReturned
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@riysaxen-amzn to double check this doesn't break existing pagination

Copy link
Collaborator

Choose a reason for hiding this comment

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

This new condition will never be true. Since alertsCount can never exceed maxAlertsReturned (which is set to 10,000), the loop will effectively terminate after the first fetch.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If there are more than 10,000 alerts available, we would miss fetching any alerts beyond the first batch

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm curious about this change as well. The maximum number of alerts that can be returned by the API is 10,000, correct? In that case, I'm not sure it's possible for alertsCount to be greater than maxAlertsReturned. Whenever the API response is received, alertsCount is reassigned to the number of alerts returned on this line
https://github.com/opensearch-project/security-analytics-dashboards-plugin/pull/1206/files#diff-34f8a5950df0e00570a3fd41df3207f8de73e3825c3bf21eaead3edee111db12R53

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep reverted the change back, since we are only grabbing 25 alerts max for the threat alerts card, added a change to do this in one call now.

Signed-off-by: Joanne Wang <jowg@amazon.com>
Signed-off-by: Joanne Wang <jowg@amazon.com>
@@ -64,6 +66,38 @@ export class AlertsStore {
return allAlerts;
}

// Just grab 25 alerts for the analytics all threat alerts card once
public async getAlertsForThreatAlertsCard(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Adding this function seems redundant, but we can address that later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah unblocking neo for now

@AWSHurneyt AWSHurneyt merged commit b2eb62c into opensearch-project:main Oct 28, 2024
8 of 12 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 28, 2024
* Fix data source picker for threat alerts card

Signed-off-by: Joanne Wang <jowg@amazon.com>

* remove unused import

Signed-off-by: Joanne Wang <jowg@amazon.com>

* fix get alerts loop

Signed-off-by: Joanne Wang <jowg@amazon.com>

---------

Signed-off-by: Joanne Wang <jowg@amazon.com>
(cherry picked from commit b2eb62c)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 28, 2024
* Fix data source picker for threat alerts card

Signed-off-by: Joanne Wang <jowg@amazon.com>

* remove unused import

Signed-off-by: Joanne Wang <jowg@amazon.com>

* fix get alerts loop

Signed-off-by: Joanne Wang <jowg@amazon.com>

---------

Signed-off-by: Joanne Wang <jowg@amazon.com>
(cherry picked from commit b2eb62c)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
riysaxen-amzn pushed a commit that referenced this pull request Oct 29, 2024
* Fix data source picker for threat alerts card



* remove unused import



* fix get alerts loop



---------


(cherry picked from commit b2eb62c)

Signed-off-by: Joanne Wang <jowg@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
riysaxen-amzn pushed a commit that referenced this pull request Oct 29, 2024
* Fix data source picker for threat alerts card



* remove unused import



* fix get alerts loop



---------


(cherry picked from commit b2eb62c)

Signed-off-by: Joanne Wang <jowg@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
amsiglan pushed a commit to amsiglan/security-analytics-dashboards-plugin that referenced this pull request Jan 9, 2025
… (opensearch-project#1207)

* Fix data source picker for threat alerts card



* remove unused import



* fix get alerts loop



---------


(cherry picked from commit b2eb62c)

Signed-off-by: Joanne Wang <jowg@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
AWSHurneyt pushed a commit that referenced this pull request Jan 10, 2025
* feat: update category (#1169) (#1170)

(cherry picked from commit 8865ff1)

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Bug fixes for threat intel, duplicate findings, and breadcrumbs path (#1176) (#1177)

* fix spacing for threat intel



* fix alienvault source details page crash



* fix threat intel findings widget view view all url crash



* fix security analtyics breadcrumbs link path crash



* fix duplicate findings



---------


(cherry picked from commit 0ce91fb)

Signed-off-by: Joanne Wang <jowg@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Fit and Finish UX Fixes (#1174) (#1178)

* add plus sign to create detector button



* change getting started to get started



* run yarn test:jest -u



* move tabs to top



* remove duplicate code



* change total active alerts to total active threat alerts



* Add period to end of correlate events content



* fix spacing and padding



* make search and filters compressed



* make search and filter compressed pt 2



* move refresh and actions next to search bar



* move bulk delete to left of search bar



* fix spacing for detector details view



* change content panel from h2 to h3



* remove empty hover state



* fix sizing for empty widget



* fix heading spacing



* change getting started to get started pt2



* run yarn test:jest -u



* add helper function for empty prompt and change to p instead of span



---------


(cherry picked from commit 9c0c2f4)

Signed-off-by: Joanne Wang <jowg@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* [Fit&Finish] Security analytics overview page (#1175) (#1179)

* fit&finish



* add width for recent threat alerts card



* fix typo



---------


(cherry picked from commit 076d1ef)

Signed-off-by: Hailong Cui <ihailong@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* avoid showing unuseful error toast when ds is not yet selected (#1186) (#1187)

(cherry picked from commit e4fdd25)

Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: Update getting started cards content and visual design (#1188) (#1189)

(cherry picked from commit 2b33ca2)

Signed-off-by: Viraj Sanghvi <virajs@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* testing default ds switch changes (#1199) (#1201)

(cherry picked from commit 5d3801a)

Signed-off-by: Riya Saxena <riysaxen@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* make dataSource default cluster for threat alerts card (#1200) (#1203)

(cherry picked from commit 48669ca)

Signed-off-by: Joanne Wang <jowg@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Fix data source picker for threat alerts card (#1206) (#1207)

* Fix data source picker for threat alerts card



* remove unused import



* fix get alerts loop



---------


(cherry picked from commit b2eb62c)

Signed-off-by: Joanne Wang <jowg@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* do not decode ds id from url; update global state on ds change (#1216) (#1217)

(cherry picked from commit ad76b7b)

Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

---------

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Signed-off-by: Joanne Wang <jowg@amazon.com>
Signed-off-by: Hailong Cui <ihailong@amazon.com>
Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com>
Signed-off-by: Viraj Sanghvi <virajs@amazon.com>
Signed-off-by: Riya Saxena <riysaxen@amazon.com>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants