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,427 +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
- var json = {
20
- "id": "347_0",
21
- "name": "Nine Inch Nails",
22
- "children": [{
23
- "id": "126510_1",
24
- "name": "Jerome Dillon",
25
- "data": {
26
- "band": "Nine Inch Nails",
27
- "relation": "member of band"
28
- },
29
- "children": [{
30
- "id": "52163_2",
31
- "name": "Howlin' Maggie",
32
- "data": {
33
- "band": "Jerome Dillon",
34
- "relation": "member of band"
35
- },
36
- "children": []
37
- }, {
38
- "id": "324134_3",
39
- "name": "nearLY",
40
- "data": {
41
- "band": "Jerome Dillon",
42
- "relation": "member of band"
43
- },
44
- "children": []
45
- }]
46
- }, {
47
- "id": "173871_4",
48
- "name": "Charlie Clouser",
49
- "data": {
50
- "band": "Nine Inch Nails",
51
- "relation": "member of band"
52
- },
53
- "children": []
54
- }, {
55
- "id": "235952_5",
56
- "name": "James Woolley",
57
- "data": {
58
- "band": "Nine Inch Nails",
59
- "relation": "member of band"
60
- },
61
- "children": []
62
- }, {
63
- "id": "235951_6",
64
- "name": "Jeff Ward",
65
- "data": {
66
- "band": "Nine Inch Nails",
67
- "relation": "member of band"
68
- },
69
- "children": [{
70
- "id": "2382_7",
71
- "name": "Ministry",
72
- "data": {
73
- "band": "Jeff Ward",
74
- "relation": "member of band"
75
- },
76
- "children": []
77
- }, {
78
- "id": "2415_8",
79
- "name": "Revolting Cocks",
80
- "data": {
81
- "band": "Jeff Ward",
82
- "relation": "member of band"
83
- },
84
- "children": []
85
- }, {
86
- "id": "3963_9",
87
- "name": "Pigface",
88
- "data": {
89
- "band": "Jeff Ward",
90
- "relation": "member of band"
91
- },
92
- "children": []
93
- }, {
94
- "id": "7848_10",
95
- "name": "Lard",
96
- "data": {
97
- "band": "Jeff Ward",
98
- "relation": "member of band"
99
- },
100
- "children": []
101
- }]
102
- }, {
103
- "id": "235950_11",
104
- "name": "Richard Patrick",
105
- "data": {
106
- "band": "Nine Inch Nails",
107
- "relation": "member of band"
108
- },
109
- "children": [{
110
- "id": "1007_12",
111
- "name": "Filter",
112
- "data": {
113
- "band": "Richard Patrick",
114
- "relation": "member of band"
115
- },
116
- "children": []
117
- }, {
118
- "id": "327924_13",
119
- "name": "Army of Anyone",
120
- "data": {
121
- "band": "Richard Patrick",
122
- "relation": "member of band"
123
- },
124
- "children": []
125
- }]
126
- }, {
127
- "id": "2396_14",
128
- "name": "Trent Reznor",
129
- "data": {
130
- "band": "Nine Inch Nails",
131
- "relation": "member of band"
132
- },
133
- "children": [{
134
- "id": "3963_15",
135
- "name": "Pigface",
136
- "data": {
137
- "band": "Trent Reznor",
138
- "relation": "member of band"
139
- },
140
- "children": []
141
- }, {
142
- "id": "32247_16",
143
- "name": "1000 Homo DJs",
144
- "data": {
145
- "band": "Trent Reznor",
146
- "relation": "member of band"
147
- },
148
- "children": []
149
- }, {
150
- "id": "83761_17",
151
- "name": "Option 30",
152
- "data": {
153
- "band": "Trent Reznor",
154
- "relation": "member of band"
155
- },
156
- "children": []
157
- }, {
158
- "id": "133257_18",
159
- "name": "Exotic Birds",
160
- "data": {
161
- "band": "Trent Reznor",
162
- "relation": "member of band"
163
- },
164
- "children": []
165
- }]
166
- }, {
167
- "id": "36352_19",
168
- "name": "Chris Vrenna",
169
- "data": {
170
- "band": "Nine Inch Nails",
171
- "relation": "member of band"
172
- },
173
- "children": [{
174
- "id": "1013_20",
175
- "name": "Stabbing Westward",
176
- "data": {
177
- "band": "Chris Vrenna",
178
- "relation": "member of band"
179
- },
180
- "children": []
181
- }, {
182
- "id": "3963_21",
183
- "name": "Pigface",
184
- "data": {
185
- "band": "Chris Vrenna",
186
- "relation": "member of band"
187
- },
188
- "children": []
189
- }, {
190
- "id": "5752_22",
191
- "name": "Jack Off Jill",
192
- "data": {
193
- "band": "Chris Vrenna",
194
- "relation": "member of band"
195
- },
196
- "children": []
197
- }, {
198
- "id": "33602_23",
199
- "name": "Die Warzau",
200
- "data": {
201
- "band": "Chris Vrenna",
202
- "relation": "member of band"
203
- },
204
- "children": []
205
- }, {
206
- "id": "40485_24",
207
- "name": "tweaker",
208
- "data": {
209
- "band": "Chris Vrenna",
210
- "relation": "is person"
211
- },
212
- "children": []
213
- }, {
214
- "id": "133257_25",
215
- "name": "Exotic Birds",
216
- "data": {
217
- "band": "Chris Vrenna",
218
- "relation": "member of band"
219
- },
220
- "children": []
221
- }]
222
- }, {
223
- "id": "236021_26",
224
- "name": "Aaron North",
225
- "data": {
226
- "band": "Nine Inch Nails",
227
- "relation": "member of band"
228
- },
229
- "children": []
230
- }, {
231
- "id": "236024_27",
232
- "name": "Jeordie White",
233
- "data": {
234
- "band": "Nine Inch Nails",
235
- "relation": "member of band"
236
- },
237
- "children": [{
238
- "id": "909_28",
239
- "name": "A Perfect Circle",
240
- "data": {
241
- "band": "Jeordie White",
242
- "relation": "member of band"
243
- },
244
- "children": []
245
- }, {
246
- "id": "237377_29",
247
- "name": "Twiggy Ramirez",
248
- "data": {
249
- "band": "Jeordie White",
250
- "relation": "is person"
251
- },
252
- "children": []
253
- }]
254
- }, {
255
- "id": "235953_30",
256
- "name": "Robin Finck",
257
- "data": {
258
- "band": "Nine Inch Nails",
259
- "relation": "member of band"
260
- },
261
- "children": [{
262
- "id": "1440_31",
263
- "name": "Guns N' Roses",
264
- "data": {
265
- "band": "Robin Finck",
266
- "relation": "member of band"
267
- },
268
- "children": []
269
- }]
270
- }, {
271
- "id": "235955_32",
272
- "name": "Danny Lohner",
273
- "data": {
274
- "band": "Nine Inch Nails",
275
- "relation": "member of band"
276
- },
277
- "children": [{
278
- "id": "909_33",
279
- "name": "A Perfect Circle",
280
- "data": {
281
- "band": "Danny Lohner",
282
- "relation": "member of band"
283
- },
284
- "children": []
285
- }, {
286
- "id": "1695_34",
287
- "name": "Killing Joke",
288
- "data": {
289
- "band": "Danny Lohner",
290
- "relation": "member of band"
291
- },
292
- "children": []
293
- }, {
294
- "id": "1938_35",
295
- "name": "Methods of Mayhem",
296
- "data": {
297
- "band": "Danny Lohner",
298
- "relation": "member of band"
299
- },
300
- "children": []
301
- }, {
302
- "id": "5138_36",
303
- "name": "Skrew",
304
- "data": {
305
- "band": "Danny Lohner",
306
- "relation": "member of band"
307
- },
308
- "children": []
309
- }, {
310
- "id": "53549_37",
311
- "name": "Angkor Wat",
312
- "data": {
313
- "band": "Danny Lohner",
314
- "relation": "member of band"
315
- },
316
- "children": []
317
- }, {
318
- "id": "113510_38",
319
- "name": "Puscifer",
320
- "data": {
321
- "band": "Danny Lohner",
322
- "relation": "member of band"
323
- },
324
- "children": []
325
- }, {
326
- "id": "113512_39",
327
- "name": "Renhold\u00ebr",
328
- "data": {
329
- "band": "Danny Lohner",
330
- "relation": "is person"
331
- },
332
- "children": []
333
- }]
334
- }],
335
- "data": []
336
- };
337
- //end
338
- var infovis = document.getElementById('infovis');
339
- var w = infovis.offsetWidth - 50, h = infovis.offsetHeight - 50;
340
-
341
- //init canvas
342
- //Create a new canvas instance.
343
- var canvas = new Canvas('mycanvas', {
344
- 'injectInto': 'infovis',
345
- 'width': w,
346
- 'height': h
347
- });
348
- //end
349
- var style = document.getElementById('mycanvas').style;
350
- style.marginLeft = style.marginTop = "25px";
351
- //init Hypertree
352
- var ht = new Hypertree(canvas, {
353
- //Change node and edge styles such as
354
- //color, width and dimensions.
355
- Node: {
356
- dim: 9,
357
- color: "#f00"
358
- },
359
-
360
- Edge: {
361
- lineWidth: 2,
362
- color: "#088"
363
- },
364
-
365
- onBeforeCompute: function(node){
366
- Log.write("centering");
367
- },
368
- //Attach event handlers and add text to the
369
- //labels. This method is only triggered on label
370
- //creation
371
- onCreateLabel: function(domElement, node){
372
- domElement.innerHTML = node.name;
373
- addEvent(domElement, 'click', function () {
374
- ht.onClick(node.id);
375
- });
376
- },
377
- //Change node styles when labels are placed
378
- //or moved.
379
- onPlaceLabel: function(domElement, node){
380
- var style = domElement.style;
381
- style.display = '';
382
- style.cursor = 'pointer';
383
- if (node._depth <= 1) {
384
- style.fontSize = "0.8em";
385
- style.color = "#ddd";
386
-
387
- } else if(node._depth == 2){
388
- style.fontSize = "0.7em";
389
- style.color = "#555";
390
-
391
- } else {
392
- style.display = 'none';
393
- }
394
-
395
- var left = parseInt(style.left);
396
- var w = domElement.offsetWidth;
397
- style.left = (left - w / 2) + 'px';
398
- },
399
-
400
- onAfterCompute: function(){
401
- Log.write("done");
402
-
403
- //Build the right column relations list.
404
- //This is done by collecting the information (stored in the data property)
405
- //for all the nodes adjacent to the centered node.
406
- var node = Graph.Util.getClosestNodeToOrigin(ht.graph, "pos");
407
- var html = "<h4>" + node.name + "</h4><b>Connections:</b>";
408
- html += "<ul>";
409
- Graph.Util.eachAdjacency(node, function(adj){
410
- var child = adj.nodeTo;
411
- if (child.data) {
412
- var rel = (child.data.band == node.name) ? child.data.relation : node.data.relation;
413
- html += "<li>" + child.name + " " + "<div class=\"relation\">(relation: " + rel + ")</div></li>";
414
- }
415
- });
416
- html += "</ul>";
417
- document.getElementById('inner-details').innerHTML = html;
418
- }
419
- });
420
-
421
- //load JSON data.
422
- ht.loadJSON(json);
423
- //compute positions and plot.
424
- ht.refresh();
425
- //end
426
- ht.controller.onAfterCompute();
427
- }
@@ -1,58 +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 - Weighted Graph Animation</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="example2.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
- Weighted Graph Animation
30
- </h4>
31
-
32
- A static JSON graph structure is used for this animation.<br /><br />
33
- For each JSON node the "$type" and "$dim" parameters set the type of node to be plotted and its dimensions.<br /><br />
34
- Line weights are added programmatically, <em>onBeforePlotLine</em>.<br /><br />
35
- A <b>Back</b> transition is used instead of the linear transition for the animation.
36
-
37
- </div>
38
-
39
- <div id="id-list"></div>
40
-
41
-
42
- <div style="text-align:center;"><a href="example2.js">See the Example Code</a></div>
43
- </div>
44
-
45
- <div id="center-container">
46
- <div id="infovis"></div>
47
- </div>
48
-
49
- <div id="right-container">
50
-
51
- <div id="inner-details"></div>
52
-
53
- </div>
54
-
55
- <div id="log"></div>
56
- </div>
57
- </body>
58
- </html>