0412718f8d46ddc746c212abe6f97a7a1f577a35
[portal/sdk.git] /
1 app.controller('droolsViewController', function ($scope,modalService,droolsService){ 
2
3
4                 $scope.resultsString = "";
5                 // Table Data
6             droolsService.getDroolDetails(droolsService.getSelectedFile()).then(function(data){
7                         
8                         var j = data;
9                         $scope.postDroolsBean = JSON.parse(j.data);
10                         //execute($scope.postDroolsBean);
11                 
12                 },function(error){
13                         console.log("failed");
14                         //reloadPageOnce();
15                 });
16                 
17         
18                 
19                 $scope.execute = function(postDroolsBean) {
20                                 console.log(postDroolsBean);
21                                 var uuu = "post_drools/execute";
22                                   var postData={postDroolsBean:postDroolsBean};
23                                   $.ajax({
24                                          type : 'POST',
25                                          url : uuu,
26                                          dataType: 'json',
27                                          contentType: 'application/json',
28                                          data: JSON.stringify(postData),
29                                          success : function(data){
30                                                 $scope.$apply(function(){
31                                                         $scope.resultsString=data.resultsString;
32                                                         console.log($scope.resultsString);
33                                                         });  
34                                          },
35                                          error : function(data){
36                                                  console.log(data);
37                                                  modalService.showFailure("Fail","Error while executing: "+ data.responseText);
38                                          }
39                                   });
40                         
41                 };
42                 
43                 
44                 
45         });