mongo3 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,12 @@
1
- <div id="crumbs"><%= partial 'crumbs' %></div>
1
+ <div id="crumbs">
2
+ <%= partial 'crumbs' %>
3
+ </div>
2
4
 
3
5
  <div id="landscape"></div>
4
6
 
5
7
  <div id="right">
6
- <span id="log"></span>
7
- <div id="info"></div>
8
+ <div id="info"></div>
9
+ <span id="log"></span>
8
10
  </div>
9
11
 
10
12
  <div id="details" class="overlay">
@@ -12,60 +14,59 @@
12
14
  </div>
13
15
 
14
16
  <script>
17
+ function center( node_id ) {
18
+ ht.onClick( node_id, {
19
+ Move: { enable: true, offsetX: 30, offsetY: 5 },
20
+ onComplete: function() { update_info( node_id ); } });
21
+ }
22
+
23
+ function morphit( id, json ) {
24
+ ht.op.sum( eval( "(" + json + ")" ),
25
+ {
26
+ type: 'fade:con',
27
+ delay: 10,
28
+ hideLabels: false,
29
+ transition: Trans.Quart.easeOut,
30
+ onComplete: function() { update_info(id); }
31
+ });
32
+ Log.write( "plotting..." );
33
+ }
15
34
 
16
- function center( node_id ) {
17
- ht.onClick( node_id, {
18
- Move: { enable: true, offsetX: 30, offsetY: 5 },
19
- onComplete: function() { update_info( node_id ); } });
20
- }
21
-
22
- function morphit( id, json ) {
23
- ht.op.sum( eval( "(" + json + ")" ),
24
- {
25
- type: 'fade:con',
26
- delay: 10,
27
- hideLabels: false,
28
- transition: Trans.Quart.easeOut,
29
- onComplete: function() { update_info(id); }
35
+ $( function() {
36
+ init_landscape();
30
37
  });
31
- Log.write( "plotting..." );
32
- }
33
-
34
- $( function() {
35
- init_landscape();
36
- });
37
38
 
38
- var Log = {
39
- log: false,
40
- write: function(text) {
41
- if ( ! this.log )
42
- this.log = $('span#log');
43
- this.log.show();
44
- this.log.html( text );
45
- this.log.css('left', ((500 - this.log.offsetWidth / 2) + 'px') );
46
- this.log.fadeOut( 5000 );
47
- }
48
- };
49
-
50
- function addEvent(obj, type, fn) {
51
- if (obj.addEventListener) obj.addEventListener(type, fn, false);
52
- else obj.attachEvent('on' + type, fn);
53
- };
54
-
55
-
56
- function init_landscape() {
39
+ var Log = {
40
+ log: false,
41
+ write: function(text) {
42
+ if ( ! this.log )
43
+ this.log = $('span#log');
44
+ this.log.show();
45
+ this.log.html( text );
46
+ this.log.css('left', ((500 - this.log.offsetWidth / 2) + 'px') );
47
+ this.log.fadeOut( 5000 );
48
+ }
49
+ };
50
+
51
+ function addEvent(obj, type, fn) {
52
+ if (obj.addEventListener) obj.addEventListener(type, fn, false);
53
+ else obj.attachEvent('on' + type, fn);
54
+ };
55
+
56
+ function init_landscape() {
57
57
  var tree = document.getElementById('landscape');
58
58
  var w = tree.offsetWidth - 100, h = tree.offsetHeight - 40;
59
59
 
60
60
  var canvas = new Canvas( 'tree', {
61
- 'injectInto': 'landscape',
62
- 'width': w,
63
- 'height': h
61
+ 'injectInto': 'landscape',
62
+ 'width': w,
63
+ 'height': h
64
64
  });
65
65
 
66
66
  var style = document.getElementById('tree').style;
67
67
  style.marginLeft = "50px";
68
68
  style.marginTop = "10px";
69
+
69
70
  //init Hypertree
70
71
  ht = new Hypertree( canvas, {
71
72
  Node: {
@@ -88,163 +89,161 @@ function init_landscape() {
88
89
  domElement.innerHTML = truncate( unescape(node.name), 15 );
89
90
 
90
91
  addEvent(domElement, 'click', function () {
91
- var children_count = 0;
92
- for( var i in node.adjacencies )
93
- children_count += 1;
94
-
95
- if ( node.data && children_count == 1 && node.data.dyna )
96
- {
97
- Log.write( "fetching new data..." );
98
- var url = "/explore/more_data/";
99
- url += node.data.path + "/" + node.data.crumbs + "/";
100
- $.ajax( {
101
- dataType: 'script',
102
- type: 'GET',
103
- url: url
104
- });
105
- }
106
- else
107
- {
108
- if( node.data.path.split( '|' ).length < 4 ) {
109
- Log.write( "centering..." );
110
- ht.onClick( node.id, {
111
- Move: { enable: true, offsetX: 30, offsetY: 5 },
112
- onComplete: function() {
113
- update_info( node.id );
114
- $.ajax( {
115
- dataType: 'script',
116
- type: 'GET',
117
- url: "/explore/update_crumb/" + node.data.path + "/" + node.data.crumbs });
118
- } });
119
- }
120
- else {
121
- Log.write( "no more data" );
122
- }
123
- }
124
- });
125
- },
126
-
127
- onPlaceLabel: function(domElement, node){
128
- var item = $(domElement);
129
-
130
- item.css( 'class', "node level_#{node._depth}" );
131
-
132
- if (node._depth <= 1 ) {
133
- item.css('top', (parseInt(item.css('top')) + 10) + 'px' );
92
+ var children_count = 0;
93
+ for( var i in node.adjacencies )
94
+ children_count += 1;
95
+
96
+ if ( node.data && children_count == 1 && node.data.dyna )
97
+ {
98
+ Log.write( "fetching new data..." );
99
+ var url = "/explore/more_data/";
100
+ url += node.data.path_ids + "/" + node.data.path_names + "/";
101
+ $.ajax( {
102
+ dataType: 'script',
103
+ type: 'GET',
104
+ url: url
105
+ });
134
106
  }
135
- else if(node._depth == 2) {
136
- item.css('top', (parseInt(item.css('top')) + 10) + 'px' );
137
- }
138
- else {
107
+ else
108
+ {
109
+ if( node.data.path_ids.split( '|' ).length < 4 ) {
110
+ Log.write( "centering..." );
111
+ ht.onClick( node.id, {
112
+ Move: { enable: true, offsetX: 30, offsetY: 5 },
113
+ onComplete: function() {
114
+ update_info( node.id );
115
+ $.ajax( {
116
+ dataType: 'script',
117
+ type: 'GET',
118
+ url: "/explore/update_crumb/" + node.data.path_ids + "/" + node.data.path_names });
119
+ } });
120
+ }
121
+ else {
122
+ Log.write( "no more data" );
123
+ }
139
124
  }
140
- item.css( "left", (parseInt(item.css( 'left' )) - domElement.offsetWidth/2) + 'px');
141
- },
125
+ });
126
+ },
127
+
128
+ onPlaceLabel: function(domElement, node){
129
+ var item = $(domElement);
130
+
131
+ item.css( 'class', "node level_#{node._depth}" );
132
+
133
+ if (node._depth <= 1 ) {
134
+ item.css('top', (parseInt(item.css('top')) + 10) + 'px' );
135
+ }
136
+ else if(node._depth == 2) {
137
+ item.css('top', (parseInt(item.css('top')) + 10) + 'px' );
138
+ }
139
+ else {
140
+ }
141
+ item.css( "left", (parseInt(item.css( 'left' )) - domElement.offsetWidth/2) + 'px');
142
+ },
142
143
 
143
- onBeforePlotNode: function( node ) {
144
- level = node.data.path.split("|").length;
145
-
146
- if( level == 1 )
147
- {
148
- node.data.$dim = 10;
149
- node.data.$color = "#ff8a00";
150
- }
151
- else if( level == 2 ) {
152
- node.data.$dim = 15;
153
- node.data.$color = "#d200ff"
154
- }
155
- else if( level == 3 ) {
156
- node.data.$dim = 10;
157
- node.data.$color = "#7891ff"
158
- }
159
- else {
160
- node.data.$dim = 10;
161
- node.data.$color = "#7da241";
162
- }
163
- },
164
-
165
- onAfterCompute: function() {
166
- Log.write("loaded");
144
+ onBeforePlotNode: function( node ) {
145
+ level = node.data.path_ids.split("|").length;
146
+
147
+ if( level == 1 )
148
+ {
149
+ node.data.$dim = 10;
150
+ node.data.$color = "#ff8a00";
167
151
  }
168
- });
152
+ else if( level == 2 ) {
153
+ node.data.$dim = 15;
154
+ node.data.$color = "#d200ff"
155
+ }
156
+ else if( level == 3 ) {
157
+ node.data.$dim = 10;
158
+ node.data.$color = "#7891ff"
159
+ }
160
+ else {
161
+ node.data.$dim = 10;
162
+ node.data.$color = "#7da241";
163
+ }
164
+ },
165
+
166
+ onAfterCompute: function() {
167
+ Log.write("loaded");
168
+ } });
169
169
 
170
-
171
170
  ht.loadJSON( eval( <%=@root.to_json%> ) );
172
171
  ht.controller.onAfterCompute();
173
172
  ht.refresh();
174
- update_info( 'home' );
175
- }
176
-
177
- function update_info(node_id)
178
- {
179
- var node = null;
180
- if( node_id )
181
- node = Graph.Util.getNode(ht.graph, node_id);
182
- else
183
- node = Graph.Util.getClosestNodeToOrigin(ht.graph, "pos");
173
+
174
+ if( '<%=@center%>'.length )
175
+ update_info( '<%=@center%>' );
176
+ else
177
+ update_info( 'home' );
178
+ }
179
+
180
+ function update_info(node_id)
181
+ {
182
+ console.log( "NODE " + node_id );
183
+ var node = null;
184
+ if( node_id )
185
+ node = Graph.Util.getNode(ht.graph, node_id);
186
+ else
187
+ node = Graph.Util.getClosestNodeToOrigin(ht.graph, "pos");
188
+
189
+ console.log( "ACTUAL " + node.name + " " + node.id + " " + node.data.path_ids );
184
190
 
185
- // var parents = Graph.Util.getParents( node );
186
- // var parent = parents[0];
187
- var html = "";
188
- var depth = node.data.path.split( '|' ).length
189
- var legends = ['', 'environments', 'databases', 'collections']
191
+ var html = "";
192
+ var depth = node.data.path_ids.split( '|' ).length
193
+ var legends = ['', 'environments', 'databases', 'collections']
190
194
 
191
- var children = [];
192
- var children_hash = {};
193
- Graph.Util.eachAdjacency( node, function(adj) {
194
- child = adj.nodeTo;
195
- if( parent ) {
196
- if( child.name != parent.name ) {
195
+ var children = [];
196
+ var children_hash = {};
197
+ Graph.Util.eachAdjacency( node, function(adj) {
198
+ child = adj.nodeTo;
199
+ if( parent ) {
200
+ if( child.name != parent.name ) {
201
+ children_hash[child.name] = child;
202
+ children.push( child.name );
203
+ }
204
+ }
205
+ else {
197
206
  children_hash[child.name] = child;
198
207
  children.push( child.name );
199
208
  }
200
- }
201
- else {
202
- children_hash[child.name] = child;
203
- children.push( child.name );
204
- }
205
- });
206
- children = children.sort();
209
+ });
210
+ children = children.sort();
207
211
 
208
- html += "<span class=\"what\">" + legends[depth] + "(" + children.length + ")</span>";
209
- html += "<p style='padding:5px 10px;text-align:left;color:#c1c1c1'>";
212
+ html += "<span class=\"what\">" + legends[depth] + "(" + children.length + ")</span>";
213
+ html += "<p style='padding:5px 10px;text-align:left;color:#c1c1c1'>";
210
214
 
211
- var buff = "<ul style='font-size:0.4em'>";
212
- for( var i in children ) {
213
- var node = children_hash[children[i]];
214
- buff += "<li>";
215
- buff += make_link( node );
216
- buff += "</li>";
217
- }
218
- html += "</ul>" + buff;
219
- html += "</p>";
220
- $('div#info').html( html );
215
+ var buff = "<ul style='font-size:0.4em'>";
216
+ for( var i in children ) {
217
+ var node = children_hash[children[i]];
218
+ buff += "<li>";
219
+ buff += make_link( node );
220
+ buff += "</li>";
221
+ }
222
+ html += "</ul>" + buff;
223
+ html += "</p>";
224
+ $('div#info').html( html );
221
225
 
222
- $('a.info[rel]').overlay(
223
- { top: '15%',
224
- expose: '#1c1c1c',
225
- onBeforeLoad: function() {
226
- var wrap = this.getContent().find( 'div#wrap' );
227
- wrap.load( this.getTrigger().attr( 'href' ) );
228
- // $.ajax( {
229
- // url: this.getTrigger().attr( 'href' ),
230
- // dataType: 'script',
231
- // success: function(data) { $('div#details').html( data ); },
232
- // type: 'GET' } );
233
- }
234
- });
235
- }
236
-
237
- function make_link( node )
238
- {
239
- return "<a rel=\"div#details\" class=\"info\" href=\"/explore/show/" + node.data.path + "/" + node.data.crumbs + "\">" + node.name + "</a>";
240
- }
241
-
242
- function refresh_data( url, path, name )
243
- {
244
- $.ajax( {
245
- dataType: 'script',
246
- type: 'GET',
247
- url: url + "/" + path + "/" + name
248
- });
249
- }
226
+ $('a.info[rel]').overlay(
227
+ { top: '15%',
228
+ expose: '#1c1c1c',
229
+ onBeforeLoad: function() {
230
+ var wrap = this.getContent().find( 'div#wrap' );
231
+ wrap.load( this.getTrigger().attr( 'href' ) );
232
+ }
233
+ });
234
+ }
235
+
236
+ function make_link( node )
237
+ {
238
+ return "<a rel=\"div#details\" class=\"info\" href=\"/explore/show/" + node.data.path_ids + "/" + node.data.path_names + "\">" + node.name + "</a>";
239
+ }
240
+
241
+ function refresh_data( url, path, name )
242
+ {
243
+ $.ajax( {
244
+ dataType: 'script',
245
+ type: 'GET',
246
+ url: url + "/" + path + "/" + name
247
+ });
248
+ }
250
249
  </script>
data/lib/views/layout.erb CHANGED
@@ -16,7 +16,7 @@
16
16
  <body id="body">
17
17
  <div id="overall">
18
18
  <div id="logo">
19
- <a href="/">
19
+ <a href="/explore">
20
20
  <img src='/images/mongo3.png' style="border:none"/>
21
21
  </a>
22
22
  </div>
data/tasks/rdoc.rake CHANGED
@@ -19,8 +19,6 @@ namespace :doc do
19
19
  end
20
20
  rd.rdoc_files.push(*files)
21
21
 
22
- puts files.inspect
23
-
24
22
  name = PROJ.name
25
23
  rf_name = PROJ.rubyforge.name
26
24
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernand Galiana
@@ -9,9 +9,39 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-24 00:00:00 -07:00
12
+ date: 2009-12-26 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: mongo
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.18.1
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: mongo_ext
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.18.1
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: agnostic-will_paginate
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 3.0.0
44
+ version:
15
45
  - !ruby/object:Gem::Dependency
16
46
  name: bones
17
47
  type: :development
@@ -29,16 +59,22 @@ executables:
29
59
  extensions: []
30
60
 
31
61
  extra_rdoc_files:
62
+ - lib/views/_cltn.erb
32
63
  - lib/views/_cltn_info.erb
33
64
  - lib/views/_collection.erb
34
65
  - lib/views/_crumbs.erb
35
66
  - lib/views/_dump_array.erb
36
67
  - lib/views/_dump_hash.erb
68
+ - lib/views/_fields_form.erb
37
69
  - lib/views/_info.erb
70
+ - lib/views/_search_form.erb
38
71
  - lib/views/center_js.erb
72
+ - lib/views/cltn_list.erb
39
73
  - lib/views/cltn_show.erb
74
+ - lib/views/cltn_update_js.erb
40
75
  - lib/views/collection.erb
41
76
  - lib/views/database.erb
77
+ - lib/views/db_list.erb
42
78
  - lib/views/db_show.erb
43
79
  - lib/views/explore.erb
44
80
  - lib/views/landscape.erb
@@ -58,12 +94,15 @@ files:
58
94
  - lib/controllers/collections.rb
59
95
  - lib/controllers/databases.rb
60
96
  - lib/controllers/explore.rb
97
+ - lib/helpers/collection_helper.rb
61
98
  - lib/helpers/crumb_helper.rb
62
99
  - lib/helpers/main_helper.rb
63
100
  - lib/main.rb
64
101
  - lib/mongo3.rb
65
102
  - lib/mongo3/connection.rb
66
103
  - lib/mongo3/node.rb
104
+ - lib/public/.DS_Store
105
+ - lib/public/images/button.png
67
106
  - lib/public/images/c292199_a.jpg
68
107
  - lib/public/images/close.png
69
108
  - lib/public/images/close.psd
@@ -97,6 +136,15 @@ files:
97
136
  - lib/public/images/monkey.psd
98
137
  - lib/public/images/monkey_1.jpg
99
138
  - lib/public/images/monkey_10.jpg
139
+ - lib/public/images/search.png
140
+ - lib/public/images/tooltip/black.png
141
+ - lib/public/images/tooltip/black_arrow.png
142
+ - lib/public/images/tooltip/black_arrow_big.png
143
+ - lib/public/images/tooltip/black_big.png
144
+ - lib/public/images/tooltip/white.png
145
+ - lib/public/images/tooltip/white_arrow.png
146
+ - lib/public/images/tooltip/white_arrow_big.png
147
+ - lib/public/images/tooltip/white_big.png
100
148
  - lib/public/javascripts/Jit-1.1.3.zip
101
149
  - lib/public/javascripts/Jit/Examples/Hypertree/example1.html
102
150
  - lib/public/javascripts/Jit/Examples/Hypertree/example1.js
@@ -147,16 +195,22 @@ files:
147
195
  - lib/public/javascripts/jquery_ui_min.js
148
196
  - lib/public/stylesheets/mongo3.css
149
197
  - lib/utils.rb
198
+ - lib/views/_cltn.erb
150
199
  - lib/views/_cltn_info.erb
151
200
  - lib/views/_collection.erb
152
201
  - lib/views/_crumbs.erb
153
202
  - lib/views/_dump_array.erb
154
203
  - lib/views/_dump_hash.erb
204
+ - lib/views/_fields_form.erb
155
205
  - lib/views/_info.erb
206
+ - lib/views/_search_form.erb
156
207
  - lib/views/center_js.erb
208
+ - lib/views/cltn_list.erb
157
209
  - lib/views/cltn_show.erb
210
+ - lib/views/cltn_update_js.erb
158
211
  - lib/views/collection.erb
159
212
  - lib/views/database.erb
213
+ - lib/views/db_list.erb
160
214
  - lib/views/db_show.erb
161
215
  - lib/views/explore.erb
162
216
  - lib/views/landscape.erb