Skip to content

Commit

Permalink
#2136 Fix operations on observable that require a case
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Jul 23, 2021
1 parent a451edc commit 80ccc7f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,13 @@ class ActionSrv @Inject() (
*/
def relatedCase(id: EntityId)(implicit graph: Graph): Option[Case with Entity] =
for {
richAction <- startTraversal.getByIds(id).richAction.getOrFail("Action").toOption
richAction <- startTraversal.getByIds(id).richAction.headOption
relatedCase <- entityHelper.parentCase(richAction.context)
} yield relatedCase

def relatedTask(id: EntityId)(implicit graph: Graph): Option[Task with Entity] =
for {
richAction <- startTraversal.getByIds(id).richAction.getOrFail("Action").toOption
richAction <- startTraversal.getByIds(id).richAction.headOption
relatedTask <- entityHelper.parentTask(richAction.context)
} yield relatedTask

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,12 @@ class EntityHelper @Inject() (
*/
def parentCase(entity: Entity)(implicit graph: Graph): Option[Case with Entity] =
entity._label match {
case "Task" => taskSrv.get(entity).`case`.headOption
case "Case" => caseSrv.get(entity).headOption
case "Log" => logSrv.get(entity).`case`.headOption
case "Alert" => None
case _ => None
case "Task" => taskSrv.get(entity).`case`.headOption
case "Case" => caseSrv.get(entity).headOption
case "Observable" => observableSrv.get(entity).`case`.headOption
case "Log" => logSrv.get(entity).`case`.headOption
case "Alert" => None
case _ => None
}

/**
Expand Down

0 comments on commit 80ccc7f

Please sign in to comment.