154a6b08c0a043e8c604534592748ca9ef70d1c5
[portal/sdk.git] /
1 /*
2  * Copyright (c) 2014 DataTorrent, Inc. ALL Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *   http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 'use strict';
18
19 app
20   .controller('LayoutsDemoCtrl', function($scope, widgetDefinitions, defaultWidgets, LayoutStorage, $interval) {
21     $scope.layoutOptions = {
22       storageId: 'demo-layouts',
23       storage: localStorage,
24       storageHash: 'fs4df4d51',
25       widgetDefinitions: widgetDefinitions,
26       defaultWidgets: defaultWidgets,
27       lockDefaultLayouts: true,
28       defaultLayouts: [
29         { title: 'Layout 1', active: true , defaultWidgets: defaultWidgets },
30         { title: 'Layout 2', active: false, defaultWidgets: defaultWidgets },
31         { title: 'Layout 3', active: false, defaultWidgets: defaultWidgets, locked: false }
32       ]
33     };
34     $scope.randomValue = Math.random();
35     $interval(function () {
36       $scope.randomValue = Math.random();
37     }, 500);
38
39   })
40   .controller('LayoutsDemoExplicitSaveCtrl', function($scope, widgetDefinitions, defaultWidgets, LayoutStorage, $interval, $http) {
41           $http.get('raptor.htm?action=report.search.execute').then(
42                                 function(result){ 
43                                         var data = result.data;
44                                         var report_id_name = [];
45                                         for (var i in data.rows[0]) {
46                                           report_id_name.push({index:i, value: data.rows[0][i][1].searchresultField.displayValue, title: data.rows[0][i][2].searchresultField.displayValue})
47                                         }
48                                         $scope.reports = report_id_name;
49                                         console.log($scope.reports);                                    
50                                         $scope.report1 = $scope.reports[1];
51                                 });       
52
53           $scope.rcloud_url= "https://rcloud.research.att.com/mini.html?notebook=c131ea997453e75303588699936d1896";         
54     $scope.layoutOptions = {
55       storageId: 'demo-layouts-explicit-save',
56       storage: localStorage,
57       storageHash: 'fs4df4d51',
58       widgetDefinitions: widgetDefinitions,
59       defaultWidgets: defaultWidgets,
60       explicitSave: true,
61       defaultLayouts: [
62         { title: 'Layout 1', active: true , defaultWidgets: defaultWidgets },
63         { title: 'Layout 2', active: false, defaultWidgets: defaultWidgets },
64         { title: 'Layout 3', active: false, defaultWidgets: defaultWidgets }
65       ]
66     };
67     $scope.randomValue = Math.random();
68     $interval(function () {
69       $scope.randomValue = Math.random();
70     }, 500);
71
72   });