-
Notifications
You must be signed in to change notification settings - Fork 104
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
add alertId parameter in get chained alert API and paginate associated alerts if alertId param is mentioned #1071
Conversation
…d alerts if alertId param is mentioned Signed-off-by: Surya Sashank Nistala <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #1071 +/- ##
============================================
+ Coverage 67.70% 67.73% +0.03%
Complexity 105 105
============================================
Files 160 160
Lines 10324 10343 +19
Branches 1518 1522 +4
============================================
+ Hits 6990 7006 +16
- Misses 2671 2672 +1
- Partials 663 665 +2
|
actionListener.onResponse(GetWorkflowAlertsResponse(alerts, associatedAlerts, totalAlertCount)) | ||
} catch (e: Exception) { | ||
actionListener.onFailure(AlertingException("Failed to get alerts", RestStatus.INTERNAL_SERVER_ERROR, e)) | ||
} | ||
} | ||
|
||
private suspend fun getAssociatedAlerts(associatedAlerts: MutableList<Alert>, alerts: MutableList<Alert>, alertIndex: String) { | ||
private suspend fun getAssociatedAlerts( |
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.
How is pagination done here?
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.
fixed this and verified in test
// if alert id is mentioned we cannot set "from" field as it may not return id. we would be using it to paginate associated alerts | ||
val from = if (getWorkflowAlertsRequest.alertIds.isNullOrEmpty()) | ||
tableProp.startIndex | ||
else 0 |
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.
The startIndex
isn't being passed over to getAssociatedAlerts
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.
we dont need it to be passed over. we will use tableProp.startIndex
we need this check on from
param if alertId is mentioned because we cannot paginate for single id in search request to fetch the chained alerts
Signed-off-by: Surya Sashank Nistala <[email protected]>
…d alerts if alertId param is mentioned (#1071) * add alertId parameter in get chained alert API and paginate associated alerts if alertId param is mentioned Signed-off-by: Surya Sashank Nistala <[email protected]> * set from param in associated alerts search request Signed-off-by: Surya Sashank Nistala <[email protected]> --------- Signed-off-by: Surya Sashank Nistala <[email protected]> (cherry picked from commit d9f66b3) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…d alerts if alertId param is mentioned (#1071) * add alertId parameter in get chained alert API and paginate associated alerts if alertId param is mentioned Signed-off-by: Surya Sashank Nistala <[email protected]> * set from param in associated alerts search request Signed-off-by: Surya Sashank Nistala <[email protected]> --------- Signed-off-by: Surya Sashank Nistala <[email protected]> (cherry picked from commit d9f66b3) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…d alerts if alertId param is mentioned (#1071) (#1074) * add alertId parameter in get chained alert API and paginate associated alerts if alertId param is mentioned * set from param in associated alerts search request --------- (cherry picked from commit d9f66b3) Signed-off-by: Surya Sashank Nistala <[email protected]> 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>
…d alerts if alertId param is mentioned (#1071) (#1073) * add alertId parameter in get chained alert API and paginate associated alerts if alertId param is mentioned * set from param in associated alerts search request --------- (cherry picked from commit d9f66b3) Signed-off-by: Surya Sashank Nistala <[email protected]> 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>
Get chained alert API will support filtering based on an alertId. The motivation is to fetch associated alerts with support for pagination. The size and sort params would apply to fetch associated alerts in this api when alert id is mentioned
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.