nutella_framework 0.4.23 → 0.4.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/framework_components/monitoring-bot/monitoring-bot.rb +11 -2
  4. data/framework_components/monitoring-interface/.gitignore +2 -0
  5. data/framework_components/monitoring-interface/README.md +1 -0
  6. data/framework_components/monitoring-interface/bower.json +29 -0
  7. data/framework_components/monitoring-interface/bower_components/bower-mqttws/.bower.json +23 -0
  8. data/framework_components/monitoring-interface/bower_components/bower-mqttws/bower.json +14 -0
  9. data/framework_components/monitoring-interface/bower_components/bower-mqttws/mqttws31.js +2081 -0
  10. data/framework_components/monitoring-interface/bower_components/bower-mqttws/readme.md +4 -0
  11. data/framework_components/monitoring-interface/bower_components/nutella_lib/.bower.json +37 -0
  12. data/framework_components/monitoring-interface/bower_components/nutella_lib/LICENSE +21 -0
  13. data/framework_components/monitoring-interface/bower_components/nutella_lib/README.md +15 -0
  14. data/framework_components/monitoring-interface/bower_components/nutella_lib/bower.json +28 -0
  15. data/framework_components/monitoring-interface/bower_components/nutella_lib/examples/browser/mqtt_client_hello_world.html +23 -0
  16. data/framework_components/monitoring-interface/bower_components/nutella_lib/examples/browser/nutella_hello_world.html +52 -0
  17. data/framework_components/monitoring-interface/bower_components/nutella_lib/examples/node/mqtt_client_hello_world.js +14 -0
  18. data/framework_components/monitoring-interface/bower_components/nutella_lib/examples/node/nutella_hello_world.js +38 -0
  19. data/framework_components/monitoring-interface/bower_components/nutella_lib/nutella_lib.js +789 -0
  20. data/framework_components/monitoring-interface/bower_components/nutella_lib/package.json +30 -0
  21. data/framework_components/monitoring-interface/css/Monitoring Interface.html +215 -0
  22. data/framework_components/monitoring-interface/css/Monitoring Interface_files/animations.js +27 -0
  23. data/framework_components/monitoring-interface/css/Monitoring Interface_files/application-view-controller.js +232 -0
  24. data/framework_components/monitoring-interface/css/Monitoring Interface_files/applications-model.js +61 -0
  25. data/framework_components/monitoring-interface/css/Monitoring Interface_files/bootstrap.min.js +7 -0
  26. data/framework_components/monitoring-interface/css/Monitoring Interface_files/cursor.css +7 -0
  27. data/framework_components/monitoring-interface/css/Monitoring Interface_files/d3.v3.min.js +5 -0
  28. data/framework_components/monitoring-interface/css/Monitoring Interface_files/graphics.js +156 -0
  29. data/framework_components/monitoring-interface/css/Monitoring Interface_files/grid-layout.js +103 -0
  30. data/framework_components/monitoring-interface/css/Monitoring Interface_files/highlight.min.js +2 -0
  31. data/framework_components/monitoring-interface/css/Monitoring Interface_files/instance-view-controller.js +104 -0
  32. data/framework_components/monitoring-interface/css/Monitoring Interface_files/jquery-1.10.0.min.js +6 -0
  33. data/framework_components/monitoring-interface/css/Monitoring Interface_files/notification-center.js +63 -0
  34. data/framework_components/monitoring-interface/css/Monitoring Interface_files/notifications.js +14 -0
  35. data/framework_components/monitoring-interface/css/Monitoring Interface_files/page.css +33 -0
  36. data/framework_components/monitoring-interface/css/Monitoring Interface_files/radial-layout.js +175 -0
  37. data/framework_components/monitoring-interface/css/Monitoring Interface_files/tab-table.js +8 -0
  38. data/framework_components/monitoring-interface/css/Monitoring Interface_files/ui-application.css +0 -0
  39. data/framework_components/monitoring-interface/css/Monitoring Interface_files/ui-application.js +320 -0
  40. data/framework_components/monitoring-interface/css/Monitoring Interface_files/ui-connection-view.css +10 -0
  41. data/framework_components/monitoring-interface/css/Monitoring Interface_files/ui-connection-view.js +426 -0
  42. data/framework_components/monitoring-interface/css/Monitoring Interface_files/ui-element.js +205 -0
  43. data/framework_components/monitoring-interface/css/Monitoring Interface_files/ui-notification.js +94 -0
  44. data/framework_components/monitoring-interface/css/Monitoring Interface_files/ui-tab.js +229 -0
  45. data/framework_components/monitoring-interface/css/Monitoring Interface_files/underscore-min.js +5 -0
  46. data/framework_components/monitoring-interface/css/Monitoring Interface_files/view-controller.js +68 -0
  47. data/framework_components/monitoring-interface/css/Monitoring Interface_files/window-view-controller.js +169 -0
  48. data/framework_components/monitoring-interface/css/alerts.css +3 -0
  49. data/framework_components/monitoring-interface/css/bootstrap.min.css +5 -0
  50. data/framework_components/monitoring-interface/css/cursor.css +7 -0
  51. data/framework_components/monitoring-interface/css/highlight.default.min.css +1 -0
  52. data/framework_components/monitoring-interface/css/page.css +41 -0
  53. data/framework_components/monitoring-interface/css/ui-application.css +0 -0
  54. data/framework_components/monitoring-interface/css/ui-connection-view.css +10 -0
  55. data/framework_components/monitoring-interface/css/ui-legend-view.css +7 -0
  56. data/framework_components/monitoring-interface/data/alert.json +8 -0
  57. data/framework_components/monitoring-interface/data/data.json +2118 -0
  58. data/framework_components/monitoring-interface/data/data2.json +814 -0
  59. data/framework_components/monitoring-interface/data/data3.json +823 -0
  60. data/framework_components/monitoring-interface/data/data4.json +848 -0
  61. data/framework_components/monitoring-interface/data/message.json +999 -0
  62. data/framework_components/monitoring-interface/gulpfile.js +29 -0
  63. data/framework_components/monitoring-interface/img/arrow_white.svg +120 -0
  64. data/framework_components/monitoring-interface/img/arrow_white_right.svg +104 -0
  65. data/framework_components/monitoring-interface/img/back.svg +164 -0
  66. data/framework_components/monitoring-interface/img/cross_red_border_white.svg +143 -0
  67. data/framework_components/monitoring-interface/img/cross_red_border_white_mouseover.svg +143 -0
  68. data/framework_components/monitoring-interface/img/email.svg +89 -0
  69. data/framework_components/monitoring-interface/img/email_highlighted.svg +89 -0
  70. data/framework_components/monitoring-interface/index.html +144 -0
  71. data/framework_components/monitoring-interface/js/d3/layout/grid-layout.js +103 -0
  72. data/framework_components/monitoring-interface/js/d3/layout/radial-layout.js +184 -0
  73. data/framework_components/monitoring-interface/js/d3/plugin/graphics.js +156 -0
  74. data/framework_components/monitoring-interface/js/d3/plugin/tab-table.js +8 -0
  75. data/framework_components/monitoring-interface/js/d3/ui/animations.js +27 -0
  76. data/framework_components/monitoring-interface/js/d3/ui/ui-application.js +471 -0
  77. data/framework_components/monitoring-interface/js/d3/ui/ui-connection-view.js +847 -0
  78. data/framework_components/monitoring-interface/js/d3/ui/ui-element.js +245 -0
  79. data/framework_components/monitoring-interface/js/d3/ui/ui-legend.js +174 -0
  80. data/framework_components/monitoring-interface/js/d3/ui/ui-notification.js +90 -0
  81. data/framework_components/monitoring-interface/js/d3/ui/ui-tab.js +309 -0
  82. data/framework_components/monitoring-interface/js/lib/JSXTransformer-0.12.2.js +15199 -0
  83. data/framework_components/monitoring-interface/js/lib/bootstrap.min.js +7 -0
  84. data/framework_components/monitoring-interface/js/lib/d3.v3.min.js +5 -0
  85. data/framework_components/monitoring-interface/js/lib/highlight.min.js +2 -0
  86. data/framework_components/monitoring-interface/js/lib/jquery-1.10.0.min.js +6 -0
  87. data/framework_components/monitoring-interface/js/lib/nutella_lib.js +5121 -0
  88. data/framework_components/monitoring-interface/js/lib/react-with-addons-0.12.2.js +19822 -0
  89. data/framework_components/monitoring-interface/js/lib/underscore-min.js +5 -0
  90. data/framework_components/monitoring-interface/js/model/alerts-model.js +74 -0
  91. data/framework_components/monitoring-interface/js/model/applications-model.js +78 -0
  92. data/framework_components/monitoring-interface/js/model/messages-model.js +112 -0
  93. data/framework_components/monitoring-interface/js/notification/notification-center.js +63 -0
  94. data/framework_components/monitoring-interface/js/notification/notifications.js +21 -0
  95. data/framework_components/monitoring-interface/js/react/dist/ui-alerts.js +178 -0
  96. data/framework_components/monitoring-interface/js/react/dist/ui-message-send.js +389 -0
  97. data/framework_components/monitoring-interface/js/react/dist/ui-messages.js +103 -0
  98. data/framework_components/monitoring-interface/js/react/src/ui-alerts.js +178 -0
  99. data/framework_components/monitoring-interface/js/react/src/ui-message-send.js +389 -0
  100. data/framework_components/monitoring-interface/js/react/src/ui-messages.js +103 -0
  101. data/framework_components/monitoring-interface/js/view-controller/application-view-controller.js +256 -0
  102. data/framework_components/monitoring-interface/js/view-controller/instance-view-controller.js +112 -0
  103. data/framework_components/monitoring-interface/js/view-controller/view-controller.js +74 -0
  104. data/framework_components/monitoring-interface/js/view-controller/window-view-controller.js +169 -0
  105. data/framework_components/monitoring-interface/nutella.json +6 -0
  106. data/framework_components/order.json +1 -0
  107. data/framework_components/roomcast-bot/roomcast_bot.rb +139 -117
  108. data/framework_components/roomcast-channel-creator/dist/app.js +9 -7
  109. data/framework_components/roomcast-channel-creator/index.html +1 -1
  110. data/framework_components/roomcast-channel-creator/src/app/components/main.js +8 -6
  111. data/framework_components/roomcast-package-creator/dist/app.js +4 -4
  112. data/framework_components/roomcast-package-creator/index.html +1 -1
  113. data/framework_components/roomcast-package-creator/package.json +3 -3
  114. data/framework_components/roomcast-package-creator/src/app/components/ConfigurationsPanel.js +2 -2
  115. data/framework_components/roomcast-package-creator/src/app/components/PoolRow.js +1 -1
  116. data/framework_components/roomcast-teacher-controls/.gitignore +2 -0
  117. data/framework_components/roomcast-teacher-controls/README.md +9 -0
  118. data/framework_components/roomcast-teacher-controls/dist/app.js +38327 -0
  119. data/framework_components/roomcast-teacher-controls/dist/main.css +3052 -0
  120. data/framework_components/roomcast-teacher-controls/dist/nutella_lib.js +5121 -0
  121. data/framework_components/roomcast-teacher-controls/gulp/config.js +51 -0
  122. data/framework_components/roomcast-teacher-controls/gulp/tasks/browserify.js +77 -0
  123. data/framework_components/roomcast-teacher-controls/gulp/tasks/build.js +3 -0
  124. data/framework_components/roomcast-teacher-controls/gulp/tasks/css.js +7 -0
  125. data/framework_components/roomcast-teacher-controls/gulp/tasks/default.js +3 -0
  126. data/framework_components/roomcast-teacher-controls/gulp/tasks/fonts.js +7 -0
  127. data/framework_components/roomcast-teacher-controls/gulp/tasks/less.js +16 -0
  128. data/framework_components/roomcast-teacher-controls/gulp/tasks/mui-fonts.js +7 -0
  129. data/framework_components/roomcast-teacher-controls/gulp/tasks/nutella.js +7 -0
  130. data/framework_components/roomcast-teacher-controls/gulp/tasks/setWatch.js +5 -0
  131. data/framework_components/roomcast-teacher-controls/gulp/tasks/svgs.js +7 -0
  132. data/framework_components/roomcast-teacher-controls/gulp/tasks/watch.js +12 -0
  133. data/framework_components/roomcast-teacher-controls/gulp/util/bundleLogger.js +21 -0
  134. data/framework_components/roomcast-teacher-controls/gulp/util/handleErrors.js +15 -0
  135. data/framework_components/roomcast-teacher-controls/gulpfile.js +16 -0
  136. data/framework_components/roomcast-teacher-controls/index.html +51 -0
  137. data/framework_components/roomcast-teacher-controls/nutella.json +6 -0
  138. data/framework_components/roomcast-teacher-controls/package.json +38 -0
  139. data/framework_components/roomcast-teacher-controls/src/app/app.js +22 -0
  140. data/framework_components/roomcast-teacher-controls/src/app/components/ActivitiesGrid.js +87 -0
  141. data/framework_components/roomcast-teacher-controls/src/app/components/ActivityCard.js +141 -0
  142. data/framework_components/roomcast-teacher-controls/src/app/components/Channel.js +70 -0
  143. data/framework_components/roomcast-teacher-controls/src/app/components/Footer.js +34 -0
  144. data/framework_components/roomcast-teacher-controls/src/app/components/main.js +74 -0
  145. data/framework_components/roomcast-teacher-controls/src/less/main.less +186 -0
  146. data/framework_components/roomcast-teacher-controls/src/less/my_overrides.less +14 -0
  147. data/lib/commands/meta/run_command.rb +11 -9
  148. metadata +135 -2
@@ -0,0 +1,256 @@
1
+ var ApplicationViewController = function(name, view) {
2
+ var self = ViewController(view);
3
+
4
+ // Protected variables
5
+ self._instanceViewControllers = {};
6
+ self._expansionAnimationFinished = undefined;
7
+ self._reductionAnimationFinished = undefined;
8
+ self._notification = undefined;
9
+ self._legend = undefined;
10
+
11
+ // Public variables
12
+ self.name = undefined;
13
+ self.coordinates = undefined;
14
+
15
+ // Render function of the component
16
+ var render = self.render;
17
+
18
+ self.render = function() {
19
+ var data = applicationModel.getApplicationData(self.name);
20
+
21
+ // Check if the notification must be displayed or not
22
+ if(self.expanded || self.notification() == 0) {
23
+ self._notification.show = false;
24
+ }
25
+ else {
26
+ self._notification.show = true;
27
+ }
28
+
29
+ if(self.expanded) {
30
+ self._legend.show = true;
31
+ }
32
+ else {
33
+ self._legend.show = false;
34
+ }
35
+
36
+ render();
37
+
38
+ self.renderInstances();
39
+ };
40
+
41
+
42
+
43
+ self.mouseOverEffect = function (backGroundRect, color) {
44
+ backGroundRect.fill(color);
45
+ };
46
+
47
+ self.mouseOutEffect = function (backGroundRect, color) {
48
+ backGroundRect.fill(color);
49
+ };
50
+
51
+ self.closeButtonClicked = function() {
52
+ self.clicked();
53
+ };
54
+
55
+ self.subscribeButtonClicked = function() {
56
+ $('#mailDisplay').modal({ show: true});
57
+ alertsModel.application = self.name;
58
+ alertsModel.instance = undefined;
59
+ alertsModel.component = undefined;
60
+ alertsModel.fetchData();
61
+ };
62
+
63
+ self.reduce = function() {
64
+ if(self.expanded == true) {
65
+ applicationModel.viewControllerApplicationSelected = undefined;
66
+ notificationCenter.dispatch(Notifications.ui.APPLICATION_CLICKED);
67
+ windowViewController.resetCenter();
68
+ notificationCenter.dispatch(Notifications.ui.APPLICATION_REDUCTION_STARTED);
69
+
70
+ // Notify the end of the animation
71
+ setTimeout(function(){
72
+ notificationCenter.dispatch(Notifications.ui.APPLICATION_REDUCTION_FINISHED);
73
+ }, Animations.application.APPLICATION_REDUCTION.delay + Animations.application.APPLICATION_REDUCTION.duration);
74
+ }
75
+ };
76
+
77
+ self.clicked = function() {
78
+
79
+ if(self.expanded == false) {
80
+ // Deselect the instance
81
+ applicationModel.viewControllerInstanceSelected = undefined;
82
+
83
+ applicationModel.viewControllerApplicationSelected = self;
84
+ notificationCenter.dispatch(Notifications.ui.APPLICATION_CLICKED);
85
+ windowViewController.center(self.coordinates.x, self.coordinates.y);
86
+ notificationCenter.dispatch(Notifications.ui.APPLICATION_EXPANSION_STARTED);
87
+
88
+ // Notify the end of the animation
89
+ setTimeout(function(){
90
+ notificationCenter.dispatch(Notifications.ui.APPLICATION_EXPANSION_FINISHED);
91
+ }, Animations.application.APPLICATION_EXPANSION.delay + Animations.application.APPLICATION_EXPANSION.duration);
92
+
93
+ }
94
+ else {
95
+ applicationModel.viewControllerApplicationSelected = undefined;
96
+ notificationCenter.dispatch(Notifications.ui.APPLICATION_CLICKED);
97
+ windowViewController.resetCenter();
98
+ notificationCenter.dispatch(Notifications.ui.APPLICATION_REDUCTION_STARTED);
99
+
100
+ // Notify the end of the animation
101
+ setTimeout(function(){
102
+ notificationCenter.dispatch(Notifications.ui.APPLICATION_REDUCTION_FINISHED);
103
+ }, Animations.application.APPLICATION_REDUCTION.delay + Animations.application.APPLICATION_REDUCTION.duration);
104
+ }
105
+
106
+ self.render();
107
+ };
108
+
109
+ // Data relative to the current selected instance
110
+ self.__defineGetter__("instanceComponentData", function() {
111
+ if(applicationModel.viewControllerInstanceSelected == undefined)
112
+ return undefined;
113
+
114
+ var instanceData = applicationModel.getInstanceData(self.name, applicationModel.viewControllerInstanceSelected.name);
115
+
116
+ return instanceData.components;
117
+ // TODO: fix here
118
+
119
+
120
+ if(instanceData != undefined)
121
+ return instanceData.components;
122
+ else
123
+ return undefined;
124
+ });
125
+
126
+ self.__defineGetter__("expanded", function() {
127
+ return self == applicationModel.viewControllerApplicationSelected;
128
+ });
129
+
130
+ self.__defineGetter__("status", function() {
131
+ return applicationModel.getApplicationData(self.name).problems == undefined || applicationModel.getApplicationData(self.name).problems == 0;
132
+ });
133
+
134
+ self.notification = function(name) {
135
+ var data = applicationModel.getApplicationData(self.name);
136
+
137
+ if(name == undefined) {
138
+ if(data.problems == undefined) {
139
+ return 0;
140
+ }
141
+ return data.problems;
142
+ }
143
+
144
+ var instance = data.instances.filter(function(instance) {
145
+ return instance.name == name;
146
+ });
147
+
148
+ if(instance.length == 0) {
149
+ return 0;
150
+ }
151
+
152
+ if(instance[0].problems == undefined) {
153
+ return 0;
154
+ }
155
+
156
+ return instance[0].problems;
157
+ };
158
+
159
+ self.renderInstances = function() {
160
+ var instances = applicationModel.getApplicationData(self.name).instances;
161
+ if(instances != undefined) {
162
+
163
+ // Create new instance tabs
164
+ self._view.selectAll(".instance_tabs")
165
+ .data(instances)
166
+ .enter()
167
+ .tabTable()
168
+ .append("g")
169
+ .class("instance_tab")
170
+ .each(function(data, index) {
171
+ this.instanceViewController = InstanceViewController(self, data.name, index, d3.select(this).newView());
172
+ self._instanceViewControllers[data.name] = this.instanceViewController;
173
+
174
+ // Set the first instance as selected
175
+ if(applicationModel.viewControllerInstanceSelected == undefined && self.expanded) {
176
+ applicationModel.viewControllerInstanceSelected = this.instanceViewController;
177
+ }
178
+ });
179
+
180
+ // Update instance tabs
181
+ self._view.selectAll(".instance_tab")
182
+ .data(instances)
183
+ .each(function(data) {
184
+ var instanceViewController = this.instanceViewController;
185
+ instanceViewController.name = data.name;
186
+
187
+ // Render the application
188
+ instanceViewController.render();
189
+ });
190
+
191
+ // Delete instance tabs
192
+ self._view.selectAll(".instance_tab")
193
+ .data(instances)
194
+ .exit()
195
+ .each(function(data) {
196
+ var instanceViewController = this.instanceViewController;
197
+ instanceViewController.deinit();
198
+ delete self._instanceViewControllers[data.name];
199
+ })
200
+ .remove();
201
+ }
202
+ };
203
+
204
+
205
+ // Constructor
206
+ self.init = function() {
207
+
208
+ self.coordinates = {x: 0, y: 0};
209
+
210
+ self.name = name;
211
+
212
+ // Add graphic components
213
+ self.addUIApplication(); // Graphical visualization of the application
214
+ self.addUIConnectionView(); // Connection view component
215
+ self._notification = self.addUINotification(); // Application notification
216
+ self._notification.x = 50;
217
+ self._notification.y = -50;
218
+ self._legend = self.addUILegend(); // Graph legend
219
+
220
+ notificationCenter.subscribe(Notifications.ui.APPLICATION_CLICKED, function() {
221
+ self.render();
222
+ });
223
+
224
+ notificationCenter.subscribe(Notifications.ui.APPLICATION_EXPANSION_FINISHED, function() {
225
+ self._expansionAnimationFinished = true;
226
+ });
227
+
228
+ notificationCenter.subscribe(Notifications.ui.APPL, function() {
229
+ self._expansionAnimationFinished = true;
230
+ });
231
+
232
+
233
+ var oldCoordinates = undefined;
234
+
235
+ notificationCenter.subscribe(Notifications.ui.APPLICATION_EXPANSION_STARTED, function() {
236
+ oldCoordinates = self.coordinates;
237
+ self.coordinates = {x: (self.coordinates.x - windowViewController.width/2) * 15,
238
+ y: (self.coordinates.y - windowViewController.height/2) * 15
239
+ };
240
+ if(self.expanded == false) {
241
+ self._view.transition().duration(400).translate(self.coordinates.x, self.coordinates.y);
242
+ }
243
+ });
244
+
245
+ notificationCenter.subscribe(Notifications.ui.INSTANCE_CLICKED, function() {
246
+ self.render();
247
+ });
248
+ }();
249
+
250
+ // Destructor
251
+ self.deinit = function() {
252
+ applicationModel.viewControllerInstanceSelected = undefined;
253
+ };
254
+ return self;
255
+
256
+ };
@@ -0,0 +1,112 @@
1
+ var InstanceViewController = function(parentApplicationViewController, name, index, layer) {
2
+ var self = ViewController(layer);
3
+
4
+ // Public variables
5
+ self.name = undefined;
6
+ self.applicationName = undefined;
7
+ self.parentApplicationViewController = undefined;
8
+ self.tab = undefined;
9
+ self._notification = undefined;
10
+
11
+ var render = self.render;
12
+ self.render = function() {
13
+
14
+ // Position the graphical objects
15
+ self.tab.x = - windowViewController.width / 2 +
16
+ UITab.style.width / 2 +
17
+ UIApplication.style.margin;
18
+
19
+ self.tab.y = - windowViewController.height / 2 +
20
+ UITab.style.height / 2 +
21
+ UITab.style.height * index +
22
+ UIApplication.style.margin +
23
+ UIApplication.style.headerRectHeightExpanded;
24
+
25
+ if(parentApplicationViewController == applicationModel.viewControllerApplicationSelected) {
26
+ self.tab.show = true;
27
+ }
28
+ else {
29
+ self.tab.show = false;
30
+ }
31
+
32
+ self._notification.x = - windowViewController.width / 2 +
33
+ UITab.style.width +
34
+ UIApplication.style.margin -
35
+ UINotification.style.margin.x;
36
+
37
+
38
+ self._notification.y = - windowViewController.height / 2 +
39
+ UITab.style.height * index +
40
+ UIApplication.style.margin +
41
+ UIApplication.style.headerRectHeightExpanded +
42
+ UINotification.style.margin.y;
43
+
44
+ // Display notification only if errors are present
45
+ if(applicationModel.viewControllerApplicationSelected == self.parentApplicationViewController &&
46
+ self.notification() > 0) {
47
+ self._notification.show = true;
48
+ }
49
+ else {
50
+ self._notification.show = false;
51
+ }
52
+
53
+ render();
54
+ };
55
+
56
+ self.clicked = function() {
57
+ if(!self.selected) {
58
+ applicationModel.viewControllerInstanceSelected = self;
59
+ notificationCenter.dispatch(Notifications.ui.INSTANCE_CLICKED);
60
+ }
61
+ };
62
+
63
+ self.subscribeButtonClicked = function() {
64
+ alertsModel.application = applicationModel.viewControllerApplicationSelected.name;
65
+ alertsModel.instance = self.name;
66
+ alertsModel.component = undefined;
67
+ $('#mailDisplay').modal({ show: true});
68
+ alertsModel.fetchData();
69
+ };
70
+
71
+ // Getters
72
+ self.__defineGetter__("selected", function() {
73
+ if(applicationModel.viewControllerInstanceSelected == undefined)
74
+ return false;
75
+
76
+ return self.name == applicationModel.viewControllerInstanceSelected.name &&
77
+ self.applicationName == applicationModel.viewControllerInstanceSelected.applicationName;
78
+ });
79
+
80
+ self.getTabsNumber = function() {
81
+ return _.size(self.parentApplicationViewController._instanceViewControllers);
82
+ };
83
+
84
+ self.notification = function() {
85
+ return self.parentApplicationViewController.notification(name);
86
+ };
87
+
88
+ // Constructor
89
+ self.init = function() {
90
+ self.name = name;
91
+ self.parentApplicationViewController = parentApplicationViewController;
92
+ self.applicationName = self.parentApplicationViewController.name;
93
+ //self.selected = false;
94
+
95
+ self.tab = self.addUITab(self.name);
96
+
97
+ // Calculate the position of the notification and add it
98
+ self._notification = self.addUINotification();
99
+
100
+ notificationCenter.subscribe(Notifications.ui.INSTANCE_CLICKED, self.render);
101
+ notificationCenter.subscribe(Notifications.ui.APPLICATION_EXPANSION_FINISHED, self.render);
102
+ }();
103
+
104
+ // Destructor
105
+ self.deinit = function() {
106
+ notificationCenter.unsubscribe(Notifications.ui.INSTANCE_CLICKED, self.render);
107
+ notificationCenter.unsubscribe(Notifications.ui.APPLICATION_EXPANSION_FINISHED, self.render);
108
+ };
109
+
110
+ return self;
111
+
112
+ };
@@ -0,0 +1,74 @@
1
+ var ViewController = function(view) {
2
+ var self = {};
3
+
4
+ // Protected variables
5
+ self._view = undefined;
6
+ self._uis = [];
7
+
8
+ //#GETTER AND SETTER
9
+ self.__defineSetter__("view", function(view){
10
+ self._view = view;
11
+ });
12
+
13
+ self.__defineGetter__("view", function(){
14
+ return self._view;
15
+ });
16
+
17
+ self.render = function() {
18
+ self._uis.forEach(function(ui) {
19
+ ui.render(self._view);
20
+ });
21
+ };
22
+
23
+ // Add ui components
24
+ self.addUIApplication = function() {
25
+ var uiApplication = UIApplication(self);
26
+ self.addUiComponent(uiApplication);
27
+ return uiApplication;
28
+ };
29
+
30
+ self.addUIConnectionView = function() {
31
+ var uiConnectionView = UIConnectionView(self);
32
+ self.addUiComponent(uiConnectionView);
33
+ return uiConnectionView;
34
+ };
35
+
36
+ self.addUITab = function(name) {
37
+ var uiTab = UITab(self, name);
38
+ self.addUiComponent(uiTab);
39
+ return uiTab;
40
+ };
41
+
42
+ self.addUINotification = function(notificationName) {
43
+ var uiNotification = UINotification(self);
44
+ uiNotification.name = notificationName;
45
+ self.addUiComponent(uiNotification);
46
+ return uiNotification;
47
+ };
48
+
49
+ self.addUILegend = function() {
50
+ var uiLegend = UILegend(self);
51
+ self.addUiComponent(uiLegend);
52
+ return uiLegend;
53
+ };
54
+
55
+ self.addUiComponent = function(ui) {
56
+ self._uis.push(ui);
57
+ };
58
+
59
+ self.newView = function() {
60
+ return self._view.newView();
61
+ };
62
+
63
+ // Constructor
64
+ self.init = function() {
65
+ self._view = view;
66
+ }();
67
+
68
+ // Destructor
69
+ self.deinit = function() {
70
+ self._view.remove();
71
+ };
72
+
73
+ return self;
74
+ };
@@ -0,0 +1,169 @@
1
+ var WindowViewController = function(view) {
2
+ var self = ViewController(view);
3
+
4
+ // Static variables
5
+ WindowViewController.style = {
6
+ margin: 10
7
+ };
8
+
9
+ // Protected variables
10
+ self._width = undefined;
11
+ self._height = undefined;
12
+ self._applicationViewControllers = {}; // UIApplication array
13
+ self._center = undefined;
14
+
15
+
16
+ // Private variables
17
+ var rectGrid = undefined;
18
+
19
+ self.updateViewBoxAnimated = function() {
20
+ self._width = window.innerWidth;
21
+ self._height = window.innerHeight;
22
+ if(self._center == undefined)
23
+ self._view.transition().attr("viewBox", "0 0 " + self._width + " " + self._height);
24
+ else
25
+ self._view.transition().attr("viewBox", (-self._width/2 + self._center.x) + " " + (-self._height/2 + self._center.y) + " " + self._width + " " + self._height);
26
+ };
27
+
28
+ self.updateViewBox = function() {
29
+ self._width = window.innerWidth;
30
+ self._height = window.innerHeight;
31
+ if(self._center == undefined)
32
+ self._view.attr("viewBox", "0 0 " + self._width + " " + self._height);
33
+ else
34
+ self._view.attr("viewBox", (-self._width/2 + self._center.x) + " " + (-self._height/2 + self._center.y) + " " + self._width + " " + self._height);
35
+ };
36
+
37
+ self.updateRectGrid = function() {
38
+ rectGrid = d3.layout.grid()
39
+ .bands()
40
+ .size([window.innerWidth - WindowViewController.style.margin,
41
+ window.innerHeight- WindowViewController.style.margin])
42
+ .padding([0.1, 0.1]);
43
+ };
44
+
45
+ self.resizeWindow = function() {
46
+
47
+ self.updateViewBox();
48
+
49
+ self.updateRectGrid();
50
+
51
+ if(applicationModel.data != undefined) {
52
+ self.renderData(applicationModel.data.applications)
53
+ }
54
+
55
+ //TODO: Send notification
56
+ };
57
+
58
+ //#GETTER AND SETTER
59
+ self.__defineGetter__("height", function(){
60
+ return self._height;
61
+ });
62
+
63
+ self.__defineGetter__("width", function(){
64
+ return self._width;
65
+ });
66
+
67
+
68
+
69
+ // Render function of the component
70
+ self.renderData = function(data) {
71
+
72
+ // Create application view controllers
73
+ self._view.selectAll(".applicationView")
74
+ .data(data)
75
+ .enter()
76
+ .append("g")
77
+ .class("applicationView")
78
+ .translate(self._width / 2, self._height / 2)
79
+ .each(function(data) {
80
+ var applicationViewController = ApplicationViewController(data.name, d3.select(this));
81
+ this.applicationViewController = applicationViewController;
82
+ self._applicationViewControllers[data.name] = applicationViewController;
83
+ });
84
+
85
+ // Update data in applications
86
+ self._view.selectAll(".applicationView")
87
+ .data(rectGrid(data))
88
+ .transition()
89
+ .duration(Animations.application.GRID_LAYOUT_REPOSITION.duration)
90
+ //.attr("transform", function(d) { return "translate(" + (d.x + rectGrid.nodeSize()[0]/2) + "," + (d.y + rectGrid.nodeSize()[1]/2) + ")"; })
91
+ .each(function(data) {
92
+ var applicationViewController = this.applicationViewController;
93
+ applicationViewController.name = data.name;
94
+ applicationViewController.coordinates = {
95
+ x: data.x + rectGrid.nodeSize()[0] / 2,
96
+ y: data.y + rectGrid.nodeSize()[1] / 2
97
+ };
98
+
99
+ // Render the application
100
+ applicationViewController.render();
101
+ });
102
+
103
+ // Update the application position
104
+ if(applicationModel.viewControllerApplicationSelected == undefined) {
105
+ // Update the position of all appllications
106
+ self._view.selectAll(".applicationView")
107
+ .data(rectGrid(data))
108
+ .transition()
109
+ .duration(Animations.application.GRID_LAYOUT_REPOSITION.duration)
110
+ .attr("transform", function (d) {
111
+ return "translate(" + (d.x + rectGrid.nodeSize()[0] / 2) + "," + (d.y + rectGrid.nodeSize()[1] / 2) + ")";
112
+ });
113
+ }
114
+
115
+
116
+ // Delete old applications
117
+ self._view.selectAll(".applicationView")
118
+ .data(data)
119
+ .exit()
120
+ .each(function(data) {
121
+ var applicationViewController = this.applicationViewController;
122
+ applicationViewController.deinit();
123
+ delete self._applicationViewControllers[data.name];
124
+ })
125
+ .remove();
126
+ };
127
+
128
+ self.center = function(x, y) {
129
+ self._center = {x: x, y: y};
130
+ self.updateViewBoxAnimated();
131
+ };
132
+
133
+ self.resetCenter = function() {
134
+ self._center = undefined;
135
+ self.updateViewBoxAnimated();
136
+ };
137
+
138
+ // Constructor
139
+ self.init = function() {
140
+
141
+ // Subscribe to data notification
142
+ notificationCenter.subscribe(Notifications.data.APPLICATION_DATA_CHANGE,
143
+ function() {
144
+ self.updateRectGrid();
145
+ self.renderData(applicationModel.data.applications);
146
+ });
147
+
148
+ notificationCenter.subscribe(Notifications.ui.APPLICATION_REDUCTION_FINISHED,
149
+ function() {
150
+ self.updateRectGrid();
151
+ self.renderData(applicationModel.data.applications);
152
+ });
153
+
154
+ window.addEventListener("resize", self.resizeWindow);
155
+
156
+ // Init the grid layout
157
+ self.updateRectGrid();
158
+ }();
159
+
160
+ // Destructor
161
+ self.deinit = function() {
162
+ // Place here the code for dealloc eventual objects
163
+ };
164
+
165
+ return self;
166
+
167
+ };
168
+
169
+ var windowViewController = WindowViewController();
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "monitoring-interface",
3
+ "version": "0.0.1",
4
+ "type": "interface",
5
+ "description": "The web interface of Monitoring"
6
+ }
@@ -1,4 +1,5 @@
1
1
  [
2
+ "monitoring-bot",
2
3
  "logging_bot",
3
4
  "runs_list_bot",
4
5
  "main_interface",