mongo3 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,304 +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': 'root',
21
- 'name': 'RGraph( RGraph )',
22
- 'data': {
23
- '$type': 'none'
24
- },
25
- 'children':[
26
- {
27
- 'id':'pie10',
28
- 'name': 'pie1',
29
- 'data': {
30
- '$aw': 20,
31
- '$color': '#f55'
32
- },
33
- 'children': [
34
- {
35
- 'id':'pie100',
36
- 'name': 'pc1',
37
- 'data': {
38
- '$aw': 20,
39
- '$color': '#55f'
40
- },
41
- 'children': []
42
-
43
- },
44
- {
45
- 'id':'pie101',
46
- 'name': 'pc2',
47
- 'data': {
48
- '$aw': 70,
49
- '$color': '#66f'
50
- },
51
- 'children': []
52
-
53
- },
54
- {
55
- 'id':'pie102',
56
- 'name': 'pc3',
57
- 'data': {
58
- '$aw': 10,
59
- '$color': '#77f'
60
- },
61
- 'children': []
62
-
63
- }
64
- ]
65
- },
66
- {
67
- 'id':'pie20',
68
- 'name': 'pie2',
69
- 'data': {
70
- '$aw': 40,
71
- '$color': '#f77'
72
- },
73
- 'children': [
74
- {
75
- 'id':'pie200',
76
- 'name': 'pc1',
77
- 'data': {
78
- '$aw': 40,
79
- '$color': '#88f'
80
- },
81
- 'children': []
82
-
83
- },
84
- {
85
- 'id':'pie201',
86
- 'name': 'pc2',
87
- 'data': {
88
- '$aw': 60,
89
- '$color': '#99f'
90
- },
91
- 'children': []
92
-
93
- }
94
- ]
95
- },
96
- {
97
- 'id':'pie30',
98
- 'name': 'pie3',
99
- 'data': {
100
- '$aw': 10,
101
- '$color': '#f99'
102
- },
103
- 'children': [
104
- {
105
- 'id':'pie300',
106
- 'name': 'pc1',
107
- 'data': {
108
- '$aw': 100,
109
- '$color': '#aaf'
110
- },
111
- 'children': []
112
-
113
- }
114
- ]
115
- }
116
- ]
117
- };
118
- var jsonpie = {
119
- 'id': 'root',
120
- 'name': 'RGraph based Pie Chart',
121
- 'data': {
122
- '$type': 'none'
123
- },
124
- 'children':[
125
- {
126
- 'id':'pie1',
127
- 'name': 'pie1',
128
- 'data': {
129
- '$aw': 20,
130
- '$color': '#f55'
131
- },
132
- 'children': []
133
- },
134
- {
135
- 'id':'pie2',
136
- 'name': 'pie2',
137
- 'data': {
138
- '$aw': 40,
139
- '$color': '#f77'
140
- },
141
- 'children': []
142
- },
143
- {
144
- 'id':'pie3',
145
- 'name': 'pie3',
146
- 'data': {
147
- '$aw': 10,
148
- '$color': '#f99'
149
- },
150
- 'children': []
151
- },
152
- {
153
- 'id':'pie4',
154
- 'name': 'pie4',
155
- 'data': {
156
- '$aw': 30,
157
- '$color': '#fbb'
158
- },
159
- 'children': []
160
- }
161
- ]
162
- };
163
- //end
164
-
165
- var infovis = document.getElementById('infovis');
166
- var w = infovis.offsetWidth, h = infovis.offsetHeight;
167
-
168
- //init canvas
169
- //Create new canvas instances.
170
- var canvas = new Canvas('mycanvas', {
171
- 'injectInto': 'infovis',
172
- 'width': w,
173
- 'height': h,
174
-
175
- //Optional: create a background canvas and plot
176
- //concentric circles in it.
177
- 'backgroundCanvas': {
178
- 'styles': {
179
- 'strokeStyle': '#555'
180
- },
181
-
182
- 'impl': {
183
- 'init': function(){},
184
- 'plot': function(canvas, ctx){
185
- var times = 4, d = 100;
186
- var pi2 = Math.PI * 2;
187
- for (var i = 1; i <= times; i++) {
188
- ctx.beginPath();
189
- ctx.arc(0, 0, i * d, 0, pi2, true);
190
- ctx.stroke();
191
- ctx.closePath();
192
- }
193
- }
194
- }
195
- }
196
-
197
- });
198
- //end
199
-
200
- //init nodetypes
201
- //Here we implement custom node rendering types for the RGraph
202
- //Using this feature requires some javascript and canvas experience.
203
- RGraph.Plot.NodeTypes.implement({
204
- //This node type is used for plotting pie-chart slices as nodes
205
- 'nodepie': function(node, canvas) {
206
- var span = node.angleSpan, begin = span.begin, end = span.end;
207
- var polarNode = node.pos.getp(true);
208
- var polar = new Polar(polarNode.rho, begin);
209
- var p1coord = polar.getc(true);
210
- polar.theta = end;
211
- var p2coord = polar.getc(true);
212
-
213
- var ctx = canvas.getCtx();
214
- ctx.beginPath();
215
- ctx.moveTo(0, 0);
216
- ctx.lineTo(p1coord.x, p1coord.y);
217
- ctx.moveTo(0, 0);
218
- ctx.lineTo(p2coord.x, p2coord.y);
219
- ctx.moveTo(0, 0);
220
- ctx.arc(0, 0, polarNode.rho, begin, end, false);
221
- ctx.fill();
222
- },
223
- //Create a new node type that renders an entire RGraph visualization
224
- //as node
225
- 'piechart': function(node, canvas, animating) {
226
- var ctx = canvas.getCtx(), pos = node.pos.getc(true);
227
- ctx.save();
228
- ctx.translate(pos.x, pos.y);
229
- pie.plot();
230
- ctx.restore();
231
- }
232
- });
233
- //end
234
-
235
- //init pie
236
- //This RGraph instance will be used as the node for
237
- //another RGraph instance.
238
- var pie = new RGraph(canvas, {
239
- //Add node/edge styles and set
240
- //overridable=true if you want your
241
- //styles to be individually overriden
242
- Node: {
243
- 'overridable': true,
244
- 'type':'nodepie'
245
- },
246
- Edge: {
247
- 'type':'none'
248
- },
249
- //Parent-children distance
250
- levelDistance: 30,
251
- //Don't create labels in this visualization
252
- withLabels: false,
253
- //Don't clear the entire canvas when plotting
254
- //this visualization
255
- clearCanvas: false
256
- });
257
- //load graph.
258
- pie.loadJSON(jsonpie);
259
- pie.compute();
260
- //end
261
-
262
- //init rgraph
263
- var rgraph = new RGraph(canvas, {
264
- //Add node/edge styles and set
265
- //overridable=true if you want your
266
- //styles to be individually overriden
267
- Node: {
268
- //set the RGraph rendering function
269
- //as node type
270
- 'type': 'piechart'
271
- },
272
- Edge: {
273
- color: '#772277'
274
- },
275
- //Parent-children distance
276
- levelDistance: 100,
277
-
278
- //Add styles to node labels on label creation
279
- onCreateLabel: function(domElement, node){
280
- domElement.innerHTML = node.name;
281
- var style = domElement.style;
282
- style.fontSize = "0.8em";
283
- style.color = "#fff";
284
- style.cursor = "pointer";
285
- domElement.onclick = function() {
286
- rgraph.onClick(node.id, {
287
- hideLabels: false
288
- });
289
- };
290
- },
291
-
292
- onPlaceLabel: function(domElement, node){
293
- var style = domElement.style;
294
- var left = parseInt(style.left);
295
- var w = domElement.offsetWidth;
296
- style.left = (left - w / 2) + 'px';
297
- style.display = '';
298
- }
299
- });
300
- //load graph.
301
- rgraph.loadJSON(json);
302
- rgraph.refresh();
303
- //end
304
- }
@@ -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>Other - Composing Visualizations 2</title>
6
-
7
- <!-- CSS Files -->
8
- <link type="text/css" href="../css/base.css" rel="stylesheet" />
9
- <link type="text/css" href="../css/Other.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
- Composing Visualizations 2
30
- </h4>
31
-
32
- In this example a SpaceTree is composed with a RGraph (for node rendering).<br /><br />
33
- The RGraph used for node rendering implements a custom node type defined in the <em>"Implementing Node Types"</em> example.<br /><br />
34
- This example shows that many visualizations can be composed to create new visualizations.
35
-
36
-
37
- </div>
38
-
39
- <div id="id-list"></div>
40
-
41
-
42
- <div style="text-align:center;"><a href="example3.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>
@@ -1,304 +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': 'root',
21
- 'name': 'root',
22
- 'data': {
23
- //'$type': 'none'
24
- },
25
- 'children':[
26
- {
27
- 'id':'pie10',
28
- 'name': 'pie1',
29
- 'data': {
30
- '$aw': 20,
31
- '$color': '#f55'
32
- },
33
- 'children': [
34
- {
35
- 'id':'pie100',
36
- 'name': 'pc1',
37
- 'data': {
38
- '$aw': 20,
39
- '$color': '#55f'
40
- },
41
- 'children': []
42
-
43
- },
44
- {
45
- 'id':'pie101',
46
- 'name': 'pc2',
47
- 'data': {
48
- '$aw': 70,
49
- '$color': '#66f'
50
- },
51
- 'children': []
52
-
53
- },
54
- {
55
- 'id':'pie102',
56
- 'name': 'pc3',
57
- 'data': {
58
- '$aw': 10,
59
- '$color': '#77f'
60
- },
61
- 'children': []
62
-
63
- }
64
- ]
65
- },
66
- {
67
- 'id':'pie20',
68
- 'name': 'pie2',
69
- 'data': {
70
- '$aw': 40,
71
- '$color': '#f77'
72
- },
73
- 'children': [
74
- {
75
- 'id':'pie200',
76
- 'name': 'pc1',
77
- 'data': {
78
- '$aw': 40,
79
- '$color': '#88f'
80
- },
81
- 'children': []
82
-
83
- },
84
- {
85
- 'id':'pie201',
86
- 'name': 'pc2',
87
- 'data': {
88
- '$aw': 60,
89
- '$color': '#99f'
90
- },
91
- 'children': []
92
-
93
- }
94
- ]
95
- },
96
- {
97
- 'id':'pie30',
98
- 'name': 'pie3',
99
- 'data': {
100
- '$aw': 10,
101
- '$color': '#f99'
102
- },
103
- 'children': [
104
- {
105
- 'id':'pie300',
106
- 'name': 'pc1',
107
- 'data': {
108
- '$aw': 100,
109
- '$color': '#aaf'
110
- },
111
- 'children': []
112
-
113
- }
114
- ]
115
- }
116
- ]
117
- };
118
- var jsonpie = {
119
- 'id': 'root',
120
- 'name': 'RGraph based Pie Chart',
121
- 'data': {
122
- '$type': 'none'
123
- },
124
- 'children':[
125
- {
126
- 'id':'pie1',
127
- 'name': 'pie1',
128
- 'data': {
129
- '$aw': 20,
130
- '$color': '#55f'
131
- },
132
- 'children': []
133
- },
134
- {
135
- 'id':'pie2',
136
- 'name': 'pie2',
137
- 'data': {
138
- '$aw': 40,
139
- '$color': '#77f'
140
- },
141
- 'children': []
142
- },
143
- {
144
- 'id':'pie3',
145
- 'name': 'pie3',
146
- 'data': {
147
- '$aw': 10,
148
- '$color': '#99f'
149
- },
150
- 'children': []
151
- },
152
- {
153
- 'id':'pie4',
154
- 'name': 'pie4',
155
- 'data': {
156
- '$aw': 30,
157
- '$color': '#bbf'
158
- },
159
- 'children': []
160
- }
161
- ]
162
- };
163
- //end
164
-
165
- var infovis = document.getElementById('infovis');
166
- var w = infovis.offsetWidth, h = infovis.offsetHeight;
167
-
168
- //init canvas
169
- //Create a new canvas instance.
170
- var canvas = new Canvas('mycanvas', {
171
- 'injectInto': 'infovis',
172
- 'width': w,
173
- 'height': h,
174
- 'backgroundColor': '#1a1a1a'
175
- });
176
- //end
177
-
178
- //init nodetypes
179
- //Here we implement custom node rendering types for the RGraph
180
- //Using this feature requires some javascript and canvas experience.
181
- RGraph.Plot.NodeTypes.implement({
182
- //This node type is used for plotting pie-chart slices as nodes
183
- 'shortnodepie': function(node, canvas) {
184
- var ldist = this.config.levelDistance;
185
- var span = node.angleSpan, begin = span.begin, end = span.end;
186
- var polarNode = node.pos.getp(true);
187
-
188
- var polar = new Polar(polarNode.rho, begin);
189
- var p1coord = polar.getc(true);
190
-
191
- polar.theta = end;
192
- var p2coord = polar.getc(true);
193
-
194
- polar.rho += ldist;
195
- var p3coord = polar.getc(true);
196
-
197
- polar.theta = begin;
198
- var p4coord = polar.getc(true);
199
-
200
-
201
- var ctx = canvas.getCtx();
202
- ctx.beginPath();
203
- ctx.moveTo(p1coord.x, p1coord.y);
204
- ctx.lineTo(p4coord.x, p4coord.y);
205
- ctx.moveTo(0, 0);
206
- ctx.arc(0, 0, polarNode.rho, begin, end, false);
207
-
208
- ctx.moveTo(p2coord.x, p2coord.y);
209
- ctx.lineTo(p3coord.x, p3coord.y);
210
- ctx.moveTo(0, 0);
211
- ctx.arc(0, 0, polarNode.rho + ldist, end, begin, true);
212
-
213
- ctx.fill();
214
- }
215
- });
216
-
217
- ST.Plot.NodeTypes.implement({
218
- //Create a new node type that renders an entire RGraph visualization
219
- 'piechart': function(node, canvas, animating) {
220
- var ctx = canvas.getCtx(), pos = node.pos.getc(true);
221
- ctx.save();
222
- ctx.translate(pos.x, pos.y);
223
- pie.plot();
224
- ctx.restore();
225
- }
226
- });
227
- //end
228
-
229
- //init pie
230
- var pie = new RGraph(canvas, {
231
- //Add node/edge styles and set
232
- //overridable=true if you want your
233
- //styles to be individually overriden
234
- Node: {
235
- 'overridable': true,
236
- 'type':'shortnodepie'
237
- },
238
- Edge: {
239
- 'type':'none'
240
- },
241
- //Parent-children distance
242
- levelDistance: 15,
243
- //Don't create labels for this visualization
244
- withLabels: false,
245
- //Don't clear the canvas when plotting
246
- clearCanvas: false
247
- });
248
- //load graph.
249
- pie.loadJSON(jsonpie);
250
- pie.compute();
251
- //end
252
-
253
- //init st
254
- var st = new ST(canvas, {
255
- orientation: 'bottom',
256
- //Add node/edge styles
257
- Node: {
258
- 'type': 'piechart',
259
- width: 60,
260
- height: 60
261
- },
262
- Edge: {
263
- color: '#999',
264
- type: 'quadratic:begin'
265
- },
266
- //Parent-children distance
267
- levelDistance: 60,
268
-
269
- //Add styles to node labels on label creation
270
- onCreateLabel: function(domElement, node){
271
- //add some styles to the node label
272
- var style = domElement.style;
273
- domElement.id = node.id;
274
- style.color = '#fff';
275
- style.fontSize = '0.8em';
276
- style.textAlign = 'center';
277
- style.width = "60px";
278
- style.height = "24px";
279
- style.paddingTop = "22px";
280
- style.cursor = 'pointer';
281
- domElement.innerHTML = node.name;
282
- domElement.onclick = function() {
283
- st.onClick(node.id, {
284
- Move: {
285
- offsetY: -90
286
- }
287
- });
288
- };
289
- }
290
- });
291
- //load json data
292
- st.loadJSON(json);
293
- //compute node positions and layout
294
- st.compute();
295
- //optional: make a translation of the tree
296
- st.geom.translate(new Complex(0, 200), "startPos");
297
- //Emulate a click on the root node.
298
- st.onClick(st.root, {
299
- Move: {
300
- offsetY: -90
301
- }
302
- });
303
- //end
304
- }