-
Notifications
You must be signed in to change notification settings - Fork 49
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
Fix data source picker for threat alerts card #1206
Conversation
Signed-off-by: Joanne Wang <jowg@amazon.com>
public/store/AlertsStore.ts
Outdated
@@ -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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
* 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>
* 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>
* 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>
* 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>
… (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>
* 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>
Description
Screen.Recording.2024-10-28.at.2.52.49.PM.mov
Issues Resolved
[List any issues this PR will resolve]
Check List
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.