mongo3 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/README.rdoc +6 -2
  2. data/Rakefile +1 -0
  3. data/data/populate +13 -11
  4. data/lib/controllers/databases.rb +3 -3
  5. data/lib/controllers/explore.rb +7 -5
  6. data/lib/helpers/main_helper.rb +24 -0
  7. data/lib/mongo3/connection.rb +105 -59
  8. data/lib/mongo3/node.rb +35 -6
  9. data/lib/mongo3.rb +1 -1
  10. data/lib/public/javascripts/{Jit/jit.js → jit.js} +0 -0
  11. data/lib/views/databases/_results.erb +29 -12
  12. data/lib/views/explore/explore.erb +52 -31
  13. data/lib/views/layout.erb +2 -6
  14. data/spec/mongo3/connection_spec.rb +40 -6
  15. metadata +13 -45
  16. data/lib/public/javascripts/Jit/Examples/Hypertree/example1.html +0 -57
  17. data/lib/public/javascripts/Jit/Examples/Hypertree/example1.js +0 -427
  18. data/lib/public/javascripts/Jit/Examples/Hypertree/example2.html +0 -58
  19. data/lib/public/javascripts/Jit/Examples/Hypertree/example2.js +0 -310
  20. data/lib/public/javascripts/Jit/Examples/Hypertree/example3.html +0 -199
  21. data/lib/public/javascripts/Jit/Examples/Hypertree/example3.js +0 -615
  22. data/lib/public/javascripts/Jit/Examples/Other/example1.html +0 -58
  23. data/lib/public/javascripts/Jit/Examples/Other/example1.js +0 -566
  24. data/lib/public/javascripts/Jit/Examples/Other/example2.html +0 -58
  25. data/lib/public/javascripts/Jit/Examples/Other/example2.js +0 -304
  26. data/lib/public/javascripts/Jit/Examples/Other/example3.html +0 -58
  27. data/lib/public/javascripts/Jit/Examples/Other/example3.js +0 -304
  28. data/lib/public/javascripts/Jit/Examples/RGraph/example1.html +0 -57
  29. data/lib/public/javascripts/Jit/Examples/RGraph/example1.js +0 -475
  30. data/lib/public/javascripts/Jit/Examples/RGraph/example2.html +0 -58
  31. data/lib/public/javascripts/Jit/Examples/RGraph/example2.js +0 -356
  32. data/lib/public/javascripts/Jit/Examples/RGraph/example3.html +0 -199
  33. data/lib/public/javascripts/Jit/Examples/RGraph/example3.js +0 -622
  34. data/lib/public/javascripts/Jit/Examples/Spacetree/example1.html +0 -91
  35. data/lib/public/javascripts/Jit/Examples/Spacetree/example1.js +0 -890
  36. data/lib/public/javascripts/Jit/Examples/Spacetree/example2.html +0 -90
  37. data/lib/public/javascripts/Jit/Examples/Spacetree/example2.js +0 -213
  38. data/lib/public/javascripts/Jit/Examples/Spacetree/example3.html +0 -75
  39. data/lib/public/javascripts/Jit/Examples/Spacetree/example3.js +0 -863
  40. data/lib/public/javascripts/Jit/Examples/Treemap/example1.html +0 -56
  41. data/lib/public/javascripts/Jit/Examples/Treemap/example1.js +0 -95
  42. data/lib/public/javascripts/Jit/Examples/Treemap/example2.html +0 -61
  43. data/lib/public/javascripts/Jit/Examples/Treemap/example2.js +0 -750
  44. data/lib/public/javascripts/Jit/Examples/Treemap/example3.html +0 -62
  45. data/lib/public/javascripts/Jit/Examples/Treemap/example3.js +0 -775
  46. data/lib/public/javascripts/Jit/Examples/css/Hypertree.css +0 -0
  47. data/lib/public/javascripts/Jit/Examples/css/Other.css +0 -8
  48. data/lib/public/javascripts/Jit/Examples/css/RGraph.css +0 -0
  49. data/lib/public/javascripts/Jit/Examples/css/Spacetree.css +0 -0
  50. data/lib/public/javascripts/Jit/Examples/css/Treemap.css +0 -78
  51. data/lib/public/javascripts/Jit/Examples/css/base.css +0 -106
  52. data/lib/public/javascripts/Jit/Examples/css/col1.png +0 -0
  53. data/lib/public/javascripts/Jit/Examples/css/col2.png +0 -0
  54. data/lib/public/javascripts/Jit/Examples/css/gradient.png +0 -0
  55. data/lib/public/javascripts/Jit/Extras/excanvas.js +0 -35
  56. data/lib/public/javascripts/Jit/jit-yc.js +0 -1
  57. data/lib/public/javascripts/Jit-1.1.3.zip +0 -0
@@ -1,310 +0,0 @@
1
- var Log = {
2
- elem: false,
3
- write: function(text){
4
- if (!this.elem)
5
- this.elem = document.getElementById('log');
6
- this.elem.innerHTML = text;
7
- this.elem.style.left = (500 - this.elem.offsetWidth / 2) + 'px';
8
- }
9
- };
10
-
11
- function addEvent(obj, type, fn) {
12
- if (obj.addEventListener) obj.addEventListener(type, fn, false);
13
- else obj.attachEvent('on' + type, fn);
14
- };
15
-
16
-
17
- function init(){
18
- //init data
19
- //By defining properties with the dollar sign ($)
20
- //in nodes and edges we can override the global configuration
21
- //properties for nodes and edges.
22
- //In this case we use "$type" and "$dim" properties to override
23
- //the type of the node to be plotted and its dimension.
24
- var json = [{
25
- "id": "node0",
26
- "name": "node0 name",
27
- "data": {
28
- "$dim": 16.759175934208628,
29
- "some other key": "some other value"
30
- },
31
- "adjacencies": [{
32
- "nodeTo": "node1",
33
- "data": {
34
- "weight": 3
35
- }
36
- }, {
37
- "nodeTo": "node2",
38
- "data": {
39
- "weight": 3
40
- }
41
- }, {
42
- "nodeTo": "node3",
43
- "data": {
44
- "weight": 3
45
- }
46
- }, {
47
- "nodeTo": "node4",
48
- "data": {
49
- "weight": 1
50
- }
51
- }, {
52
- "nodeTo": "node5",
53
- "data": {
54
- "weight": 1
55
- }
56
- }]
57
- }, {
58
- "id": "node1",
59
- "name": "node1 name",
60
- "data": {
61
- "$dim": 13.077119090372014,
62
- "$type": "square",
63
- "some other key": "some other value"
64
- },
65
- "adjacencies": [{
66
- "nodeTo": "node0",
67
- "data": {
68
- "weight": 3
69
- }
70
- }, {
71
- "nodeTo": "node2",
72
- "data": {
73
- "weight": 1
74
- }
75
- }, {
76
- "nodeTo": "node3",
77
- "data": {
78
- "weight": 3
79
- }
80
- }, {
81
- "nodeTo": "node4",
82
- "data": {
83
- "weight": 1
84
- }
85
- }, {
86
- "nodeTo": "node5",
87
- "data": {
88
- "weight": 1
89
- }
90
- }]
91
- }, {
92
- "id": "node2",
93
- "name": "node2 name",
94
- "data": {
95
- "$dim": 24.937383149648717,
96
- "$type": "triangle",
97
- "some other key": "some other value"
98
- },
99
- "adjacencies": [{
100
- "nodeTo": "node0",
101
- "data": {
102
- "weight": 3
103
- }
104
- }, {
105
- "nodeTo": "node1",
106
- "data": {
107
- "weight": 1
108
- }
109
- }, {
110
- "nodeTo": "node3",
111
- "data": {
112
- "weight": 3
113
- }
114
- }, {
115
- "nodeTo": "node4",
116
- "data": {
117
- "weight": 3
118
- }
119
- }, {
120
- "nodeTo": "node5",
121
- "data": {
122
- "weight": 1
123
- }
124
- }]
125
- }, {
126
- "id": "node3",
127
- "name": "node3 name",
128
- "data": {
129
- "$dim": 10.53272740718869,
130
- "some other key": "some other value"
131
- },
132
- "adjacencies": [{
133
- "nodeTo": "node0",
134
- "data": {
135
- "weight": 3
136
- }
137
- }, {
138
- "nodeTo": "node1",
139
- "data": {
140
- "weight": 3
141
- }
142
- }, {
143
- "nodeTo": "node2",
144
- "data": {
145
- "weight": 3
146
- }
147
- }, {
148
- "nodeTo": "node4",
149
- "data": {
150
- "weight": 1
151
- }
152
- }, {
153
- "nodeTo": "node5",
154
- "data": {
155
- "weight": 3
156
- }
157
- }]
158
- }, {
159
- "id": "node4",
160
- "name": "node4 name",
161
- "data": {
162
- "$dim": 5.3754347037767345,
163
- "$type":"triangle",
164
- "some other key": "some other value"
165
- },
166
- "adjacencies": [{
167
- "nodeTo": "node0",
168
- "data": {
169
- "weight": 1
170
- }
171
- }, {
172
- "nodeTo": "node1",
173
- "data": {
174
- "weight": 1
175
- }
176
- }, {
177
- "nodeTo": "node2",
178
- "data": {
179
- "weight": 3
180
- }
181
- }, {
182
- "nodeTo": "node3",
183
- "data": {
184
- "weight": 1
185
- }
186
- }, {
187
- "nodeTo": "node5",
188
- "data": {
189
- "weight": 3
190
- }
191
- }]
192
- }, {
193
- "id": "node5",
194
- "name": "node5 name",
195
- "data": {
196
- "$dim": 32.26403873194912,
197
- "$type": "star",
198
- "some other key": "some other value"
199
- },
200
- "adjacencies": [{
201
- "nodeTo": "node0",
202
- "data": {
203
- "weight": 1
204
- }
205
- }, {
206
- "nodeTo": "node1",
207
- "data": {
208
- "weight": 1
209
- }
210
- }, {
211
- "nodeTo": "node2",
212
- "data": {
213
- "weight": 1
214
- }
215
- }, {
216
- "nodeTo": "node3",
217
- "data": {
218
- "weight": 3
219
- }
220
- }, {
221
- "nodeTo": "node4",
222
- "data": {
223
- "weight": 3
224
- }
225
- }]
226
- }];
227
- //end
228
- var infovis = document.getElementById('infovis');
229
- var w = infovis.offsetWidth, h = infovis.offsetHeight;
230
- //init canvas
231
- //Create a new canvas instance.
232
- var canvas = new Canvas('mycanvas', {
233
- 'injectInto': 'infovis',
234
- 'width': w,
235
- 'height': h
236
- });
237
- //end
238
- //init Hypertree
239
- var ht = new Hypertree(canvas, {
240
- //By setting overridable=true,
241
- //Node and Edge global properties can be
242
- //overriden for each node/edge.
243
- Node: {
244
- overridable: true,
245
- 'transform': false,
246
- color: "#f00"
247
- },
248
-
249
- Edge: {
250
- overridable: true,
251
- color: "#088"
252
- },
253
-
254
- //Change the animation transition type
255
- transition: Trans.Back.easeOut,
256
- duration:1000,
257
-
258
- //This method is called right before plotting an
259
- //edge. This method is useful for adding individual
260
- //styles to edges.
261
- onBeforePlotLine: function(adj){
262
- //Set random lineWidth for edges.
263
- if (!adj.data.$lineWidth)
264
- adj.data.$lineWidth = Math.random() * 5 + 1;
265
- },
266
-
267
- onBeforeCompute: function(node){
268
- Log.write("centering");
269
- },
270
- //Attach event handlers.
271
- onCreateLabel: function(domElement, node){
272
- domElement.innerHTML = node.name;
273
- domElement.style.cursor = "pointer";
274
- domElement.onclick = function () {
275
- ht.onClick(node.id, { hideLabels: false });
276
- };
277
- },
278
-
279
- //This method is called when moving/placing a label.
280
- //You can add some positioning offsets to the labels here.
281
- onPlaceLabel: function(domElement, node){
282
- var width = domElement.offsetWidth;
283
- var intX = parseInt(domElement.style.left);
284
- intX -= width / 2;
285
- domElement.style.left = intX + 'px';
286
- },
287
-
288
- onAfterCompute: function(){
289
- Log.write("done");
290
-
291
- //Make the relations list shown in the right column.
292
- var node = Graph.Util.getClosestNodeToOrigin(ht.graph, "pos");
293
- var html = "<h4>" + node.name + "</h4><b>Connections:</b>";
294
- html += "<ul>";
295
- Graph.Util.eachAdjacency(node, function(adj){
296
- var child = adj.nodeTo;
297
- html += "<li>" + child.name + "</li>";
298
- });
299
- html += "</ul>";
300
- document.getElementById('inner-details').innerHTML = html;
301
- }
302
- });
303
- //load JSON graph.
304
- ht.loadJSON(json, 2);
305
- //compute positions and plot
306
- ht.refresh();
307
- //end
308
- ht.controller.onBeforeCompute(Graph.Util.getNode(ht.graph, ht.root));
309
- ht.controller.onAfterCompute();
310
- }
@@ -1,199 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5
- <title>Hypertree - Graph Operations</title>
6
-
7
- <!-- CSS Files -->
8
- <link type="text/css" href="../css/base.css" rel="stylesheet" />
9
- <link type="text/css" href="../css/Hypertree.css" rel="stylesheet" />
10
-
11
- <!--[if IE]><script language="javascript" type="text/javascript" src="../../Extras/excanvas.js"></script><![endif]-->
12
-
13
- <!-- JIT Library File -->
14
- <script language="javascript" type="text/javascript" src="../../jit.js"></script>
15
-
16
- <!-- Example File -->
17
- <script language="javascript" type="text/javascript" src="example3.js"></script>
18
- </head>
19
-
20
- <body onload="init();">
21
- <div id="container">
22
-
23
- <div id="left-container">
24
-
25
-
26
-
27
- <div class="text">
28
- <h4>
29
- Graph Operations
30
- </h4>
31
-
32
- You can do the following operations with the Hypertree<br /><br />
33
- 1.- Removing subtrees or nodes<br /><br />
34
- 2.- Removing edges<br /><br />
35
- 3.- Adding another graph, also called sum<br /><br />
36
- 4.- Morphing (or transforming) the graph into another one<br />
37
-
38
- </div>
39
-
40
- <div id="id-list"></div>
41
-
42
-
43
- <div style="text-align:center;"><a href="example3.js">See the Example Code</a></div>
44
- </div>
45
-
46
- <div id="center-container">
47
- <div id="infovis"></div>
48
- </div>
49
-
50
- <div id="right-container">
51
-
52
- <h4>Global Options</h4>
53
-
54
- <table>
55
- <tr>
56
- <td>
57
- duration:
58
- </td>
59
- <td>
60
- <select id="select-duration">
61
- <option>1000</option>
62
- <option>1500</option>
63
- </select>
64
- </td>
65
- </tr>
66
- <tr>
67
- <td>
68
- fps:
69
- </td>
70
- <td>
71
- <select id="select-fps">
72
- <option>10</option>
73
- <option selected="selected">30</option>
74
- <option>60</option>
75
- </select>
76
- </td>
77
- </tr>
78
- <tr>
79
- <td>
80
- hide labels:
81
- </td>
82
- <td>
83
- <input type="checkbox" checked="checked" id="hide-labels" />
84
- </td>
85
- </tr>
86
- <tr>
87
- <td>
88
- <input type="button" value="Refresh" onclick="window.location = window.location" />
89
- </td>
90
- </tr>
91
- </table>
92
-
93
- <h4>1.- Remove Nodes</h4>
94
-
95
- <table>
96
- <tr>
97
- <td>
98
- type:
99
- </td>
100
- <td>
101
- <select id="select-type-remove-nodes">
102
- <option>fade:seq</option>
103
- <option>fade:con</option>
104
- <option>iter</option>
105
- <option>replot</option>
106
- </select>
107
- </td>
108
- </tr>
109
- <tr>
110
- <td>
111
- <input type="button" value="Remove" id="remove-nodes" />
112
- </td>
113
- <td>
114
- <input type="button" value="Refresh" onclick="window.location = window.location" />
115
- </td>
116
- </tr>
117
- </table>
118
-
119
- <h4>2.- Remove Edges</h4>
120
-
121
- <table>
122
- <tr>
123
- <td>
124
- type:
125
- </td>
126
- <td>
127
- <select id="select-type-remove-edges">
128
- <option>fade:seq</option>
129
- <option>fade:con</option>
130
- <option>iter</option>
131
- <option>replot</option>
132
- </select>
133
- </td>
134
- </tr>
135
- <tr>
136
- <td>
137
- <input type="button" value="Remove" id="remove-edges" />
138
- </td>
139
- <td>
140
- <input type="button" value="Refresh" onclick="window.location = window.location" />
141
- </td>
142
- </tr>
143
- </table>
144
-
145
- <h4>3.- Add Graph (Sum)</h4>
146
-
147
- <table>
148
- <tr>
149
- <td>
150
- type:
151
- </td>
152
- <td>
153
- <select id="select-type-sum">
154
- <option>fade:seq</option>
155
- <option>fade:con</option>
156
- <option>replot</option>
157
- </select>
158
- </td>
159
- </tr>
160
- <tr>
161
- <td>
162
- <input type="button" value="Sum" id="sum" />
163
- </td>
164
- <td>
165
- <input type="button" value="Refresh" onclick="window.location = window.location" />
166
- </td>
167
- </tr>
168
- </table>
169
-
170
- <h4>4.- Morph</h4>
171
-
172
- <table>
173
- <tr>
174
- <td>
175
- type:
176
- </td>
177
- <td>
178
- <select id="select-type-morph">
179
- <option>fade:con</option>
180
- <option>replot</option>
181
- </select>
182
- </td>
183
- </tr>
184
- <tr>
185
- <td>
186
- <input type="button" value="Morph" id="morph" />
187
- </td>
188
- <td>
189
- <input type="button" value="Refresh" onclick="window.location = window.location" />
190
- </td>
191
- </tr>
192
- </table>
193
-
194
- </div>
195
-
196
- <div id="log"></div>
197
- </div>
198
- </body>
199
- </html>