mongo3 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +6 -1
- data/README.rdoc +2 -0
- data/Rakefile +0 -1
- data/data/populate +4 -4
- data/lib/controllers/collections.rb +42 -8
- data/lib/controllers/databases.rb +11 -1
- data/lib/controllers/explore.rb +49 -12
- data/lib/helpers/collection_helper.rb +18 -0
- data/lib/helpers/crumb_helper.rb +4 -4
- data/lib/helpers/database_helper.rb +17 -0
- data/lib/helpers/explore_helper.rb +30 -0
- data/lib/helpers/flash_helper.rb +7 -0
- data/lib/helpers/main_helper.rb +12 -30
- data/lib/helpers/paths_helper.rb +40 -0
- data/lib/mongo3.rb +1 -1
- data/lib/mongo3/connection.rb +95 -34
- data/lib/mongo3/node.rb +43 -28
- data/lib/public/images/edit.png +0 -0
- data/lib/public/images/selected_bg.png +0 -0
- data/lib/public/stylesheets/mongo3.css +87 -76
- data/lib/views/collections/_index_form.erb +35 -0
- data/lib/views/collections/_index_rows.erb +54 -0
- data/lib/views/collections/_indexes.erb +3 -0
- data/lib/views/collections/_results.erb +1 -2
- data/lib/views/collections/_rows.erb +26 -22
- data/lib/views/collections/_search_form.erb +2 -3
- data/lib/views/collections/list.erb +18 -6
- data/lib/views/collections/update.js.erb +2 -0
- data/lib/views/collections/update_indexes.js.erb +3 -0
- data/lib/views/databases/_results.erb +30 -26
- data/lib/views/databases/list.erb +7 -3
- data/lib/views/explore/_node_info.erb +131 -0
- data/lib/views/explore/center_js.erb +1 -0
- data/lib/views/explore/explore.erb +11 -80
- data/lib/views/explore/more_data_js.erb +1 -0
- data/lib/views/explore/update.js.erb +5 -0
- data/lib/views/explore/update_crumb_js.erb +2 -1
- data/lib/views/layout.erb +2 -2
- data/lib/views/shared/flash.js.erb +9 -7
- data/spec/landscape.yml +3 -0
- data/spec/mongo3/connection_spec.rb +146 -0
- data/spec/mongo3/node_spec.rb +26 -8
- data/spec/spec_helper.rb +4 -1
- data/tasks/rdoc.rake +2 -2
- metadata +23 -2
@@ -0,0 +1,35 @@
|
|
1
|
+
<script src="/javascripts/jquery.example.js" type="text/javascript"></script>
|
2
|
+
|
3
|
+
<form id="index" onsubmit="index_submit();return false;" action="/collections/create_index/" method="post" style="text-align:center">
|
4
|
+
<fieldset>
|
5
|
+
<input id="index" type="text" name="index" class="search" value=""/>
|
6
|
+
<button type="submit" id="submit_button" class="button search" style="display:none">create</button>
|
7
|
+
<img id="create_load" src="/images/loading.gif" style="width:25px;height:25px;vertical-align:sub;display:none"></img>
|
8
|
+
</fieldset>
|
9
|
+
</form>
|
10
|
+
|
11
|
+
<script>
|
12
|
+
$( function() {
|
13
|
+
$('input#index').example("[['field1', 1], ['field2', -1]] | {'unique':1}", { className: 'no_input' } );
|
14
|
+
$('input#index').hover(
|
15
|
+
function() { $(this).css( "border-color", "#92b948") },
|
16
|
+
function() { $(this).css( "border-color", "#434343") }
|
17
|
+
);
|
18
|
+
});
|
19
|
+
|
20
|
+
function index_submit()
|
21
|
+
{
|
22
|
+
$.ajax({
|
23
|
+
data: $.param( $("form#index").serializeArray() ),
|
24
|
+
dataType: 'script',
|
25
|
+
type: 'post',
|
26
|
+
url: '/collections/create_index/',
|
27
|
+
beforeSend: function() {
|
28
|
+
$('img#create_load').show();
|
29
|
+
},
|
30
|
+
complete: function() {
|
31
|
+
$('img#create_load').hide();
|
32
|
+
}
|
33
|
+
});
|
34
|
+
}
|
35
|
+
</script>
|
@@ -0,0 +1,54 @@
|
|
1
|
+
<%= partial :'collections/index_form' %>
|
2
|
+
|
3
|
+
<div class="borders" style="padding:10px">
|
4
|
+
<table id="indexes" class="cltn" border="0" cellpadding="10" cellspacing="20">
|
5
|
+
<thead>
|
6
|
+
<th width="2%"> </td>
|
7
|
+
<th>Name</th>
|
8
|
+
<th>Settings</th>
|
9
|
+
</thead>
|
10
|
+
<tbody>
|
11
|
+
<% @indexes.keys.sort.each do |name| %>
|
12
|
+
<tr id="<%=name%>" valign="top">
|
13
|
+
<td id="<%=name%>">
|
14
|
+
<img class="del_index" id="<%=name%>" src="/images/delete.png" title="delete this index"/>
|
15
|
+
<img class="wait" id="wait_<%=name%>" src="/images/loading.gif"></img>
|
16
|
+
</td>
|
17
|
+
<td><%=name%></td>
|
18
|
+
<% buff = [];@indexes[name].each do |pair| %>
|
19
|
+
<% buff << format_index( pair )%>
|
20
|
+
<% end %>
|
21
|
+
<td><%= buff.join( ", " ) %></td>
|
22
|
+
</tr>
|
23
|
+
<% end %>
|
24
|
+
</tbody>
|
25
|
+
</table>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<script>
|
29
|
+
$( function() {
|
30
|
+
$("table#indexes tr" ).hover(
|
31
|
+
function() {
|
32
|
+
$(this).addClass( 'highlight' );
|
33
|
+
$("td#" + $(this).attr('id') + " img.del_index" ).show();
|
34
|
+
},
|
35
|
+
function() {
|
36
|
+
$(this).removeClass( 'highlight' );
|
37
|
+
$("td#" + $(this).attr('id') + " img.del_index" ).hide();
|
38
|
+
});
|
39
|
+
$( "img.del_index" ).click( function() {
|
40
|
+
var id = $(this).attr('id');
|
41
|
+
$.ajax({
|
42
|
+
data: {id: id},
|
43
|
+
dataType: 'script',
|
44
|
+
type: 'post',
|
45
|
+
url: '/collections/drop_index/',
|
46
|
+
beforeSend: function() { $('img#_wait_' + id ).show(); },
|
47
|
+
complete: function() {
|
48
|
+
$('img#_wait_' + id ).hide();
|
49
|
+
$('tr#' + id ).fadeOut();
|
50
|
+
}
|
51
|
+
});
|
52
|
+
});
|
53
|
+
});
|
54
|
+
</script>
|
@@ -2,28 +2,32 @@
|
|
2
2
|
<%= page_entries_info @cltn, :entry_name => 'item' %>
|
3
3
|
</div>
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
</
|
5
|
+
<%= partial :'collections/search_form' %>
|
6
|
+
|
7
|
+
<div class="borders" style="padding:10px;">
|
8
|
+
<table id="cltn" class="cltn" border="0" cellpadding="10" cellspacing="20">
|
9
|
+
<thead>
|
10
|
+
<th width="2%"> </td>
|
11
|
+
<% @selected_cols.each do |col| %>
|
12
|
+
<th><%=col%></th>
|
13
|
+
<% end %>
|
14
|
+
</thead>
|
15
|
+
<tbody>
|
16
|
+
<% @cltn.each do |cltn| %>
|
17
|
+
<% id = cltn['_id'] %>
|
18
|
+
<tr id="<%=id%>" valign="top">
|
19
|
+
<td id="<%=id%>">
|
20
|
+
<img class="delete" id="<%=id%>" src="/images/delete.png" title="delete this record"/>
|
21
|
+
<img class="wait" id="wait_<%=id%>" src="/images/loading.gif"></img>
|
22
|
+
</td>
|
23
|
+
<% @selected_cols.each do |k| %>
|
24
|
+
<td><%= format_number(cltn[k]) %></td>
|
25
|
+
<% end %>
|
26
|
+
</tr>
|
27
|
+
<% end %>
|
28
|
+
</tbody>
|
29
|
+
</table>
|
30
|
+
</div>
|
27
31
|
|
28
32
|
<div id="links">
|
29
33
|
<%= will_paginate @cltn, :params => { :url => '/collections' } %>
|
@@ -1,18 +1,17 @@
|
|
1
1
|
<script src="/javascripts/jquery.example.js" type="text/javascript"></script>
|
2
2
|
|
3
|
-
<form id="search" onsubmit="search_submit();return false;" action="/collections/search/" method="post" style="text-align:center
|
3
|
+
<form id="search" onsubmit="search_submit();return false;" action="/collections/search/" method="post" style="text-align:center">
|
4
4
|
<fieldset>
|
5
5
|
<input id="search" type="text" name="search" class="search" value="<%=@query%>"/>
|
6
6
|
<button type="submit" id="submit_button" class="button search" style="display:none">search</button>
|
7
7
|
<img id="search_load" src="/images/loading.gif" style="width:25px;height:25px;vertical-align:sub;display:none"></img>
|
8
8
|
</fieldset>
|
9
|
-
<fieldset style="">
|
10
|
-
</fieldset>
|
11
9
|
</form>
|
12
10
|
|
13
11
|
<script>
|
14
12
|
$( function() {
|
15
13
|
$('input#search').example("{'name':'franky'} | [['count',-1]]", { className: 'no_input' } );
|
14
|
+
$('input#search').hover( function() { $(this).css( "border-color", "#92b948") }, function() { $(this).css( "border-color", "#434343") })
|
16
15
|
});
|
17
16
|
|
18
17
|
function search_submit()
|
@@ -1,18 +1,30 @@
|
|
1
|
+
<%=zone_locator%>
|
2
|
+
|
1
3
|
<div class="cltn">
|
2
|
-
<div class="title"><%=@title%></div>
|
3
4
|
<a class="back" href="<%=@back_url%>">« back</a>
|
4
5
|
|
6
|
+
<div class="title"><%=title_for( session[:path_names] )%></div>
|
7
|
+
|
5
8
|
<div id="mgmt_actions">
|
6
9
|
<img id="action_load" src="/images/loading.gif" style="width:25px;height:25px;vertical-align:sub;display:none"></img>
|
7
10
|
<button class="action clear" rel="#confirm_clear" title="Delete all records from collection">clear</button>
|
8
11
|
<button class="action drop" rel="#confirm_drop" title="Drop the entire collection">drop</button>
|
9
12
|
</div>
|
10
|
-
<
|
11
|
-
|
12
|
-
|
13
|
+
<fieldset class="sep">
|
14
|
+
<legend> indexes </legend>
|
15
|
+
<div id="indexes">
|
16
|
+
<%= partial :'collections/indexes' %>
|
17
|
+
</div>
|
18
|
+
</fieldset>
|
19
|
+
<fieldset class="sep">
|
20
|
+
<legend> records </legend>
|
21
|
+
<div id="results">
|
22
|
+
<%= partial :'collections/results' %>
|
23
|
+
</div>
|
24
|
+
</fieldset>
|
13
25
|
<div>
|
14
26
|
|
15
|
-
<div class="modal" id="confirm_clear">
|
27
|
+
<div class="modal" id="confirm_clear" style="font-size:1em">
|
16
28
|
<p>Clearing out the whole collection. Are you sure?</p>
|
17
29
|
<p style="margin:10px">
|
18
30
|
<button class="close yes" id="clear"> Yes </button>
|
@@ -20,7 +32,7 @@
|
|
20
32
|
</p>
|
21
33
|
</div>
|
22
34
|
|
23
|
-
<div class="modal" id="confirm_drop">
|
35
|
+
<div class="modal" id="confirm_drop" style="font-size:1em">
|
24
36
|
<p>Dropping the whole collection. Are you sure?</p>
|
25
37
|
<p style="margin:10px">
|
26
38
|
<button class="close yes" id="drop"> Yes </button>
|
@@ -2,33 +2,37 @@
|
|
2
2
|
<%= page_entries_info @cltns, :entry_name => 'item' %>
|
3
3
|
</div>
|
4
4
|
|
5
|
-
|
6
|
-
<
|
7
|
-
<
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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>
|
5
|
+
<% unless @cltns.empty? %>
|
6
|
+
<div class="borders" style="padding:10px">
|
7
|
+
<table id="cltn" class="cltn" border="0" cellpadding="10" cellspacing="20">
|
8
|
+
<thead>
|
9
|
+
<th width="2%"> </th>
|
10
|
+
<% cols = @cltns.first.keys %>
|
11
|
+
<% cols.each do |col| %>
|
12
|
+
<th align="<%=align_for( @cltns.first[col] )%>"><%=col%></th>
|
23
13
|
<% end %>
|
24
|
-
</
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
<
|
30
|
-
|
31
|
-
|
14
|
+
</thead>
|
15
|
+
<tbody>
|
16
|
+
<% count = 0; @cltns.each do |cltn| %>
|
17
|
+
<% path = "#{session[:path_names]}|#{cltn[:name]}"%>
|
18
|
+
<tr id="<%=count%>" valign="top">
|
19
|
+
<td id="<%=count%>">
|
20
|
+
<img class="delete" id="<%=path%>" rel="<%=count%>" src="/images/delete.png" title="drop this collection"/>
|
21
|
+
<img class="wait" id="wait_<%=count%>" src="/images/loading.gif"></img>
|
22
|
+
</td>
|
23
|
+
<td><a href="/databases/collection/<%=cltn[:name]%>/"><%= cltn[:name] %></a></td>
|
24
|
+
<td align="<%=align_for( cltn[:count] )%>"><%= format_number(cltn[:count]) %></td>
|
25
|
+
</tr>
|
26
|
+
<% count+=1;end %>
|
27
|
+
</tbody>
|
28
|
+
</table>
|
29
|
+
</div>
|
30
|
+
<div id="links">
|
31
|
+
<%= will_paginate @cltns, :params => { :url => "/databases" } %>
|
32
|
+
</div>
|
33
|
+
<% else %>
|
34
|
+
<div class="no_items">Oh snap! No collections found...</span>
|
35
|
+
<% end %>
|
32
36
|
|
33
37
|
<script>
|
34
38
|
$( function() {
|
@@ -1,8 +1,12 @@
|
|
1
|
+
<%= zone_locator %>
|
2
|
+
|
1
3
|
<div class="cltn">
|
2
|
-
<
|
3
|
-
<
|
4
|
+
<a class="back" href="<%=@back_url%>">« back</a>
|
5
|
+
<div class="title"><%=title_for( session[:path_names] )%></div>
|
6
|
+
</div>
|
4
7
|
|
8
|
+
<div class="cltn" style="padding:10px;">
|
5
9
|
<div id="results">
|
6
10
|
<%= partial :'databases/results'%>
|
7
11
|
</div>
|
8
|
-
|
12
|
+
</div>
|
@@ -0,0 +1,131 @@
|
|
1
|
+
<style>
|
2
|
+
div.item img {
|
3
|
+
z-index:100;
|
4
|
+
display:none;
|
5
|
+
float:left;
|
6
|
+
margin-right:10px;
|
7
|
+
}
|
8
|
+
|
9
|
+
div#legend {
|
10
|
+
border-bottom: 1px #434343 solid;
|
11
|
+
font-size: 0.5em;
|
12
|
+
color: #92b948;
|
13
|
+
overflow: hidden;
|
14
|
+
}
|
15
|
+
div#legend_link {
|
16
|
+
text-align: right;
|
17
|
+
width: 30%;
|
18
|
+
float: right;
|
19
|
+
font-size: .7em;
|
20
|
+
padding-top: 7px;
|
21
|
+
}
|
22
|
+
|
23
|
+
div.items {
|
24
|
+
margin-top:10px;
|
25
|
+
}
|
26
|
+
|
27
|
+
div.item {
|
28
|
+
border-top: 1px #bcffca solid;
|
29
|
+
height: 30px;
|
30
|
+
width: 100%;
|
31
|
+
font-size: .4em;
|
32
|
+
cursor: pointer;
|
33
|
+
z-index: 1;
|
34
|
+
}
|
35
|
+
div.selected {
|
36
|
+
background-image: url(/images/selected_bg.png);
|
37
|
+
color: #92b948;
|
38
|
+
}
|
39
|
+
</style>
|
40
|
+
|
41
|
+
<% legend = path_type( session[:path_names] ) %>
|
42
|
+
<div id="legend">
|
43
|
+
<div style="width:60%;float:left">
|
44
|
+
@ <%= truncate( legend_title( session[:path_names] ), 30 ) %>
|
45
|
+
</div>
|
46
|
+
<% unless zone_path?( session[:path_names] ) %>
|
47
|
+
<div id="legend_link">
|
48
|
+
<a href="#" onclick="$('img.drop').animate({width:'toggle'});return false;">edit</a>
|
49
|
+
</div>
|
50
|
+
<% end %>
|
51
|
+
</div>
|
52
|
+
|
53
|
+
<p style="font-size:0.6em;color:#fff"><%=legend_for( session[:path_names], @nodes.size )%></p>
|
54
|
+
|
55
|
+
<div id="actions">
|
56
|
+
<a class="prevPage">« back</a>
|
57
|
+
<a class="nextPage">more »</a>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<div class="scrollable vertical">
|
61
|
+
<div class="items">
|
62
|
+
<% count=0;@nodes.sort{|a,b| a.name <=> b.name}.each do |node| %>
|
63
|
+
<div id="<%=count%>" class="item">
|
64
|
+
<% unless zone_path?( session[:path_names] ) %>
|
65
|
+
<img id="<%=count%>" rel="div#confirm_drop" class="drop" href="/explore/database/<%=node.oid%>/<%=node.name%>/drop" title="drop <%=legend%>..." src="/images/delete.png"/>
|
66
|
+
<% end %>
|
67
|
+
<p rel="div#details" href="/explore/show/<%=node.data[:path_ids]%>/<%=node.data[:path_names]%>" class="info">
|
68
|
+
<%=truncate(node.name, 30)%>
|
69
|
+
</p>
|
70
|
+
</div>
|
71
|
+
<% count+=1; end %>
|
72
|
+
</div>
|
73
|
+
</div>
|
74
|
+
|
75
|
+
<div class="modal" id="confirm_drop">
|
76
|
+
<p>Dropping <%=legend%>. Are you sure?</p>
|
77
|
+
<p style="margin:10px">
|
78
|
+
<button class="close yes">Yes</button>
|
79
|
+
<button class="close">No</button>
|
80
|
+
</p>
|
81
|
+
</div>
|
82
|
+
|
83
|
+
<script>
|
84
|
+
$( function() {
|
85
|
+
$("div.scrollable").scrollable({
|
86
|
+
vertical:true,
|
87
|
+
size: 14,
|
88
|
+
}).mousewheel();
|
89
|
+
|
90
|
+
$("div.item").hover(
|
91
|
+
function() { $(this).addClass( "selected" ) },
|
92
|
+
function() { $(this).removeClass( "selected" ) }
|
93
|
+
);
|
94
|
+
|
95
|
+
$('img.drop' ).overlay( {
|
96
|
+
expose: {
|
97
|
+
color: '#212021',
|
98
|
+
loadSpeed: 200,
|
99
|
+
opacity: 0.9
|
100
|
+
},
|
101
|
+
onBeforeLoad: function() {
|
102
|
+
$("button.yes").attr( 'href', this.getTrigger().attr('href') );
|
103
|
+
$("button.yes").attr( 'id', this.getTrigger().attr('id') );
|
104
|
+
},
|
105
|
+
closeOnClick: false
|
106
|
+
});
|
107
|
+
|
108
|
+
$( 'button.yes' ).click( function() {
|
109
|
+
var self = $(this);
|
110
|
+
$.ajax( {
|
111
|
+
dataType: 'script',
|
112
|
+
type: 'get',
|
113
|
+
url: self.attr('href'),
|
114
|
+
complete: function() {
|
115
|
+
$( 'div#' + self.attr('id') ).fadeOut( 'slow', function() {
|
116
|
+
$( 'span#count').html( $('div.items div.item:visible').length );
|
117
|
+
});
|
118
|
+
}
|
119
|
+
});
|
120
|
+
});
|
121
|
+
|
122
|
+
$('div.item p[rel]').overlay( {
|
123
|
+
top: '15%',
|
124
|
+
expose: '#1c1c1c',
|
125
|
+
onBeforeLoad: function() {
|
126
|
+
var wrap = this.getContent().find( 'div#wrap' );
|
127
|
+
wrap.load( this.getTrigger().attr( 'href' ) );
|
128
|
+
}
|
129
|
+
});
|
130
|
+
});
|
131
|
+
</script>
|