Skip to content

Commit

Permalink
#1946 Fix related alert count in case page
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Apr 12, 2021
1 parent 516d074 commit 4b305dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion frontend/app/scripts/controllers/case/CaseMainCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@

// Stats for case alerts counter
StreamQuerySrv('v1', [
{ _name: 'countImportedAlert', caseId: caseId },
{ _name: 'countRelatedAlert', caseId: caseId },
], {
scope: $scope,
rootId: caseId,
Expand Down
7 changes: 7 additions & 0 deletions thehive/app/org/thp/thehive/controllers/v1/AlertCtrl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ class AlertCtrl @Inject() (
s"""v."_label":Alert AND v.organisationId:${organisationSrv.currentId(graph, authContext).value} AND NOT v.caseId:[* TO 'ZZZZZZZZ']"""
)
),
Query.initWithParam[InCase, Long](
"countRelatedAlert",
(inCase, graph, authContext) =>
graph.indexCountQuery(
s"""v."_label":Alert AND v.organisationId:${organisationSrv.currentId(graph, authContext).value} AND v.caseId:${inCase.caseId.value}"""
)
),
Query[Traversal.V[Alert], Traversal.V[Observable]]("observables", (alertSteps, _) => alertSteps.observables),
Query[Traversal.V[Alert], Traversal.V[Case]]("case", (alertSteps, _) => alertSteps.`case`),
Query.withParam[Option[InputQuery[Traversal.Unk, Traversal.Unk]], Traversal.V[Alert], Traversal[
Expand Down

0 comments on commit 4b305dc

Please sign in to comment.