This repository was archived by the owner on Dec 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 683
Expand file tree
/
Copy pathMainPageCtrl.js
More file actions
83 lines (78 loc) · 3.08 KB
/
MainPageCtrl.js
File metadata and controls
83 lines (78 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
(function() {
'use strict';
angular.module('theHiveControllers').controller('MainPageCtrl',
function($rootScope, $scope, $window, $stateParams, $state, CaseTaskSrv, PSearchSrv, EntitySrv, UserInfoSrv) {
$scope.live = function() {
$window.open($state.href('live'), 'TheHiveLive',
'width=500,height=700,menubar=no,status=no,toolbar=no,location=no,scrollbars=yes');
};
if ($stateParams.viewId === 'mytasks') {
$rootScope.title = 'My tasks';
$scope.view.data = 'mytasks';
$scope.list = PSearchSrv(undefined, 'case_task', {
scope: $scope,
baseFilter: {
'_and': [{
'_in': {
'_field': 'status',
'_values': ['Waiting', 'InProgress']
}
}, {
'owner': $scope.currentUser.id
}]
},
sort: ['-flag', '-startDate'],
nparent: 1
});
} else if ($stateParams.viewId === 'waitingtasks') {
$rootScope.title = 'Waiting tasks';
$scope.view.data = 'waitingtasks';
$scope.list = PSearchSrv(undefined, 'case_task', {
scope: $scope,
baseFilter: {
'status': 'Waiting'
},
sort: '-startDate',
nparent: 1
});
} else if ($stateParams.viewId === 'mycases') {
$rootScope.title = 'My cases';
$scope.view.data = 'mycases';
$scope.list = PSearchSrv(undefined, 'case', {
scope: $scope,
baseFilter: {
'_and': [{
'_in': {
'_field': 'status',
'_values': ['Open']
}
}, {
'owner': $scope.currentUser.id
}]
},
sort: ['-flag', '-startDate'],
nparent: 1
});
}
// init values
$scope.showFlow = true;
$scope.openEntity = EntitySrv.open;
$scope.getUserInfo = UserInfoSrv;
$scope.openWTask = function(task) {
if (task.status === 'Waiting') {
CaseTaskSrv.update({
'taskId': task.id
}, {
'status': 'InProgress'
}, function(data) {
if (data.status === 'InProgress') {
$scope.openEntity(task);
}
}, function(response) {
console.log(response);
});
}
};
}
);
})();