summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/view-models/reportdashboard-page/src/app/demo.js
blob: d598f0d0ed3fbaef420e88218fc2a5f0a837a610 (plain)
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/*
 * Copyright (c) 2014 DataTorrent, Inc. ALL Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

'use strict';

app
.config(function ($routeProvider) {
    $routeProvider
      .when('/view', {
        templateUrl: 'app/fusion/scripts/view-models/reportdashboard-page/src/app/template/view.html',
        controller: 'DemoCtrl',
        title: 'simple',
        description: 'This is the simplest demo.'
      })
      .when('/resize', {
        templateUrl: 'app/fusion/scripts/view-models/reportdashboard-page/src/app/template/view.html',
        controller: 'ResizeDemoCtrl',
        title: 'resize',
        description: 'This demo showcases widget resizing.'
      })
      .when('/custom-settings', {
        templateUrl: 'app/fusion/scripts/view-models/reportdashboard-page/src/app/template/view.html',
        controller: 'CustomSettingsDemoCtrl',
        title: 'custom widget settings',
        description: 'This demo showcases overriding the widget settings dialog/modal ' +
          'for the entire dashboard and for a specific widget. Click on the cog of each ' +
          'widget to see the custom modal. \n"configurable widget" has "limit" option in the modal ' +
          'that controls RandomDataModel.'
      })
      .when('/explicit-saving', {
        templateUrl: 'app/fusion/scripts/view-models/reportdashboard-page/src/app/template/view.html',
        controller: 'ExplicitSaveDemoCtrl',
        title: 'explicit saving',
        description: 'This demo showcases an option to only save the dashboard state '+
          'explicitly, e.g. by user input. Notice the "all saved" button in the controls ' +
          'updates as you make saveable changes.'
      })
      .when('/layouts', {
        templateUrl: 'app/fusion/scripts/view-models/reportdashboard-page/src/app/template/layouts.html',
        controller: 'LayoutsDemoCtrl',
        title: 'dashboard layouts',
        description: 'This demo showcases the ability to have "dashboard layouts", ' +
          'meaning the ability to have multiple arbitrary configurations of widgets. For more ' +
          'information, take a look at [issue #31](https://github.com/DataTorrent/malhar-angular-dashboard/issues/31)'
      })
      .when('/', {
        templateUrl: 'app/fusion/scripts/view-models/reportdashboard-page/src/app/template/layouts.html',
        controller: 'LayoutsDemoExplicitSaveCtrl',
        title: 'layouts explicit saving',
        description: 'This demo showcases dashboard layouts with explicit saving enabled.'
      })
      .otherwise({
        redirectTo: '/'
      });
  })
  .controller('NavBarCtrl', function($scope, $route) {
    $scope.$route = $route;
  })
  .factory('widgetDefinitions', function(RandomDataModel) {
    return [
      {
        name: 'random',
        directive: 'wt-scope-watch',
        attrs: {
          value: 'randomValue'
        }
      },
      {
        name: 'time',
        directive: 'wt-time'
      },
      {
        name: 'datamodel',
        directive: 'wt-scope-watch',
        dataAttrName: 'value',
        dataModelType: RandomDataModel
      },
      {
        name: 'resizable',
        templateUrl: 'app/fusion/scripts/view-models/reportdashboard-page/src/app/template/resizable.html',
        attrs: {
          class: 'demo-widget-resizable'
        }
      },
      {
        name: 'fluid',
        directive: 'wt-fluid',
        size: {
          width: '50%',
          height: '250px'
        }
      },
      {
          name: 'raptor-report-data',
          directive: 'raptor-report-data',
          size: {
            width: '50%',
            height: '300px'
          }
       },
       {
           name: 'raptor-report-chart',
           directive: 'raptor-report-chart',
           size: {
             width: '50%',
             height: '300px'
           }
        },
       {
          name: 'r-cloud',
          directive: 'r-cloud',
          size: {
            width: '50%',
            height: '300px'
           }
        }       
    ];
    
  })
  .value('defaultWidgets', [
//    { name: 'random' },
//    { name: 'time' },
//    { name: 'datamodel' },
//    {
//      name: 'random',
//      style: {
//        width: '50%',
//        minWidth: '39%'
//      }
//    },
//    {
//      name: 'time',
//      style: {
//        width: '50%'
//      }
//    }
//	{"name":"raptor-report","title":"Spam Source Line Chart","style":{},"size":{"height":"450px","width":"40%"},"attrs":{"value":"randomValue"},"report_id":"3360"}
	
  ])
  .controller('DemoCtrl', function ($scope, $interval, $window, widgetDefinitions, defaultWidgets) {
    
    $scope.dashboardOptions = {
      widgetButtons: true,
      widgetDefinitions: widgetDefinitions,
      defaultWidgets: defaultWidgets,
      storage: $window.localStorage,
      storageId: 'demo_simple'
    };
    $scope.randomValue = Math.random();
    $interval(function () {
      $scope.randomValue = Math.random();
    }, 500);

  });