Skip to content

Commit

Permalink
add workflow null or empty check only when empty workflow id passed. …
Browse files Browse the repository at this point in the history
…change Rest get alert handler to add empty string singleton list for workflow ids when none is passed

Signed-off-by: Surya Sashank Nistala <[email protected]>
  • Loading branch information
eirsep committed Sep 13, 2023
1 parent 49a67ea commit eb481a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class RestGetAlertsAction : BaseRestHandler() {
val workflowIds = mutableListOf<String>()
if (workflowId.isNullOrEmpty() == false) {
workflowIds.add(workflowId)
} else {
workflowIds.add("")
}
val table = Table(
sortOrder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ class TransportGetAlertsAction @Inject constructor(
}
} else if (getAlertsRequest.monitorIds.isNullOrEmpty() == false) {
queryBuilder.filter(QueryBuilders.termsQuery("monitor_id", getAlertsRequest.monitorIds))
if (getAlertsRequest.workflowIds.isNullOrEmpty()) {
if (
getAlertsRequest.workflowIds != null && getAlertsRequest.workflowIds!!.size == 1 && getAlertsRequest.workflowIds!![0] == ""
) {
val noWorkflowIdQuery = QueryBuilders.boolQuery()
.should(QueryBuilders.boolQuery().mustNot(QueryBuilders.existsQuery(Alert.WORKFLOW_ID_FIELD)))
.should(QueryBuilders.termsQuery(Alert.WORKFLOW_ID_FIELD, ""))
Expand Down

0 comments on commit eb481a6

Please sign in to comment.