Skip to content

Commit

Permalink
#609 Fix the actions list refresh in case, task and observable detail…
Browse files Browse the repository at this point in the history
…s pages
  • Loading branch information
nadouani committed Jul 23, 2018
1 parent 420cd15 commit d8b77d2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
11 changes: 8 additions & 3 deletions ui/app/scripts/controllers/case/CaseDetailsCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
nparent: 1
});

$scope.actions = PSearchSrv($scope.caseId, 'connector/cortex/action', {
$scope.actions = PSearchSrv(null, 'connector/cortex/action', {
scope: $scope,
streamObjectType: 'case',
streamObjectType: 'action',
filter: {
_and: [
{
Expand All @@ -57,7 +57,12 @@
]
},
sort: ['-startDate'],
pageSize: 100
pageSize: 100,
guard: function(updates) {
return _.find(updates, function(item) {
return (item.base.object.objectType === 'case') && (item.base.object.objectId === $scope.caseId);
}) !== undefined;
}
});

$scope.hasNoMetrics = function(caze) {
Expand Down
11 changes: 8 additions & 3 deletions ui/app/scripts/controllers/case/CaseObservablesItemCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@
$scope.jobs = CortexSrv.list($scope, $scope.caseId, observableId, $scope.onJobsChange);
});

$scope.actions = PSearchSrv($scope.caseId, 'connector/cortex/action', {
$scope.actions = PSearchSrv(null, 'connector/cortex/action', {
scope: $scope,
streamObjectType: 'case_artifact',
streamObjectType: 'action',
filter: {
_and: [
{
Expand All @@ -92,7 +92,12 @@
]
},
sort: ['-startDate'],
pageSize: 100
pageSize: 100,
guard: function(updates) {
return _.find(updates, function(item) {
return (item.base.object.objectType === 'case_artifact') && (item.base.object.objectId === artifact.id);
}) !== undefined;
}
});
};

Expand Down
11 changes: 8 additions & 3 deletions ui/app/scripts/controllers/case/CaseTasksItemCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
'pageSize': 10
});

$scope.actions = PSearchSrv(caseId, 'connector/cortex/action', {
$scope.actions = PSearchSrv(null, 'connector/cortex/action', {
scope: $scope,
streamObjectType: 'case',
streamObjectType: 'action',
filter: {
_and: [
{
Expand All @@ -72,7 +72,12 @@
]
},
sort: ['-startDate'],
pageSize: 100
pageSize: 100,
guard: function(updates) {
return _.find(updates, function(item) {
return (item.base.object.objectType === 'case_task') && (item.base.object.objectId === taskId);
}) !== undefined;
}
});
};

Expand Down
4 changes: 3 additions & 1 deletion ui/app/scripts/services/PSearchSrv.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@
rootId: root,
objectType: control.streamObjectType || objectType,
callback: function(updates) {
update(objectType, control, updates);
if(!control.guard || control.guard(updates)) {
update(objectType, control, updates);
}
}
};

Expand Down

0 comments on commit d8b77d2

Please sign in to comment.