1
|
var repohiModule = angular.module("repohi", []);
|
2
|
|
3
|
repohiModule.directive("repoHiWorkflowModal", function ($http) {
|
4
|
return {
|
5
|
restrict: 'E',
|
6
|
transclude: true,
|
7
|
replace:true,
|
8
|
scope: {
|
9
|
'compliance' : '@',
|
10
|
'typology' : '@',
|
11
|
'visible' : '=',
|
12
|
'selectedRepoHiWf' : '=',
|
13
|
'selectedMsroWorker' : '=',
|
14
|
'repoHiFunction' : '&'
|
15
|
},
|
16
|
templateUrl: '/html/wf/repo-hi-workflow-modal.html',
|
17
|
|
18
|
link: function (scope, element, attrs, ctrl) {
|
19
|
scope.availableRepohiWfs = [];
|
20
|
scope.availableMsroWorkers = [];
|
21
|
|
22
|
$(element).modal({'show': false});
|
23
|
|
24
|
scope.$watch(function() {
|
25
|
return scope.visible;
|
26
|
}, function(value) {
|
27
|
if (value == true) {
|
28
|
$(element).modal('show');
|
29
|
scope.visible = false;
|
30
|
}
|
31
|
});
|
32
|
|
33
|
scope.findRepoHiWorkflows = function(compliance, type) {
|
34
|
scope.availableRepohiWfs = [];
|
35
|
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
|
36
|
$http.post('/ajax/apis/repohi/wfs', $.param({
|
37
|
'compliance' : compliance,
|
38
|
'type' : type
|
39
|
})).success(function (data) {
|
40
|
scope.availableRepohiWfs = data;
|
41
|
}).error(function (err) {
|
42
|
show_notification('error', 'Error listing repo-hi workflows: ' + err.message);
|
43
|
});
|
44
|
};
|
45
|
|
46
|
scope.findMsroWorkers = function() {
|
47
|
scope.availableMsroWorkers = [];
|
48
|
|
49
|
$http.get('/ajax/services/workers').success(function (data) {
|
50
|
scope.availableMsroWorkers = data;
|
51
|
}).error(function (err) {
|
52
|
show_notification('error', 'Error listing msro workers: ' + err.message);
|
53
|
});
|
54
|
};
|
55
|
|
56
|
|
57
|
scope.selectRepoHiWf = function(wf) {
|
58
|
scope.selectedRepoHiWf = wf;
|
59
|
};
|
60
|
|
61
|
scope.selectMsroWorker = function(worker) {
|
62
|
scope.selectedMsroWorker = worker;
|
63
|
};
|
64
|
}
|
65
|
}
|
66
|
|
67
|
});
|