mongo3 0.0.3 → 0.0.4
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.
- data/HISTORY +13 -5
- data/README.rdoc +4 -1
- data/bin/mongo3 +1 -1
- data/data/populate +10 -4
- data/lib/controllers/collections.rb +8 -14
- data/lib/controllers/databases.rb +22 -2
- data/lib/controllers/explore.rb +11 -13
- data/lib/helpers/crumb_helper.rb +1 -1
- data/lib/helpers/main_helper.rb +10 -4
- data/lib/main.rb +2 -1
- data/lib/mongo3/connection.rb +21 -10
- data/lib/mongo3.rb +1 -1
- data/lib/public/javascripts/.DS_Store +0 -0
- data/lib/public/stylesheets/mongo3.css +43 -0
- data/lib/views/collections/_rows.erb +23 -21
- data/lib/views/collections/_search_form.erb +2 -0
- data/lib/views/collections/all_done.js.erb +2 -0
- data/lib/views/collections/list.erb +31 -30
- data/lib/views/databases/_results.erb +57 -0
- data/lib/views/databases/list.erb +3 -25
- data/lib/views/databases/results.js.erb +2 -0
- data/lib/views/explore/_info.erb +6 -4
- data/lib/views/layout.erb +1 -2
- data/lib/views/shared/flash.js.erb +1 -1
- metadata +8 -2
- data/lib/public/javascripts/jquery.confirm.js +0 -132
data/HISTORY
CHANGED
@@ -1,8 +1,16 @@
|
|
1
1
|
0.0.1 - Initial Drop
|
2
|
-
not much there yet...
|
2
|
+
o not much there yet...
|
3
|
+
|
3
4
|
0.0.2 -
|
4
|
-
Added mongo auth
|
5
|
-
Added collection/db views
|
5
|
+
o Added mongo auth
|
6
|
+
o Added collection/db views
|
7
|
+
|
6
8
|
0.0.3 -
|
7
|
-
Added collection crud
|
8
|
-
Refactored view code
|
9
|
+
o Added collection crud
|
10
|
+
o Refactored view code
|
11
|
+
|
12
|
+
0.0.4 - Winter cleaning!
|
13
|
+
o Fixed issue on over extending cookies. Ie mongo3 suffered amnesia. Switching to memcache
|
14
|
+
o Using memcache for session store - will need a local memcache server on default port!
|
15
|
+
o Added confirm dialog on clear and drop
|
16
|
+
o Bug fixes and some refactor
|
data/README.rdoc
CHANGED
@@ -38,6 +38,7 @@
|
|
38
38
|
|
39
39
|
* mongo + mongo_ext
|
40
40
|
* agnostic-will_paginate
|
41
|
+
* memcache-client
|
41
42
|
|
42
43
|
== INSTALL:
|
43
44
|
|
@@ -65,7 +66,9 @@
|
|
65
66
|
|
66
67
|
=== Launch It!
|
67
68
|
|
68
|
-
Launch it. Fires up sinatra and opens up the console
|
69
|
+
Launch it. Fires up sinatra and opens up the console
|
70
|
+
NOTE: Assumes memcache server is running on local host with default port!
|
71
|
+
|
69
72
|
> mongo3
|
70
73
|
|
71
74
|
== LICENSE:
|
data/bin/mongo3
CHANGED
data/data/populate
CHANGED
@@ -6,8 +6,13 @@ connection = Mongo::Connection.new( 'localhost', 27018 )
|
|
6
6
|
db = connection.db( 'admin' )
|
7
7
|
db.authenticate( 'admin', 'admin')
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
db_name = "fernand_mdb"
|
10
|
+
cltn_name = "blee"
|
11
|
+
|
12
|
+
|
13
|
+
db = connection.db( db_name )
|
14
|
+
|
15
|
+
cltn = db.create_collection( cltn_name )
|
11
16
|
cltn.remove
|
12
17
|
|
13
18
|
10.times do |i|
|
@@ -16,5 +21,6 @@ puts "Inserting row #{row.inspect}"
|
|
16
21
|
cltn.insert( row )
|
17
22
|
end
|
18
23
|
|
19
|
-
cltn = db[
|
20
|
-
puts "
|
24
|
+
cltn = db[cltn_name]
|
25
|
+
puts ""
|
26
|
+
puts "Inserted `#{cltn.count} records in `#{cltn_name}"
|
@@ -4,12 +4,12 @@ module Collections
|
|
4
4
|
|
5
5
|
# ---------------------------------------------------------------------------
|
6
6
|
# Paginate on a collection
|
7
|
-
get "/collections/:page" do
|
7
|
+
get "/collections/:page" do
|
8
8
|
@back_url = "/explore/back"
|
9
9
|
@page = params[:page].to_i || 1
|
10
10
|
@title = title_for( session[:path_names] )
|
11
11
|
|
12
|
-
load_cltn( params[:page].to_i )
|
12
|
+
load_cltn( params[:page].to_i )
|
13
13
|
erb :'collections/list'
|
14
14
|
end
|
15
15
|
|
@@ -55,20 +55,16 @@ module Collections
|
|
55
55
|
|
56
56
|
get '/collections/clear/' do
|
57
57
|
path_names = session[:path_names]
|
58
|
-
options.connection.clear_cltn( path_names )
|
59
|
-
|
60
|
-
|
61
|
-
flash_it!( :info, "Collection #{path_names.split('|').last} was cleared successfully!" )
|
62
|
-
erb :'collections/results.js', :layout => false
|
58
|
+
options.connection.clear_cltn( path_names )
|
59
|
+
flash_it!( :info, "Collection `#{path_names.split('|').last} was cleared successfully!" )
|
60
|
+
erb :'collections/all_done.js', :layout => false
|
63
61
|
end
|
64
62
|
|
65
63
|
get '/collections/drop/' do
|
66
64
|
path_names = session[:path_names]
|
67
|
-
options.connection.drop_cltn( path_names )
|
68
|
-
|
69
|
-
|
70
|
-
flash_it!( :info, "Collection #{path_names.split('|').last} was dropped successfully!" )
|
71
|
-
erb :'collections/results.js', :layout => false
|
65
|
+
options.connection.drop_cltn( path_names )
|
66
|
+
flash_it!( :info, "Collection `#{path_names.split('|').last} was dropped successfully!" )
|
67
|
+
erb :'collections/all_done.js', :layout => false
|
72
68
|
end
|
73
69
|
|
74
70
|
# ===========================================================================
|
@@ -82,10 +78,8 @@ module Collections
|
|
82
78
|
@query = [query_params.first.to_json, query_params.last.to_json].join( " | " )
|
83
79
|
@query.gsub!( /\"/, "'" )
|
84
80
|
end
|
85
|
-
puts "QUERY #{@query.inspect}"
|
86
81
|
@page = page
|
87
82
|
path_names = session[:path_names]
|
88
|
-
path_ids = session[:path_ids]
|
89
83
|
|
90
84
|
@cltn = options.connection.paginate_cltn( path_names, query_params, @page, 15 )
|
91
85
|
@cols = []
|
@@ -3,7 +3,6 @@ module Databases
|
|
3
3
|
# ---------------------------------------------------------------------------
|
4
4
|
get "/databases/:page" do
|
5
5
|
page = params[:page].to_i || 1
|
6
|
-
path_ids = session[:path_ids]
|
7
6
|
path_names = session[:path_names]
|
8
7
|
|
9
8
|
@cltns = options.connection.paginate_db( path_names, page, 10 )
|
@@ -11,6 +10,27 @@ module Databases
|
|
11
10
|
@back_url = "/explore/back"
|
12
11
|
|
13
12
|
erb :'databases/list'
|
14
|
-
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# ---------------------------------------------------------------------------
|
16
|
+
get "/databases/drop/" do
|
17
|
+
path_names = session[:path_names]
|
18
|
+
options.connection.drop_db( path_names )
|
19
|
+
|
20
|
+
redirect "/explore/back"
|
21
|
+
end
|
22
|
+
|
23
|
+
# ---------------------------------------------------------------------------
|
24
|
+
post "/databases/delete/" do
|
25
|
+
path = params[:path]
|
26
|
+
|
27
|
+
options.connection.drop_cltn( path )
|
28
|
+
|
29
|
+
flash_it!( :info, "Collection #{path.split('|').last} was dropped successfully!" )
|
30
|
+
|
31
|
+
@cltns = options.connection.paginate_db( session[:path_names], 1, 10 )
|
32
|
+
|
33
|
+
erb :'databases/results.js', :layout => false
|
34
|
+
end
|
15
35
|
|
16
36
|
end
|
data/lib/controllers/explore.rb
CHANGED
@@ -12,17 +12,17 @@ module Explore
|
|
12
12
|
session[:selected_cols] = nil
|
13
13
|
session[:query_params] = nil
|
14
14
|
|
15
|
-
back_paths!
|
16
|
-
path_ids = session[:path_ids]
|
17
|
-
path_names = session[:path_names]
|
15
|
+
back_paths!
|
18
16
|
|
19
17
|
reset_crumbs!
|
18
|
+
path_names = session[:path_names]
|
19
|
+
path_ids = session[:path_ids]
|
20
20
|
crumbs_from_path( path_ids, path_names )
|
21
21
|
|
22
|
-
@root = options.connection.build_partial_tree(
|
22
|
+
@root = options.connection.build_partial_tree( path_names )
|
23
23
|
|
24
24
|
# need to adjust crumbs in case something got blown...
|
25
|
-
@center = path_ids.split(
|
25
|
+
@center = path_ids.split('|').last
|
26
26
|
|
27
27
|
erb :'explore/explore'
|
28
28
|
end
|
@@ -31,26 +31,24 @@ module Explore
|
|
31
31
|
get '/explore/show/:path_ids/:path_names' do
|
32
32
|
path_ids = params[:path_ids]
|
33
33
|
path_names = params[:path_names]
|
34
|
-
|
35
|
-
|
34
|
+
|
35
|
+
update_paths!( path_ids, path_names )
|
36
36
|
|
37
|
-
|
38
|
-
session[:path_names] = path_names
|
39
|
-
|
37
|
+
@info = options.connection.show( path_names )
|
40
38
|
partial :'explore/info'
|
41
39
|
end
|
42
40
|
|
43
41
|
# -----------------------------------------------------------------------------
|
44
42
|
get '/explore/more_data/:path_ids/:path_names/*' do
|
45
43
|
path_ids = params[:path_ids]
|
44
|
+
parent_id = path_ids.split("|").last
|
46
45
|
path_names = params[:path_names]
|
47
46
|
|
48
|
-
|
49
|
-
session[:path_names] = path_names
|
47
|
+
update_paths!( path_ids, path_names )
|
50
48
|
|
51
49
|
crumbs_from_path( path_ids, path_names )
|
52
50
|
|
53
|
-
@sub_tree = options.connection.build_sub_tree(
|
51
|
+
@sub_tree = options.connection.build_sub_tree( parent_id, path_names )
|
54
52
|
@node_id = @sub_tree.first[:id]
|
55
53
|
|
56
54
|
erb :'explore/more_data_js', :layout => false
|
data/lib/helpers/crumb_helper.rb
CHANGED
data/lib/helpers/main_helper.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
module MainHelper
|
2
2
|
helpers do
|
3
3
|
|
4
|
+
def update_paths!( path_ids, path_names )
|
5
|
+
puts "UPDAING PATH #{path_ids} -- #{path_names}"
|
6
|
+
session[:path_ids] = path_ids
|
7
|
+
session[:path_names] = path_names
|
8
|
+
end
|
9
|
+
|
4
10
|
def align_for( value )
|
5
11
|
return "right" if value.is_a?(Fixnum)
|
6
12
|
"left"
|
@@ -12,16 +18,16 @@ module MainHelper
|
|
12
18
|
value
|
13
19
|
end
|
14
20
|
|
15
|
-
def back_paths!
|
21
|
+
def back_paths!
|
16
22
|
path_ids = session[:path_ids]
|
17
|
-
path_names = session[:path_names]
|
18
23
|
new_path_ids = path_ids.split( "|" )
|
19
24
|
new_path_ids.pop
|
20
|
-
session[:path_ids] = new_path_ids.join( "|" )
|
21
25
|
|
26
|
+
path_names = session[:path_names]
|
22
27
|
new_path_names = path_names.split( "|" )
|
23
28
|
new_path_names.pop
|
24
|
-
|
29
|
+
|
30
|
+
update_paths!( new_path_ids.join( "|" ), new_path_names.join( "|" ) )
|
25
31
|
end
|
26
32
|
|
27
33
|
def title_for( path_names )
|
data/lib/main.rb
CHANGED
@@ -15,7 +15,8 @@ configure do
|
|
15
15
|
Mongo3.load_all_libs_relative_to(__FILE__, 'helpers' )
|
16
16
|
Mongo3.load_all_libs_relative_to(__FILE__, 'controllers' )
|
17
17
|
|
18
|
-
|
18
|
+
use Rack::Session::Memcache, :namespace => 'mongo3'
|
19
|
+
|
19
20
|
set :connection, Mongo3::Connection.new( File.join( ENV['HOME'], %w[.mongo3 landscape.yml] ) )
|
20
21
|
end
|
21
22
|
|
data/lib/mongo3/connection.rb
CHANGED
@@ -5,6 +5,15 @@ module Mongo3
|
|
5
5
|
@config_file = config_file
|
6
6
|
end
|
7
7
|
|
8
|
+
def drop_db( path_names )
|
9
|
+
path_name_tokens = path_names.split( "|" )
|
10
|
+
env = path_name_tokens[1]
|
11
|
+
connect_for( env ) do |con|
|
12
|
+
db_name = path_name_tokens.pop
|
13
|
+
con.drop_database( db_name )
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
8
17
|
def drop_cltn( path_names )
|
9
18
|
path_name_tokens = path_names.split( "|" )
|
10
19
|
env = path_name_tokens[1]
|
@@ -56,11 +65,14 @@ module Mongo3
|
|
56
65
|
con.database_info.sort { |a,b| b[1] <=> a[1] }.each { |e| info[:databases][e[0]] = to_mb( e[1] ) }
|
57
66
|
info[:server] = con.server_info
|
58
67
|
end
|
68
|
+
# BOZO !! Need to figure out links strategy!
|
59
69
|
elsif path_name_tokens.size == 3
|
60
70
|
db_name = path_name_tokens.pop
|
71
|
+
info[:links] = OrderedHash.new
|
61
72
|
connect_for( env ) do |con|
|
62
73
|
db = con.db( db_name )
|
63
|
-
info[:
|
74
|
+
info[:links][:manage] = "/databases/1"
|
75
|
+
# info[:links][:drop] = "/databases/drop/"
|
64
76
|
info[:size] = to_mb( con.database_info[db_name] )
|
65
77
|
info[:node] = db.nodes
|
66
78
|
info[:collections] = db.collection_names.size
|
@@ -68,16 +80,18 @@ module Mongo3
|
|
68
80
|
info[:last_status] = db.last_status
|
69
81
|
end
|
70
82
|
elsif path_name_tokens.size == 4
|
83
|
+
info[:links] = OrderedHash.new
|
71
84
|
cltn_name = path_name_tokens.pop
|
72
85
|
db_name = path_name_tokens.pop
|
73
86
|
connect_for( env ) do |con|
|
74
87
|
db = con.db( db_name )
|
75
88
|
cltn = db[cltn_name]
|
76
89
|
indexes = db.index_information( cltn_name )
|
77
|
-
|
78
|
-
info[:
|
79
|
-
info[:
|
80
|
-
info[:
|
90
|
+
|
91
|
+
info[:links][:manage] = "/collections/1"
|
92
|
+
# info[:links][:drop] = "/collections/drop/"
|
93
|
+
info[:size] = cltn.count
|
94
|
+
info[:indexes] = format_indexes( indexes ) if indexes and !indexes.empty?
|
81
95
|
end
|
82
96
|
end
|
83
97
|
info
|
@@ -151,8 +165,7 @@ module Mongo3
|
|
151
165
|
end
|
152
166
|
|
153
167
|
# Build environment tree
|
154
|
-
def build_partial_tree(
|
155
|
-
path_id_tokens = path_ids.split( "|" )
|
168
|
+
def build_partial_tree( path_names )
|
156
169
|
path_name_tokens = path_names.split( "|" )
|
157
170
|
bm_env = path_name_tokens[1]
|
158
171
|
bm_cltn = path_name_tokens.pop if path_name_tokens.size == 4
|
@@ -192,11 +205,9 @@ module Mongo3
|
|
192
205
|
end
|
193
206
|
|
194
207
|
# Build an appropriate subtree based on requested item
|
195
|
-
def build_sub_tree(
|
196
|
-
path_id_tokens = path_ids.split( "|" )
|
208
|
+
def build_sub_tree( parent_id, path_names )
|
197
209
|
path_name_tokens = path_names.split( "|" )
|
198
210
|
env = path_name_tokens[1]
|
199
|
-
parent_id = path_id_tokens.last
|
200
211
|
|
201
212
|
if db_request?( path_name_tokens )
|
202
213
|
sub_tree = build_db_tree( parent_id, env )
|
data/lib/mongo3.rb
CHANGED
Binary file
|
@@ -420,3 +420,46 @@ input.no_input {
|
|
420
420
|
color: #c1c1c1;
|
421
421
|
}
|
422
422
|
|
423
|
+
div#mgmt_actions {
|
424
|
+
text-align: right;
|
425
|
+
width: 100%;
|
426
|
+
}
|
427
|
+
div#mgmt_actions span {
|
428
|
+
font-size: 1em;
|
429
|
+
}
|
430
|
+
|
431
|
+
button.action {
|
432
|
+
background: transparent url(/images/button_act.png) repeat-x center bottom;
|
433
|
+
}
|
434
|
+
button.clear:hover {
|
435
|
+
background-color: #3e41bd;
|
436
|
+
}
|
437
|
+
button.drop:hover {
|
438
|
+
background-color: #bb1947;
|
439
|
+
}
|
440
|
+
|
441
|
+
img.delete {
|
442
|
+
cursor: pointer;
|
443
|
+
border: 0;
|
444
|
+
display:none;
|
445
|
+
}
|
446
|
+
img.wait {
|
447
|
+
width: 16px;
|
448
|
+
height: 16px;
|
449
|
+
vertical-align: sub;
|
450
|
+
display: none;
|
451
|
+
}
|
452
|
+
|
453
|
+
.modal {
|
454
|
+
background-color: #212021;
|
455
|
+
display: none;
|
456
|
+
width: 350px;
|
457
|
+
padding: 15px;
|
458
|
+
text-align: center;
|
459
|
+
border: 2px solid #333;
|
460
|
+
opacity: 0.8;
|
461
|
+
-moz-border-radius: 6px;
|
462
|
+
-webkit-border-radius: 6px;
|
463
|
+
-moz-box-shadow: 0 0 20px #92b948;
|
464
|
+
-webkit-box-shadow: 0 0 20px #92b948;
|
465
|
+
}
|
@@ -14,8 +14,8 @@
|
|
14
14
|
<% id = cltn['_id'] %>
|
15
15
|
<tr id="<%=id%>" valign="top">
|
16
16
|
<td id="<%=id%>">
|
17
|
-
<img class="delete" id="<%=id%>" src="/images/delete.png"
|
18
|
-
<img id="wait_<%=id%>" src="/images/loading.gif"
|
17
|
+
<img class="delete" id="<%=id%>" src="/images/delete.png" title="delete this record"/>
|
18
|
+
<img class="wait" id="wait_<%=id%>" src="/images/loading.gif"></img>
|
19
19
|
</td>
|
20
20
|
<% @selected_cols.each do |k| %>
|
21
21
|
<td><%= format_number(cltn[k]) %></td>
|
@@ -30,24 +30,26 @@
|
|
30
30
|
</div>
|
31
31
|
|
32
32
|
<script>
|
33
|
-
$(
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
33
|
+
$( function() {
|
34
|
+
$("table#cltn tr" ).hover(
|
35
|
+
function() {
|
36
|
+
$(this).addClass( 'highlight' );
|
37
|
+
$("td#" + $(this).attr('id') + " img.delete" ).show();
|
38
|
+
},
|
39
|
+
function() {
|
40
|
+
$(this).removeClass( 'highlight' );
|
41
|
+
$("td#" + $(this).attr('id') + " img.delete" ).hide();
|
42
|
+
});
|
43
|
+
$( "img.delete" ).click( function() {
|
44
|
+
var id = $(this).attr('id');
|
45
|
+
$.ajax({
|
46
|
+
data: {id: id},
|
47
|
+
dataType: 'script',
|
48
|
+
type: 'post',
|
49
|
+
url: '/collections/delete/',
|
50
|
+
beforeSend: function() { $('img#_wait_' + id ).show(); },
|
51
|
+
complete: function() { $('img#_wait_' + id ).hide(); }
|
52
|
+
});
|
53
|
+
});
|
52
54
|
});
|
53
55
|
</script>
|
@@ -1,3 +1,5 @@
|
|
1
|
+
<script src="/javascripts/jquery.example.js" type="text/javascript"></script>
|
2
|
+
|
1
3
|
<form id="search" onsubmit="search_submit();return false;" action="/collections/search/" method="post" style="text-align:center;margin:10px">
|
2
4
|
<fieldset>
|
3
5
|
<input id="search" type="text" name="search" class="search" value="<%=@query%>"/>
|
@@ -1,52 +1,53 @@
|
|
1
|
-
<style>
|
2
|
-
div#actions {
|
3
|
-
text-align: right;
|
4
|
-
width: 100%;
|
5
|
-
}
|
6
|
-
div#actions span {
|
7
|
-
font-size: 1em;
|
8
|
-
}
|
9
|
-
button.action {
|
10
|
-
background: transparent url(/images/button_act.png) repeat-x center bottom;
|
11
|
-
}
|
12
|
-
button.clear:hover {
|
13
|
-
background-color: #3e41bd;
|
14
|
-
}
|
15
|
-
button.drop:hover {
|
16
|
-
background-color: #bb1947;
|
17
|
-
}
|
18
|
-
</style>
|
19
|
-
|
20
1
|
<div class="cltn">
|
21
2
|
<div class="title"><%=@title%></div>
|
22
3
|
<a class="back" href="<%=@back_url%>">« back</a>
|
23
4
|
|
24
|
-
<div id="
|
5
|
+
<div id="mgmt_actions">
|
25
6
|
<img id="action_load" src="/images/loading.gif" style="width:25px;height:25px;vertical-align:sub;display:none"></img>
|
26
|
-
<button class="action clear" title="Delete all records from collection">clear</button>
|
27
|
-
<button class="action drop" title="Drop the entire collection">drop</button>
|
7
|
+
<button class="action clear" rel="#confirm_clear" title="Delete all records from collection">clear</button>
|
8
|
+
<button class="action drop" rel="#confirm_drop" title="Drop the entire collection">drop</button>
|
28
9
|
</div>
|
29
10
|
<div id="results">
|
30
11
|
<%= partial :'collections/results' %>
|
31
12
|
</div>
|
32
13
|
<div>
|
33
14
|
|
34
|
-
|
15
|
+
<div class="modal" id="confirm_clear">
|
16
|
+
<p>Clearing out the whole collection. Are you sure?</p>
|
17
|
+
<p style="margin:10px">
|
18
|
+
<button class="close yes" id="clear"> Yes </button>
|
19
|
+
<button class="close"> No </button>
|
20
|
+
</p>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div class="modal" id="confirm_drop">
|
24
|
+
<p>Dropping the whole collection. Are you sure?</p>
|
25
|
+
<p style="margin:10px">
|
26
|
+
<button class="close yes" id="drop"> Yes </button>
|
27
|
+
<button class="close"> No </button>
|
28
|
+
</p>
|
29
|
+
</div>
|
30
|
+
|
35
31
|
<script>
|
36
32
|
$( function() {
|
37
|
-
$(
|
38
|
-
|
39
|
-
|
40
|
-
|
33
|
+
$('button.action' ).overlay( {
|
34
|
+
expose: {
|
35
|
+
color: '#212021',
|
36
|
+
loadSpeed: 200,
|
37
|
+
opacity: 0.9
|
38
|
+
},
|
39
|
+
closeOnClick: false
|
40
|
+
});
|
41
41
|
|
42
|
+
$( 'button.yes' ).click( function() {
|
42
43
|
$.ajax({
|
43
44
|
dataType: 'script',
|
44
45
|
type: 'get',
|
45
|
-
url: '/collections/' + $(this).
|
46
|
+
url: '/collections/' + $(this).attr('id') + "/",
|
46
47
|
beforeSend: function() { $('img#action_load').show(); },
|
47
48
|
complete: function() { $('img#action_load').hide(); }
|
48
|
-
});
|
49
|
-
})
|
49
|
+
});
|
50
|
+
});
|
50
51
|
});
|
51
52
|
</script>
|
52
53
|
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<div id="summary">
|
2
|
+
<%= page_entries_info @cltns, :entry_name => 'item' %>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<table id="cltn" class="cltn" border="0" cellpadding="10" cellspacing="20">
|
6
|
+
<thead>
|
7
|
+
<th width="2%"> </th>
|
8
|
+
<% cols = @cltns.first.keys %>
|
9
|
+
<% cols.each do |col| %>
|
10
|
+
<th align="<%=align_for( @cltns.first[col] )%>"><%=col%></th>
|
11
|
+
<% end %>
|
12
|
+
</thead>
|
13
|
+
<tbody>
|
14
|
+
<% count = 0; @cltns.each do |cltn| %>
|
15
|
+
<% path = "#{session[:path_names]}|#{cltn[:name]}"%>
|
16
|
+
<tr id="<%=count%>" valign="top">
|
17
|
+
<td id="<%=count%>">
|
18
|
+
<img class="delete" id="<%=path%>" rel="<%=count%>" src="/images/delete.png" title="drop this collection"/>
|
19
|
+
<img class="wait" id="wait_<%=count%>" src="/images/loading.gif"></img>
|
20
|
+
</td>
|
21
|
+
<% cltn.each_pair do |k, v| %>
|
22
|
+
<td align="<%=align_for( v )%>"><%= format_number(v) %></td>
|
23
|
+
<% end %>
|
24
|
+
</tr>
|
25
|
+
<% count+=1;end %>
|
26
|
+
</tbody>
|
27
|
+
</table>
|
28
|
+
|
29
|
+
<div id="links">
|
30
|
+
<%= will_paginate @cltns, :params => { :url => "/databases" } %>
|
31
|
+
</div>
|
32
|
+
|
33
|
+
<script>
|
34
|
+
$( function() {
|
35
|
+
$("table#cltn tr" ).hover(
|
36
|
+
function() {
|
37
|
+
$(this).addClass( 'highlight' );
|
38
|
+
$("td#" + $(this).attr('id') + " img.delete" ).show();
|
39
|
+
},
|
40
|
+
function() {
|
41
|
+
$(this).removeClass( 'highlight' );
|
42
|
+
$("td#" + $(this).attr('id') + " img.delete" ).hide();
|
43
|
+
});
|
44
|
+
$( "img.delete" ).click( function() {
|
45
|
+
var id = $(this).attr('id');
|
46
|
+
var count = $(this).attr('rel')
|
47
|
+
$.ajax({
|
48
|
+
data: {path: id},
|
49
|
+
dataType: 'script',
|
50
|
+
type: 'post',
|
51
|
+
url: '/databases/delete/',
|
52
|
+
beforeSend: function() { $('img#_wait_' + count ).show(); },
|
53
|
+
complete: function() { $('img#_wait_' + count ).hide(); }
|
54
|
+
});
|
55
|
+
});
|
56
|
+
});
|
57
|
+
</script>
|
@@ -2,29 +2,7 @@
|
|
2
2
|
<div class="title"><%=@title%></div>
|
3
3
|
<a class="back" href="<%=@back_url%>">« back</a>
|
4
4
|
|
5
|
-
<div id="
|
6
|
-
<%=
|
5
|
+
<div id="results">
|
6
|
+
<%= partial :'databases/results'%>
|
7
7
|
</div>
|
8
|
-
|
9
|
-
<table class="cltn" border="0" cellpadding="10" cellspacing="20">
|
10
|
-
<thead>
|
11
|
-
<% cols = @cltns.first.keys %>
|
12
|
-
<% cols.each do |col| %>
|
13
|
-
<th align="<%=align_for( @cltns.first[col] )%>"><%=col%></th>
|
14
|
-
<% end %>
|
15
|
-
</thead>
|
16
|
-
<tbody>
|
17
|
-
<% @cltns.each do |cltn| %>
|
18
|
-
<tr valign="top">
|
19
|
-
<% cltn.each_pair do |k, v| %>
|
20
|
-
<td align="<%=align_for( v )%>"><%= format_number(v) %></td>
|
21
|
-
<% end %>
|
22
|
-
</tr>
|
23
|
-
<% end %>
|
24
|
-
</tbody>
|
25
|
-
</table>
|
26
|
-
|
27
|
-
<div id="links">
|
28
|
-
<%= will_paginate @cltns, :params => { :url => "/databases" } %>
|
29
|
-
</div>
|
30
|
-
<div>
|
8
|
+
<div>
|
data/lib/views/explore/_info.erb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
<h1 style="text-align:center">Details for <em><%=@info.delete( :title ) %></em></h1>
|
2
2
|
|
3
|
-
<% if @info.has_key? :
|
3
|
+
<% if @info.has_key? :links %>
|
4
4
|
<div style="text-align:right;">
|
5
|
-
|
5
|
+
<% @info.delete(:links).each_pair do |name, url| %>
|
6
|
+
<a href='<%=url%>'><%=name%></a>
|
7
|
+
<% end %>
|
6
8
|
</div>
|
7
9
|
<% end %>
|
8
10
|
|
9
|
-
<table border="0" cellpadding="10" cellspacing="20"
|
10
|
-
<thead
|
11
|
+
<table class="cltn" border="0" cellpadding="10" cellspacing="20">
|
12
|
+
<thead>
|
11
13
|
<th width="20%">Name</th>
|
12
14
|
<th width="80%">Value</th>
|
13
15
|
</thead>
|
data/lib/views/layout.erb
CHANGED
@@ -9,9 +9,8 @@
|
|
9
9
|
<script src="/javascripts/jquery_min.js" type="text/javascript"></script>
|
10
10
|
<script src="/javascripts/jquery_ui_min.js" type="text/javascript"></script>
|
11
11
|
<script src="/javascripts/jquery.tools.min.js" type="text/javascript"></script>
|
12
|
-
<script src="/javascripts/application.js" type="text/javascript"></script>
|
12
|
+
<script src="/javascripts/application.js" type="text/javascript"></script>
|
13
13
|
<script src="/javascripts/jit.min.js" type="text/javascript"></script>
|
14
|
-
<script src="/javascripts/jquery.example.js" type="text/javascript"></script>
|
15
14
|
</head>
|
16
15
|
|
17
16
|
<body id="body">
|
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.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fernand Galiana
|
@@ -63,10 +63,13 @@ extra_rdoc_files:
|
|
63
63
|
- lib/views/collections/_results.erb
|
64
64
|
- lib/views/collections/_rows.erb
|
65
65
|
- lib/views/collections/_search_form.erb
|
66
|
+
- lib/views/collections/all_done.js.erb
|
66
67
|
- lib/views/collections/list.erb
|
67
68
|
- lib/views/collections/results.js.erb
|
68
69
|
- lib/views/collections/update.js.erb
|
70
|
+
- lib/views/databases/_results.erb
|
69
71
|
- lib/views/databases/list.erb
|
72
|
+
- lib/views/databases/results.js.erb
|
70
73
|
- lib/views/explore/_crumbs.erb
|
71
74
|
- lib/views/explore/_dump_array.erb
|
72
75
|
- lib/views/explore/_dump_hash.erb
|
@@ -151,6 +154,7 @@ files:
|
|
151
154
|
- lib/public/images/tooltip/white_arrow.png
|
152
155
|
- lib/public/images/tooltip/white_arrow_big.png
|
153
156
|
- lib/public/images/tooltip/white_big.png
|
157
|
+
- lib/public/javascripts/.DS_Store
|
154
158
|
- lib/public/javascripts/Jit-1.1.3.zip
|
155
159
|
- lib/public/javascripts/Jit/Examples/Hypertree/example1.html
|
156
160
|
- lib/public/javascripts/Jit/Examples/Hypertree/example1.js
|
@@ -196,7 +200,6 @@ files:
|
|
196
200
|
- lib/public/javascripts/Jit/jit.js
|
197
201
|
- lib/public/javascripts/application.js
|
198
202
|
- lib/public/javascripts/jit.min.js
|
199
|
-
- lib/public/javascripts/jquery.confirm.js
|
200
203
|
- lib/public/javascripts/jquery.example.js
|
201
204
|
- lib/public/javascripts/jquery.tools.min.js
|
202
205
|
- lib/public/javascripts/jquery_min.js
|
@@ -207,10 +210,13 @@ files:
|
|
207
210
|
- lib/views/collections/_results.erb
|
208
211
|
- lib/views/collections/_rows.erb
|
209
212
|
- lib/views/collections/_search_form.erb
|
213
|
+
- lib/views/collections/all_done.js.erb
|
210
214
|
- lib/views/collections/list.erb
|
211
215
|
- lib/views/collections/results.js.erb
|
212
216
|
- lib/views/collections/update.js.erb
|
217
|
+
- lib/views/databases/_results.erb
|
213
218
|
- lib/views/databases/list.erb
|
219
|
+
- lib/views/databases/results.js.erb
|
214
220
|
- lib/views/explore/_crumbs.erb
|
215
221
|
- lib/views/explore/_dump_array.erb
|
216
222
|
- lib/views/explore/_dump_hash.erb
|
@@ -1,132 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Confirm plugin 1.2
|
3
|
-
*
|
4
|
-
* Copyright (c) 2007 Nadia Alramli (http://nadiana.com/)
|
5
|
-
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
6
|
-
* and GPL (GPL-LICENSE.txt) licenses.
|
7
|
-
*/
|
8
|
-
|
9
|
-
/**
|
10
|
-
* For more docs and examples visit:
|
11
|
-
* http://nadiana.com/jquery-confirm-plugin
|
12
|
-
* For comments, suggestions or bug reporting,
|
13
|
-
* email me at: http://nadiana.com/contact/
|
14
|
-
*/
|
15
|
-
|
16
|
-
jQuery.fn.confirm = function(options) {
|
17
|
-
options = jQuery.extend({
|
18
|
-
msg: 'Are you sure?',
|
19
|
-
stopAfter: 'never',
|
20
|
-
wrapper: '<span></span>',
|
21
|
-
eventType: 'click',
|
22
|
-
dialogShow: 'show',
|
23
|
-
dialogSpeed: '',
|
24
|
-
timeout: 0
|
25
|
-
}, options);
|
26
|
-
options.stopAfter = options.stopAfter.toLowerCase();
|
27
|
-
if (!options.stopAfter in ['never', 'once', 'ok', 'cancel']) {
|
28
|
-
options.stopAfter = 'never';
|
29
|
-
}
|
30
|
-
options.buttons = jQuery.extend({
|
31
|
-
ok: 'Yes',
|
32
|
-
cancel: 'No',
|
33
|
-
wrapper:'<a href="#"></a>',
|
34
|
-
separator: '/'
|
35
|
-
}, options.buttons);
|
36
|
-
|
37
|
-
// Shortcut to eventType.
|
38
|
-
var type = options.eventType;
|
39
|
-
|
40
|
-
return this.each(function() {
|
41
|
-
var target = this;
|
42
|
-
var $target = jQuery(target);
|
43
|
-
var timer;
|
44
|
-
var saveHandlers = function() {
|
45
|
-
var events = jQuery.data(target, 'events');
|
46
|
-
if (!events) {
|
47
|
-
// There are no handlers to save.
|
48
|
-
return;
|
49
|
-
}
|
50
|
-
target._handlers = new Array();
|
51
|
-
for (var i in events[type]) {
|
52
|
-
target._handlers.push(events[type][i]);
|
53
|
-
}
|
54
|
-
}
|
55
|
-
|
56
|
-
// Create ok button, and bind in to a click handler.
|
57
|
-
var $ok = jQuery(options.buttons.wrapper)
|
58
|
-
.append(options.buttons.ok)
|
59
|
-
.click(function() {
|
60
|
-
// Check if timeout is set.
|
61
|
-
if (options.timeout != 0) {
|
62
|
-
clearTimeout(timer);
|
63
|
-
}
|
64
|
-
$target.unbind(type, handler);
|
65
|
-
$target.show();
|
66
|
-
$dialog.hide();
|
67
|
-
// Rebind the saved handlers.
|
68
|
-
if (target._handlers != undefined) {
|
69
|
-
jQuery.each(target._handlers, function() {
|
70
|
-
$target.click(this);
|
71
|
-
});
|
72
|
-
}
|
73
|
-
// Trigger click event.
|
74
|
-
$target.click();
|
75
|
-
if (options.stopAfter != 'ok' && options.stopAfter != 'once') {
|
76
|
-
$target.unbind(type);
|
77
|
-
// Rebind the confirmation handler.
|
78
|
-
$target.one(type, handler);
|
79
|
-
}
|
80
|
-
return false;
|
81
|
-
})
|
82
|
-
|
83
|
-
var $cancel = jQuery(options.buttons.wrapper).append(options.buttons.cancel).click(function() {
|
84
|
-
// Check if timeout is set.
|
85
|
-
if (options.timeout != 0) {
|
86
|
-
clearTimeout(timer);
|
87
|
-
}
|
88
|
-
if (options.stopAfter != 'cancel' && options.stopAfter != 'once') {
|
89
|
-
$target.one(type, handler);
|
90
|
-
}
|
91
|
-
$target.show();
|
92
|
-
$dialog.hide();
|
93
|
-
return false;
|
94
|
-
});
|
95
|
-
|
96
|
-
if (options.buttons.cls) {
|
97
|
-
$ok.addClass(options.buttons.cls);
|
98
|
-
$cancel.addClass(options.buttons.cls);
|
99
|
-
}
|
100
|
-
|
101
|
-
var $dialog = jQuery(options.wrapper)
|
102
|
-
.append(options.msg)
|
103
|
-
.append($ok)
|
104
|
-
.append(options.buttons.separator)
|
105
|
-
.append($cancel);
|
106
|
-
|
107
|
-
var handler = function() {
|
108
|
-
jQuery(this).hide();
|
109
|
-
|
110
|
-
// Do this check because of a jQuery bug
|
111
|
-
if (options.dialogShow != 'show') {
|
112
|
-
$dialog.hide();
|
113
|
-
}
|
114
|
-
|
115
|
-
$dialog.insertBefore(this);
|
116
|
-
// Display the dialog.
|
117
|
-
$dialog[options.dialogShow](options.dialogSpeed);
|
118
|
-
if (options.timeout != 0) {
|
119
|
-
// Set timeout
|
120
|
-
clearTimeout(timer);
|
121
|
-
timer = setTimeout(function() {$cancel.click(); $target.one(type, handler);}, options.timeout);
|
122
|
-
}
|
123
|
-
return false;
|
124
|
-
};
|
125
|
-
|
126
|
-
saveHandlers();
|
127
|
-
$target.unbind(type);
|
128
|
-
target._confirm = handler
|
129
|
-
target._confirmEvent = type;
|
130
|
-
$target.one(type, handler);
|
131
|
-
});
|
132
|
-
}
|