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,356 +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
- var infovis = document.getElementById('infovis');
19
- var w = infovis.offsetWidth, h = infovis.offsetHeight;
20
- //init data
21
- //If a node in this JSON structure
22
- //has the "$type" or "$dim" parameters
23
- //defined it will override the "type" and
24
- //"dim" parameters globally defined in the
25
- //RGraph constructor.
26
- var json = [{
27
- "id": "node0",
28
- "name": "node0 name",
29
- "data": {
30
- "$dim": 16.759175934208628,
31
- "some other key": "some other value"
32
- },
33
- "adjacencies": [{
34
- "nodeTo": "node1",
35
- "data": {
36
- "weight": 3
37
- }
38
- }, {
39
- "nodeTo": "node2",
40
- "data": {
41
- "weight": 3
42
- }
43
- }, {
44
- "nodeTo": "node3",
45
- "data": {
46
- "weight": 3
47
- }
48
- }, {
49
- "nodeTo": "node4",
50
- "data": {
51
- "$type":"arrow",
52
- "$color":"#dd99dd",
53
- "$dim":25,
54
- "weight": 1
55
- }
56
- }, {
57
- "nodeTo": "node5",
58
- "data": {
59
- "weight": 1
60
- }
61
- }]
62
- }, {
63
- "id": "node1",
64
- "name": "node1 name",
65
- "data": {
66
- "$dim": 13.077119090372014,
67
- "$type": "square",
68
- "some other key": "some other value"
69
- },
70
- "adjacencies": [{
71
- "nodeTo": "node0",
72
- "data": {
73
- "weight": 3
74
- }
75
- }, {
76
- "nodeTo": "node2",
77
- "data": {
78
- "weight": 1
79
- }
80
- }, {
81
- "nodeTo": "node3",
82
- "data": {
83
- "weight": 3
84
- }
85
- }, {
86
- "nodeTo": "node4",
87
- "data": {
88
- "weight": 1
89
- }
90
- }, {
91
- "nodeTo": "node5",
92
- "data": {
93
- "weight": 1
94
- }
95
- }]
96
- }, {
97
- "id": "node2",
98
- "name": "node2 name",
99
- "data": {
100
- "$dim": 24.937383149648717,
101
- "$type": "triangle",
102
- "some other key": "some other value"
103
- },
104
- "adjacencies": [{
105
- "nodeTo": "node0",
106
- "data": {
107
- "weight": 3
108
- }
109
- }, {
110
- "nodeTo": "node1",
111
- "data": {
112
- "weight": 1
113
- }
114
- }, {
115
- "nodeTo": "node3",
116
- "data": {
117
- "weight": 3
118
- }
119
- }, {
120
- "nodeTo": "node4",
121
- "data": {
122
- "weight": 3
123
- }
124
- }, {
125
- "nodeTo": "node5",
126
- "data": {
127
- "weight": 1
128
- }
129
- }]
130
- }, {
131
- "id": "node3",
132
- "name": "node3 name",
133
- "data": {
134
- "$dim": 10.53272740718869,
135
- "some other key": "some other value"
136
- },
137
- "adjacencies": [{
138
- "nodeTo": "node0",
139
- "data": {
140
- "weight": 3
141
- }
142
- }, {
143
- "nodeTo": "node1",
144
- "data": {
145
- "weight": 3
146
- }
147
- }, {
148
- "nodeTo": "node2",
149
- "data": {
150
- "weight": 3
151
- }
152
- }, {
153
- "nodeTo": "node4",
154
- "data": {
155
- "$type":"arrow",
156
- "$direction": ["node4", "node3"],
157
- "$dim":25,
158
- "$color":"#dd99dd",
159
- "weight": 1
160
- }
161
- }, {
162
- "nodeTo": "node5",
163
- "data": {
164
- "weight": 3
165
- }
166
- }]
167
- }, {
168
- "id": "node4",
169
- "name": "node4 name",
170
- "data": {
171
- "$dim": 5.3754347037767345,
172
- "$type":"triangle",
173
- "some other key": "some other value"
174
- },
175
- "adjacencies": [{
176
- "nodeTo": "node0",
177
- "data": {
178
- "weight": 1
179
- }
180
- }, {
181
- "nodeTo": "node1",
182
- "data": {
183
- "weight": 1
184
- }
185
- }, {
186
- "nodeTo": "node2",
187
- "data": {
188
- "weight": 3
189
- }
190
- }, {
191
- "nodeTo": "node3",
192
- "data": {
193
- "weight": 1
194
- }
195
- }, {
196
- "nodeTo": "node5",
197
- "data": {
198
- "weight": 3
199
- }
200
- }]
201
- }, {
202
- "id": "node5",
203
- "name": "node5 name",
204
- "data": {
205
- "$dim": 32.26403873194912,
206
- "$type": "star",
207
- "some other key": "some other value"
208
- },
209
- "adjacencies": [{
210
- "nodeTo": "node0",
211
- "data": {
212
- "weight": 1
213
- }
214
- }, {
215
- "nodeTo": "node1",
216
- "data": {
217
- "weight": 1
218
- }
219
- }, {
220
- "nodeTo": "node2",
221
- "data": {
222
- "weight": 1
223
- }
224
- }, {
225
- "nodeTo": "node3",
226
- "data": {
227
- "weight": 3
228
- }
229
- }, {
230
- "nodeTo": "node4",
231
- "data": {
232
- "weight": 3
233
- }
234
- }]
235
- }];
236
- //end
237
- //init canvas
238
- //Create a new canvas instance.
239
- var canvas = new Canvas('mycanvas', {
240
- 'injectInto': 'infovis',
241
- 'width': w,
242
- 'height': h,
243
- //Optional: Add a background canvas
244
- //that draws some concentric circles.
245
- 'backgroundCanvas': {
246
- 'styles': {
247
- 'strokeStyle': '#444'
248
- },
249
- 'impl': {
250
- 'init': function(){},
251
- 'plot': function(canvas, ctx){
252
- var times = 6, d = 200;
253
- var pi2 = Math.PI * 2;
254
- for (var i = 1; i <= times; i++) {
255
- ctx.beginPath();
256
- ctx.arc(0, 0, i * d, 0, pi2, true);
257
- ctx.stroke();
258
- ctx.closePath();
259
- }
260
- }
261
- }
262
- }
263
- });
264
- //end
265
- //init RGraph
266
- var rgraph = new RGraph(canvas, {
267
- //Nodes and Edges parameters
268
- //can be overriden if defined in
269
- //the JSON input data.
270
-
271
- //This way we can define different node
272
- //types individually.
273
-
274
- Node: {
275
- 'overridable': true,
276
- 'color': '#cc0000'
277
-
278
- },
279
- Edge: {
280
- 'overridable': true,
281
- 'color': '#cccc00'
282
- },
283
-
284
- //Set polar interpolation.
285
- //Default's linear.
286
- interpolation: 'polar',
287
-
288
- //Change the transition effect from linear
289
- //to elastic.
290
- transition: Trans.Elastic.easeOut,
291
- //Change other animation parameters.
292
- duration:3500,
293
- fps: 30,
294
- //Change father-child distance.
295
- levelDistance: 200,
296
-
297
- //This method is called right before plotting
298
- //an edge. This method is useful to change edge styles
299
- //individually.
300
- onBeforePlotLine: function(adj){
301
- //Add some random lineWidth to each edge.
302
- if (!adj.data.$lineWidth)
303
- adj.data.$lineWidth = Math.random() * 5 + 1;
304
- },
305
-
306
- onBeforeCompute: function(node){
307
- Log.write("centering " + node.name + "...");
308
-
309
- //Make right column relations list.
310
- var html = "<h4>" + node.name + "</h4><b>Connections:</b>";
311
- html += "<ul>";
312
- Graph.Util.eachAdjacency(node, function(adj){
313
- var child = adj.nodeTo;
314
- html += "<li>" + child.name + "</li>";
315
- });
316
- html += "</ul>";
317
- document.getElementById('inner-details').innerHTML = html;
318
- },
319
-
320
- //Add node click handler and some styles.
321
- //This method is called only once for each node/label crated.
322
- onCreateLabel: function(domElement, node){
323
- domElement.innerHTML = node.name;
324
- domElement.onclick = function () {
325
- rgraph.onClick(node.id, { hideLabels: false });
326
- };
327
- var style = domElement.style;
328
- style.cursor = 'pointer';
329
- style.fontSize = "0.8em";
330
- style.color = "#fff";
331
- },
332
- //This method is called when rendering/moving a label.
333
- //This is method is useful to make some last minute changes
334
- //to node labels like adding some position offset.
335
- onPlaceLabel: function(domElement, node){
336
- var style = domElement.style;
337
- var left = parseInt(style.left);
338
- var w = domElement.offsetWidth;
339
- style.left = (left - w / 2) + 'px';
340
- },
341
-
342
- onAfterCompute: function(){
343
- Log.write("done");
344
- }
345
-
346
- });
347
- //load graph.
348
- rgraph.loadJSON(json, 1);
349
-
350
- //compute positions and plot
351
- rgraph.refresh();
352
- //end
353
- rgraph.controller.onBeforeCompute(rgraph.graph.getNode(rgraph.root));
354
- rgraph.controller.onAfterCompute();
355
-
356
- }
@@ -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>RGraph - 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/RGraph.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 RGraph<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>