e6f35384c6c163214b3377530b4a54f9fcb2428a
[portal/sdk.git] /
1
2 app.config(function($routeProvider) {
3         $routeProvider
4         
5         .otherwise({
6         //              templateUrl: 'app/fusion/notebook-integration/scripts/view-models/notebook-frame.html',
7                 templateUrl: 'app/fusion/notebook-integration/scripts/view-models/notebookInputs.html', 
8                 controller: 'nbookController'
9                 });
10 }).controller('nbookController', ['$scope', '$location','$window','$http', function ($scope,$location,$window,$http) { 
11         
12         $scope.keyValueList = [{}];
13         console.log('onload nbookController');
14         $scope.submitParameters = function() {
15                 
16                 $scope.iframevisibility = false;
17                 console.log('Inside nbook invoke save');
18                 
19                 $scope.postData = {};
20                 
21                 $scope.additionalqueryParams = {};
22                 
23         //Use this if there is only one 1 query param key value pair 
24                 $scope.additionalqueryParams.paramKey = $scope.qparamKey;
25                 $scope.additionalqueryParams.paramVal = $scope.qparamVal;
26                 
27                 
28         //      console.log('$scope.additionalqueryParams',$scope.additionalqueryParams);
29                 console.log('$scope.notebookvalue',$scope.notebookvalue);
30                 
31
32                 console.log('$scope.additionalqueryParams',$scope.additionalqueryParams);
33         
34                 console.log('$scope.keyValueList',$scope.keyValueList);
35
36                 console.log('$scope.keyValueList.length',$scope.keyValueList.length);
37                 
38                 var qryStr = '';
39                 for(var i = 0; i < $scope.keyValueList.length; i++) {
40                     var obj = $scope.keyValueList[i];
41                     //console.log('obj.qK',obj.qK);
42                     if (obj.qK != undefined && obj.qV != undefined) { 
43                         //console.log('Inside qk defined');
44                         if (qryStr!='')
45                                 qryStr = qryStr+'&'+obj.qK+'='+obj.qV;
46                             else
47                                 qryStr = obj.qK+'='+obj.qV;
48                             
49                     }
50                     
51                 }
52                 console.log('qryStr',qryStr);
53
54                 
55                 
56                 //var testurl = 'nbooktest.htm?nid='+$scope.notebookvalue+'&k1='+$scope.additionalqueryParams.paramKey+'&v1='+$scope.additionalqueryParams.paramVal;
57                 
58         //      var testurl = 'nbooktest.htm?nid='+$scope.notebookvalue+'&'+$scope.additionalqueryParams.paramKey+'='+$scope.additionalqueryParams.paramVal;
59                 
60                 var queryurl = 'nbooktest.htm?nid='+$scope.notebookvalue+'&'+qryStr;
61                 
62         //      var testurl = 'notebook.htm#/notebook-frame';
63                 
64                 window.open (queryurl,'_self',false);
65         
66                 
67         } 
68         
69         $scope.addKeyValuePairs = function (kv) {
70                         
71                         
72                 if ($scope.keyValueList.length < 9) {
73                         $scope.keyValueList.push({  
74                           
75                               });
76                         //      alert($scope.reportRunJson.rangeAxisList.length);
77                         //      console.log('$scope.keyValueList',$scope.keyValueList);
78                         
79                 } else {
80                         //document.getElementById("addbtn").disabled = true;
81                         //      $scope.btnactive = false;
82                         document.getElementById("addbtn")["disabled"]  = true;
83                         //document.getElementById("addbtn")["style.background-color"]  = "#FFFF00";
84                         
85                         //$('#addbtn').btn('type') = "disabled";
86                 }
87         }
88
89         $scope.removeKeyValuePairs = function (index) {
90                 $scope.keyValueList.splice(index, 1);
91                 if ($scope.keyValueList.length == 8) {
92                         document.getElementById("addbtn")["disabled"]  = false;
93                 }
94                 //console.log($scope.hardCodeReport.rangeAxisList)
95         }
96
97 }]);