From 6f5b8792a0b9fba13d64a99374eb2616250403f2 Mon Sep 17 00:00:00 2001 From: Nabil Adouani Date: Wed, 22 Jul 2020 17:45:39 +0200 Subject: [PATCH] #1410 Use StreamQuerySrv for case alert stats --- .../scripts/controllers/case/CaseMainCtrl.js | 29 ++++++++++++++++--- .../views/partials/case/case.panelinfo.html | 4 +-- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/frontend/app/scripts/controllers/case/CaseMainCtrl.js b/frontend/app/scripts/controllers/case/CaseMainCtrl.js index ee81c87e24..5f675e047e 100644 --- a/frontend/app/scripts/controllers/case/CaseMainCtrl.js +++ b/frontend/app/scripts/controllers/case/CaseMainCtrl.js @@ -81,6 +81,7 @@ } }); + // Stats for case tasks counter StreamQuerySrv('v1', [ {_name: 'getCase', idOrName: caseId}, {_name: 'tasks'}, @@ -105,6 +106,7 @@ } }); + // Stats for case observables counter StreamQuerySrv('v1', [ {_name: 'getCase', idOrName: caseId}, {_name: 'observables'}, @@ -123,15 +125,34 @@ } }); - $scope.alerts = StreamStatSrv({ + // Stats for case observables counter + StreamQuerySrv('v1', [ + {_name: 'getCase', idOrName: caseId}, + {_name: 'alerts'}, + {_name: 'count'} + ], { scope: $scope, rootId: caseId, - query: { 'case': caseId }, - result: {}, objectType: 'alert', - field: 'type' + query: { + params: { + name: 'alert-stats-' + caseId + } + }, + onUpdate: function(updates) { + $scope.alertCount = updates; + } }); + // $scope.alerts = StreamStatSrv({ + // scope: $scope, + // rootId: caseId, + // query: { 'case': caseId }, + // result: {}, + // objectType: 'alert', + // field: 'type' + // }); + $scope.$on('tasks:task-removed', function(event, task) { CaseTabsSrv.removeTab('task-' + task._id); }); diff --git a/frontend/app/views/partials/case/case.panelinfo.html b/frontend/app/views/partials/case/case.panelinfo.html index ef326c4a8e..ae09874c02 100644 --- a/frontend/app/views/partials/case/case.panelinfo.html +++ b/frontend/app/views/partials/case/case.panelinfo.html @@ -51,11 +51,11 @@

- + - +