mongobile 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/mongobile/app.rb +18 -12
- data/lib/mongobile/mongo_helper.rb +4 -0
- data/lib/mongobile/views/database/collection.haml +12 -6
- data/lib/mongobile/views/database/show.haml +10 -4
- data/lib/mongobile/views/index.haml +4 -2
- data/mongobile.gemspec +2 -1
- data/public/javascripts/application.js +2 -0
- metadata +4 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/lib/mongobile/app.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
module Mongobile
|
2
2
|
class App < Sinatra::Base
|
3
3
|
include Mongobile::MongoHelper
|
4
|
+
|
5
|
+
helpers do
|
6
|
+
include Rack::Utils
|
7
|
+
alias_method :h, :escape_html
|
8
|
+
end
|
9
|
+
|
4
10
|
set :public, File.expand_path("../../../public", __FILE__)
|
5
11
|
set :views, File.expand_path("../../../lib/mongobile/views", __FILE__)
|
6
12
|
|
@@ -29,24 +35,24 @@ module Mongobile
|
|
29
35
|
status 201
|
30
36
|
end
|
31
37
|
|
32
|
-
|
33
|
-
db
|
34
|
-
|
38
|
+
post "/database/:id/:collection/delete" do
|
39
|
+
@database = db(params[:id])
|
40
|
+
@database.drop_collection(params[:collection])
|
41
|
+
|
42
|
+
redirect "/database/#{params[:id]}"
|
35
43
|
end
|
36
44
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
"doc_count" => col.count,
|
41
|
-
"disk_size" => 123
|
42
|
-
}.to_json
|
45
|
+
post "/database/:id/delete" do
|
46
|
+
connection.drop_database(params[:id])
|
47
|
+
redirect "/"
|
43
48
|
end
|
44
49
|
|
45
|
-
post "/database/:id
|
50
|
+
post "/database/:id/repair" do
|
51
|
+
@database = db(params[:id])
|
46
52
|
Thread.start do
|
47
|
-
|
53
|
+
@database.command({:repairDatabase => 1})
|
48
54
|
end
|
49
|
-
|
55
|
+
redirect "/database/#{params[:id]}"
|
50
56
|
end
|
51
57
|
|
52
58
|
private
|
@@ -4,15 +4,21 @@
|
|
4
4
|
%div(data-role="header")
|
5
5
|
%h1
|
6
6
|
Collection:
|
7
|
-
|
7
|
+
&=@database.name+" / #{@collection.name}"
|
8
|
+
%div{:"data-role" => "navbar"}
|
9
|
+
%div{:"data-role" => "controlgroup", :"data-type" => "horizontal"}
|
10
|
+
%form(action="/database/#{@database.name}/#{@collection.name}/delete" method="post" style="display: inline")
|
11
|
+
%input(type="submit" data-role="button" value="Drop Collection" data-theme="a")
|
12
|
+
|
13
|
+
|
8
14
|
%div(data-role="content")
|
9
15
|
-if skip == 0
|
10
16
|
%h1
|
11
17
|
Info
|
12
18
|
-normalize_stats(@collection.stats).each do |k,v|
|
13
19
|
%b
|
14
|
-
|
15
|
-
|
20
|
+
&="#{k}="
|
21
|
+
&=v
|
16
22
|
%br
|
17
23
|
%h1
|
18
24
|
Documents
|
@@ -20,11 +26,11 @@
|
|
20
26
|
-count+=1
|
21
27
|
%div(data-role="collapsible" data-collapsed=true)
|
22
28
|
%h1
|
23
|
-
|
29
|
+
&= document["_id"] +" "+ (document["name"] || document["title"] || document["description"] || document["message"] || "")
|
24
30
|
-document.each do |k,v|
|
25
31
|
%b
|
26
|
-
|
27
|
-
|
32
|
+
&="#{k}="
|
33
|
+
&= v
|
28
34
|
%br
|
29
35
|
|
30
36
|
%div(data-role="footer")
|
@@ -2,14 +2,20 @@
|
|
2
2
|
%div(data-role="header")
|
3
3
|
%h1
|
4
4
|
Database:
|
5
|
-
|
5
|
+
&=@database.name
|
6
|
+
%div{:"data-role" => "navbar"}
|
7
|
+
%div{:"data-role" => "controlgroup", :"data-type" => "horizontal"}
|
8
|
+
%form(action="/database/#{@database.name}/delete" method="post" style="display: inline")
|
9
|
+
%input(type="submit" data-role="button" value="Drop Database" data-theme="a")
|
10
|
+
%form(action="/database/#{@database.name}/repair" method="post" style="display: inline")
|
11
|
+
%input(type="submit" data-role="button" value="Repair Database" data-theme="a")
|
6
12
|
%div(data-role="content")
|
7
13
|
%h1
|
8
14
|
Info
|
9
15
|
-normalize_stats(@database.stats).each do |k,v|
|
10
16
|
%b
|
11
|
-
|
12
|
-
|
17
|
+
&="#{k}="
|
18
|
+
&=v
|
13
19
|
%br
|
14
20
|
|
15
21
|
%h1
|
@@ -18,6 +24,6 @@
|
|
18
24
|
-@collections.each do |collection|
|
19
25
|
%li
|
20
26
|
%a(href="/database/#{@database.name}/#{collection.name}")
|
21
|
-
|
27
|
+
&=collection.name
|
22
28
|
|
23
29
|
%div(data-role="footer")
|
@@ -4,9 +4,11 @@
|
|
4
4
|
Databases
|
5
5
|
%div(data-role="content")
|
6
6
|
%ul(data-role="listview" data-filter="true")
|
7
|
-
-@databases.each do |database
|
7
|
+
-@databases.each do |database|
|
8
8
|
%li
|
9
9
|
%a(href="/database/#{database}")
|
10
|
-
|
10
|
+
&=database
|
11
|
+
%span{:class=>"ui-li-count"}
|
12
|
+
=file_size(db(database))
|
11
13
|
|
12
14
|
%div(data-role="footer")
|
data/mongobile.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{mongobile}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["David A. Cuadrado"]
|
@@ -37,6 +37,7 @@ Gem::Specification.new do |s|
|
|
37
37
|
"lib/mongobile/views/index.haml",
|
38
38
|
"lib/mongobile/views/layout.haml",
|
39
39
|
"mongobile.gemspec",
|
40
|
+
"public/javascripts/application.js",
|
40
41
|
"public/javascripts/jquery.mobile-1.0a3pre.min.js",
|
41
42
|
"public/stylesheets/images/ajax-loader.png",
|
42
43
|
"public/stylesheets/images/form-check-off.png",
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 4
|
9
|
+
version: 0.0.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- David A. Cuadrado
|
@@ -176,6 +176,7 @@ files:
|
|
176
176
|
- lib/mongobile/views/index.haml
|
177
177
|
- lib/mongobile/views/layout.haml
|
178
178
|
- mongobile.gemspec
|
179
|
+
- public/javascripts/application.js
|
179
180
|
- public/javascripts/jquery.mobile-1.0a3pre.min.js
|
180
181
|
- public/stylesheets/images/ajax-loader.png
|
181
182
|
- public/stylesheets/images/form-check-off.png
|
@@ -204,7 +205,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
204
205
|
requirements:
|
205
206
|
- - ">="
|
206
207
|
- !ruby/object:Gem::Version
|
207
|
-
hash:
|
208
|
+
hash: 3620814989688952816
|
208
209
|
segments:
|
209
210
|
- 0
|
210
211
|
version: "0"
|