nofxx-god_web 0.2.3 → 0.2.5
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/VERSION +1 -1
- data/god_web.gemspec +8 -2
- data/lib/app.rb +11 -3
- data/lib/god_web.rb +20 -7
- data/public/app.css +67 -15
- data/public/app.js +28 -0
- data/public/icons/cpus.png +0 -0
- data/public/icons/mem.png +0 -0
- data/public/iui/greenButton.png +0 -0
- data/public/iui/yellowButton.png +0 -0
- data/spec/god_web_spec.rb +14 -2
- data/views/status.erb +18 -15
- data/views/top.erb +8 -0
- data/views/watch.erb +40 -10
- metadata +8 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.5
|
data/god_web.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{god_web}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jesse Newland", "Marcos Piccinini"]
|
12
|
-
s.date = %q{2009-09-
|
12
|
+
s.date = %q{2009-09-11}
|
13
13
|
s.default_executable = %q{god_web}
|
14
14
|
s.description = %q{iPhone friendly sinatra web UI for God}
|
15
15
|
s.email = %q{see@github.com}
|
@@ -32,13 +32,16 @@ Gem::Specification.new do |s|
|
|
32
32
|
"lib/god_web.rb",
|
33
33
|
"public/.DS_Store",
|
34
34
|
"public/app.css",
|
35
|
+
"public/app.js",
|
35
36
|
"public/icons/big_icon.png",
|
36
37
|
"public/icons/bookmark.png",
|
38
|
+
"public/icons/cpus.png",
|
37
39
|
"public/icons/databases.png",
|
38
40
|
"public/icons/gear.png",
|
39
41
|
"public/icons/groups.png",
|
40
42
|
"public/icons/info.png",
|
41
43
|
"public/icons/key.png",
|
44
|
+
"public/icons/mem.png",
|
42
45
|
"public/icons/monitor.png",
|
43
46
|
"public/icons/restart.png",
|
44
47
|
"public/icons/ruby.png",
|
@@ -56,6 +59,7 @@ Gem::Specification.new do |s|
|
|
56
59
|
"public/iui/blueButton.png",
|
57
60
|
"public/iui/cancel.png",
|
58
61
|
"public/iui/grayButton.png",
|
62
|
+
"public/iui/greenButton.png",
|
59
63
|
"public/iui/iui-logo-touch-icon.png",
|
60
64
|
"public/iui/iui.css",
|
61
65
|
"public/iui/iui.js",
|
@@ -74,11 +78,13 @@ Gem::Specification.new do |s|
|
|
74
78
|
"public/iui/toolButton.png",
|
75
79
|
"public/iui/toolbar.png",
|
76
80
|
"public/iui/whiteButton.png",
|
81
|
+
"public/iui/yellowButton.png",
|
77
82
|
"spec/god_web_spec.rb",
|
78
83
|
"spec/spec_helper.rb",
|
79
84
|
"views/command.erb",
|
80
85
|
"views/icon.erb",
|
81
86
|
"views/status.erb",
|
87
|
+
"views/top.erb",
|
82
88
|
"views/watch.erb"
|
83
89
|
]
|
84
90
|
s.homepage = %q{http://github.com/nofxx/god_web}
|
data/lib/app.rb
CHANGED
@@ -13,10 +13,11 @@ get '/' do
|
|
13
13
|
@statuses.each do |watch, status|
|
14
14
|
@watches << watch.to_s
|
15
15
|
end
|
16
|
-
@watches.
|
16
|
+
@watches = @watches.group_by { |w| @statuses[w][:state].to_s }
|
17
17
|
@groups = GODWEB.groups
|
18
18
|
@host = `hostname`
|
19
|
-
@
|
19
|
+
@stats = GodWeb.cpu_status
|
20
|
+
@footer = "GodWeb v0.2.5 - #{@host}"
|
20
21
|
show(:status, @host)
|
21
22
|
end
|
22
23
|
|
@@ -30,6 +31,8 @@ end
|
|
30
31
|
|
31
32
|
get '/g/:group' do
|
32
33
|
@watch = @group = params["group"]
|
34
|
+
@child = GODWEB.status.keys.each.select { |k| GODWEB.status[k][:group] == @group } #.select { |w| w["group"] = @group }
|
35
|
+
@child.map!{ |c| [c, GODWEB.status[c][:state]]}
|
33
36
|
@status = nil
|
34
37
|
@commands = GodWeb.possible_statuses(@status)
|
35
38
|
show(:watch, "#{@group} [group]")
|
@@ -45,7 +48,7 @@ get '/w/:watch/:command' do
|
|
45
48
|
end
|
46
49
|
|
47
50
|
get '/o' do
|
48
|
-
@commands = %w{
|
51
|
+
@commands = %w{ true }
|
49
52
|
show(:watch, "god itself")
|
50
53
|
end
|
51
54
|
|
@@ -54,6 +57,11 @@ get '/i' do
|
|
54
57
|
show(:icon)
|
55
58
|
end
|
56
59
|
|
60
|
+
get '/t' do
|
61
|
+
@text = `top -Hibn 1`.gsub("top - ", "")
|
62
|
+
show(:top)
|
63
|
+
end
|
64
|
+
|
57
65
|
get '/heartbeat' do
|
58
66
|
@statuses = GODWEB.status
|
59
67
|
'OK'
|
data/lib/god_web.rb
CHANGED
@@ -69,16 +69,28 @@ class GodWeb
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def self.possible_statuses(status)
|
72
|
+
# need to check, but god doesn't have a monitored and offline state...
|
72
73
|
case status
|
73
|
-
when :up
|
74
|
-
|
75
|
-
|
76
|
-
return %w{start monitor}
|
77
|
-
else
|
78
|
-
return %w{start stop restart}
|
74
|
+
when :up then [true, true] #%w{start monitor}
|
75
|
+
when :unmonitored then [false, false] #%w{start monitor}
|
76
|
+
else [] # nil #[false, false] #%w{start stop restart}
|
79
77
|
end
|
80
78
|
end
|
81
79
|
|
80
|
+
def self.ram_status
|
81
|
+
mem = `free -mo`.split(" ")
|
82
|
+
used, free, cached, swap = mem[8], mem[9], mem[12], mem[15]
|
83
|
+
end
|
84
|
+
|
85
|
+
def self.cpu_status
|
86
|
+
#stat = `cat /proc/stat`.split(" ")
|
87
|
+
top = `top -bn 1`
|
88
|
+
info, tasks, cpus, mem, swap, *rest = *top
|
89
|
+
# Use array to keep order (ruby < 1.9)
|
90
|
+
[[:info, info.gsub(/top - |\d{2}:\d{2}(:\d{2})?(\s|,)|\saverage/, "")],
|
91
|
+
[:cpus, cpus.gsub("Cpu\(s\): ", "").split(", ")[0..4].join(", ")],
|
92
|
+
[:mem, mem.gsub("Mem: ", "").gsub(/(\d*k)/) { ($1.to_i / 1000).to_s }]]
|
93
|
+
end
|
82
94
|
|
83
95
|
private
|
84
96
|
|
@@ -110,6 +122,7 @@ private
|
|
110
122
|
# To make it look good (no horiz scrollbars) in the iphone
|
111
123
|
#
|
112
124
|
def format_log(raw)
|
125
|
+
return "..." unless raw
|
113
126
|
raw.split("\n").map do |l|
|
114
127
|
# clean stuff we don't need
|
115
128
|
l.gsub!(/I\s+|\(\w*\)|within bounds/, "") # gsub(/\(\w*\)/, """)
|
@@ -121,7 +134,7 @@ private
|
|
121
134
|
# take only the integer from cpu
|
122
135
|
gsub(/cpu/, "cpu %").gsub(/(\d{1,3})\.\d*%/, "\\1").
|
123
136
|
# show mem usage in mb
|
124
|
-
gsub(/memory/, "
|
137
|
+
gsub(/memory/, "mem mb").gsub(/(\d*kb)/) { ($1.to_i / 1000).to_s }
|
125
138
|
else
|
126
139
|
l.gsub(/\[\S*\s(\S*)\]\W+INFO: \w*\s(\w*)/, "<span class='gray'>\\1</span> | <span class='act'>act</span> | \\2")
|
127
140
|
end
|
data/public/app.css
CHANGED
@@ -1,17 +1,3 @@
|
|
1
|
-
body > ul > li { padding-left: 30px; }
|
2
|
-
li.unmonitored { background: transparent url(../icons/unmonitored.png) no-repeat scroll 8px 12px;}
|
3
|
-
li.unmonitor { background: transparent url(../icons/unmonitor.png) no-repeat scroll 8px 12px;}
|
4
|
-
li.monitor { background: transparent url(../icons/monitor.png) no-repeat scroll 8px 12px;}
|
5
|
-
li.start { background: transparent url(../icons/start.png) no-repeat scroll 8px 12px;}
|
6
|
-
li.stop { background: transparent url(../icons/stop.png) no-repeat scroll 8px 12px; }
|
7
|
-
li.quit { background: transparent url(../icons/stop.png) no-repeat scroll 8px 12px; }
|
8
|
-
li.restart { background: transparent url(../icons/restart.png) no-repeat scroll 8px 12px;}
|
9
|
-
li.groups { background: transparent url(../icons/groups.png) no-repeat scroll 8px 12px;}
|
10
|
-
li.god { background: transparent url(../icons/terminal.png) no-repeat scroll 8px 12px;}
|
11
|
-
li.hicon { background: transparent url(../icons/bookmark.png) no-repeat scroll 8px 12px;}
|
12
|
-
li.info { background: transparent url(../icons/info.png) no-repeat scroll 7px 7px;}
|
13
|
-
li.up { background: transparent url(../icons/up.png) no-repeat scroll 8px 12px;}
|
14
|
-
|
15
1
|
.home_icon_div {
|
16
2
|
padding-top: 80px;
|
17
3
|
background: transparent url(../icons/big_icon.png) no-repeat scroll center center;
|
@@ -23,7 +9,38 @@ li.up { background: transparent url(../icons/up.png) no-repeat scroll 8px 1
|
|
23
9
|
text-shadow: rgba(255, 255, 255, 0.75) 2px 2px 0;
|
24
10
|
}
|
25
11
|
|
26
|
-
|
12
|
+
fieldset > ul {
|
13
|
+
padding: 0px 10px;
|
14
|
+
}
|
15
|
+
|
16
|
+
fieldset > ul > li {
|
17
|
+
text-align: left;
|
18
|
+
background:#FFFFFF none repeat scroll 0 0;
|
19
|
+
position: relative;
|
20
|
+
margin: 0;
|
21
|
+
border-bottom: 1px solid #E0E0E0;
|
22
|
+
padding: 8px 0 8px 0px;
|
23
|
+
font-size: 20px;
|
24
|
+
font-weight: bold;
|
25
|
+
list-style: none;
|
26
|
+
}
|
27
|
+
|
28
|
+
fieldset > ul > li > a {
|
29
|
+
display: block;
|
30
|
+
margin: -8px 0 -8px -10px;
|
31
|
+
padding: 8px 32px 8px 10px;
|
32
|
+
text-decoration: none;
|
33
|
+
color: inherit;
|
34
|
+
background: url(iui/listArrow.png) no-repeat right center;
|
35
|
+
}
|
36
|
+
|
37
|
+
li img {
|
38
|
+
border:medium none;
|
39
|
+
float:left;
|
40
|
+
margin:4px 8px 0px 0px;
|
41
|
+
}
|
42
|
+
|
43
|
+
.tiny {
|
27
44
|
font-size: 0.8em;
|
28
45
|
}
|
29
46
|
|
@@ -40,4 +57,39 @@ li.up { background: transparent url(../icons/up.png) no-repeat scroll 8px 1
|
|
40
57
|
.act {
|
41
58
|
color: #999900;
|
42
59
|
font-weight: bold;
|
60
|
+
}
|
61
|
+
|
62
|
+
.yellowButton,
|
63
|
+
.greenButton {
|
64
|
+
display: block;
|
65
|
+
border-width: 0 12px;
|
66
|
+
padding: 10px;
|
67
|
+
text-align: center;
|
68
|
+
font-size: 20px;
|
69
|
+
font-weight: bold;
|
70
|
+
text-decoration: inherit;
|
71
|
+
color: inherit;
|
72
|
+
}
|
73
|
+
|
74
|
+
.greenButton {
|
75
|
+
-webkit-border-image: url(../iui/greenButton.png) 0 12 0 12;
|
76
|
+
color:#fff;
|
77
|
+
text-shadow: #007a00 0 -1px 0;
|
78
|
+
}
|
79
|
+
|
80
|
+
.yellowButton {
|
81
|
+
-webkit-border-image: url(../iui/yellowButton.png) 0 12 0 12;
|
82
|
+
color:#fff;
|
83
|
+
text-shadow: #007a7a 0 -1px 0;
|
84
|
+
}
|
85
|
+
|
86
|
+
.code {
|
87
|
+
font-size: 14px;
|
88
|
+
font-family: Courier;
|
89
|
+
color: #33EE33;
|
90
|
+
background-color: #222;
|
91
|
+
padding-left: 15px;
|
92
|
+
white-space: nowrap;
|
93
|
+
overflow: auto;
|
94
|
+
padding-top: 8px;
|
43
95
|
}
|
data/public/app.js
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
//FIXME: grr... bug if you run once, cancel, and try to run on another watch (hate js..)
|
2
|
+
function submitCommand(action, watch) {
|
3
|
+
var comm;
|
4
|
+
var act;
|
5
|
+
var s;
|
6
|
+
|
7
|
+
if (document.getElementById("toggle_" + action)) {
|
8
|
+
act = document.getElementById("toggle_" + action);
|
9
|
+
s = act.getAttribute("toggled");
|
10
|
+
|
11
|
+
if(action == "power") {
|
12
|
+
comm = (s == "true") ? "start" : "stop";
|
13
|
+
} else {
|
14
|
+
comm = (s == "true") ? "monitor" : "unmonitor";
|
15
|
+
}
|
16
|
+
} else {
|
17
|
+
comm = action;
|
18
|
+
}
|
19
|
+
|
20
|
+
if (confirm("God will " + comm + " " + watch + "..")) {
|
21
|
+
var res = document.getElementById("command_result");
|
22
|
+
iui.showPageByHref("/w/" + watch + "/" + comm, null, null, res, null);
|
23
|
+
} else {
|
24
|
+
act.setAttribute("toggled", (s == "true") ? "false" : "true");
|
25
|
+
}
|
26
|
+
return false;
|
27
|
+
}
|
28
|
+
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/spec/god_web_spec.rb
CHANGED
@@ -8,9 +8,10 @@ GOD_ACT = "I [2009-09-08 05:06:19] INFO: nginx restart: /etc/rc.d/nginx restart
|
|
8
8
|
describe "GodWeb" do
|
9
9
|
|
10
10
|
it "should find possible statuses" do
|
11
|
-
GodWeb.possible_statuses(:up).should eql(["stop", "restart", "unmonitor"])
|
11
|
+
GodWeb.possible_statuses(:up).should eql([true, true]) #["stop", "restart", "unmonitor"])
|
12
12
|
end
|
13
13
|
|
14
|
+
|
14
15
|
describe "Log formatter" do
|
15
16
|
before do
|
16
17
|
DRb.stub!(:start_service)
|
@@ -27,7 +28,7 @@ describe "GodWeb" do
|
|
27
28
|
|
28
29
|
it "should format log mem" do
|
29
30
|
@g.send(:format_log, GOD_MEM).should eql(
|
30
|
-
"<span class='gray'>02:50:42</span> | <span class='green'>ok</span> |
|
31
|
+
"<span class='gray'>02:50:42</span> | <span class='green'>ok</span> | mem mb [23, 23, 23, 23, 23] " )
|
31
32
|
end
|
32
33
|
|
33
34
|
it "should format log move" do
|
@@ -42,5 +43,16 @@ describe "GodWeb" do
|
|
42
43
|
|
43
44
|
end
|
44
45
|
|
46
|
+
# bad emacs ruby highlight.. =/
|
47
|
+
it "should find out used/free cpu" do
|
48
|
+
# GodWeb.stub(:`).and_return("cpu 6528133 751 1130715 31204523 214784 3694 21914 0 0\ncpu0 3230410 558 557722 15169049 107745 1743 9792 0 0\ncpu1 3297722 193 572992 16035473 107039 1950 12122 0 0\nintr 655758766 681 2 0 0 0 0 3 0 1368 0 0 0 0 0 0 0 0 0 0 0 0 0 4141444 0 0 0 0 4137248 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\nctxt 1580587936\nbtime 1252305746\nprocesses 438409\nprocs_running 6\nprocs_blocked 0\n")
|
49
|
+
GodWeb.cpu_status.should eql(["6499", "1485", "20"])
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should find out used/free ram" do
|
53
|
+
GodWeb.stub(:`).and_return(" total used free shared buffers cached\nMem: 7984 6499 1485 0 265 3480\nSwap: 7632 20 7611\n")
|
54
|
+
GodWeb.ram_status.should eql(["6499", "1485", "3480", "20"])
|
55
|
+
end
|
56
|
+
|
45
57
|
end
|
46
58
|
|
data/views/status.erb
CHANGED
@@ -2,14 +2,15 @@
|
|
2
2
|
<head>
|
3
3
|
<title><%= @title %></title>
|
4
4
|
<meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
|
5
|
-
<style type="text/css" media="screen">@import "/iui/
|
5
|
+
<style type="text/css" media="screen">@import "/iui/iuix.css";</style>
|
6
6
|
<style type="text/css" media="screen">@import "/app.css";</style>
|
7
|
-
<script type="application/x-javascript" src="/
|
7
|
+
<script type="application/x-javascript" src="/app.js"></script>
|
8
|
+
<script type="application/x-javascript" src="/iui/iuix.js"></script>
|
8
9
|
<script type="text/javascript"> iui.animOn = true;</script>
|
9
10
|
</head>
|
10
11
|
<body>
|
11
12
|
<div class="toolbar">
|
12
|
-
<h1 id="pageTitle"><%= @title
|
13
|
+
<h1 id="pageTitle"><%= @title %></h1>
|
13
14
|
<a id="backButton" class="button" href="#"></a>
|
14
15
|
<a class="button" href="/" target="_self">Refresh</a>
|
15
16
|
</div>
|
@@ -17,23 +18,25 @@
|
|
17
18
|
<% unless @groups.empty? %>
|
18
19
|
<li class="group">Groups</li>
|
19
20
|
<% @groups.each do |watch| %>
|
20
|
-
<li id="<%= watch %>"
|
21
|
+
<li id="<%= watch %>"><a href="/g/<%= watch %>"><img src="icons/groups.png"><%= watch %></a></li>
|
21
22
|
<% end %>
|
22
23
|
<% end %>
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
<% @watches.each do |state, watches| %>
|
25
|
+
<li class="group"><%= state.capitalize %></li>
|
26
|
+
<% for watch in watches.sort %>
|
27
|
+
<li id="<%= watch %>">
|
28
|
+
<a href="/w/<%= watch %>"><img src="icons/<%= @statuses[watch][:state] %>.png"></img><%= watch %></a></li>
|
29
|
+
<% end %>
|
27
30
|
<% end %>
|
28
31
|
<li class="group">Extras</li>
|
29
|
-
<li id="
|
30
|
-
|
31
|
-
</li>
|
32
|
-
<li id="god_opts" class="god">
|
33
|
-
<a href="/o">God</a>
|
34
|
-
</li>
|
32
|
+
<li id="god_opts"><a href="/o"><img src="icons/monitor.png"></img>God</a></li>
|
33
|
+
<li id="top_show"><a href="/t"><img src="icons/terminal.png"></img>Top</a></li>
|
34
|
+
<li id="home_icon"><a href="/i"><img src="icons/bookmark.png"></img>Icon</a></li>
|
35
35
|
<li class="group">About</li>
|
36
|
-
|
36
|
+
<% for stat in @stats %>
|
37
|
+
<li class="tiny"><img src="icons/<%= stat[0] %>.png"><%= stat[1] %></li>
|
38
|
+
<% end %>
|
39
|
+
<li class="tiny"><img src="icons/ruby.png"></img><%= @footer %> [ok]</li>
|
37
40
|
</ul>
|
38
41
|
</body>
|
39
42
|
</html>
|
data/views/top.erb
ADDED
data/views/watch.erb
CHANGED
@@ -1,14 +1,44 @@
|
|
1
|
-
<
|
1
|
+
<div id="<%= @watch %>_commands" title="<%= @title %>" class="panel">
|
2
2
|
<% if @status %>
|
3
|
-
<
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
<a href="/w/<%= @watch %>/<%= command %>"><%= command %></a></li>
|
3
|
+
<h2> Status </h2>
|
4
|
+
<fieldset>
|
5
|
+
<div align="center"><p>
|
6
|
+
<b><%= @status.to_s.capitalize %></b> [<%= Time.now.strftime("%H:%m %m/%d") %>]</p></div>
|
7
|
+
</fieldset>
|
9
8
|
<% end %>
|
10
9
|
<% if @log %>
|
11
|
-
<
|
12
|
-
<
|
10
|
+
<h2> Log </h2>
|
11
|
+
<fieldset>
|
12
|
+
<div align='left'><%= @log %></div>
|
13
|
+
</fieldset>
|
14
|
+
<% end %>
|
15
|
+
<% if @child %>
|
16
|
+
<h2> Watches </h2>
|
17
|
+
<fieldset><ul>
|
18
|
+
<% for child in @child %>
|
19
|
+
<li id="<%= child[0] %>">
|
20
|
+
<a href="/w/<%= child[0] %>"><img src="icons/<%= child[1] %>.png"></img><%= child[0] %></a></li>
|
21
|
+
<% end %>
|
22
|
+
</ul></fieldset>
|
23
|
+
<% end %>
|
24
|
+
<h2> Commands </h2>
|
25
|
+
<% unless @commands.empty? %>
|
26
|
+
<fieldset>
|
27
|
+
<% ["power", "monitor"].each_with_index do |comm, i| %>
|
28
|
+
<div class="row">
|
29
|
+
<label><%= comm.capitalize %></label>
|
30
|
+
<div id="toggle_<%= comm %>" class="toggle" toggled="<%= @commands[i] %>" onclick="submitCommand('<%= comm %>', '<%= @watch %>')">
|
31
|
+
<span class="thumb"></span><span class="toggleOn">ON</span>
|
32
|
+
<span class="toggleOff">OFF</span>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
<% end %>
|
36
|
+
</fieldset>
|
37
|
+
<% else %>
|
38
|
+
<a class="greenButton" onclick="submitCommand('start', '<%= @watch %>')">Start <%= " All" if @child %></a>
|
39
|
+
<a class="yellowButton" onclick="submitCommand('stop', '<%= @watch %>')">Stop <%= " All" if @child %></a>
|
13
40
|
<% end %>
|
14
|
-
|
41
|
+
<a class="redButton" onclick="submitCommand('restart', '<%= @watch %>')">Restart <%= " All" if @child %></a>
|
42
|
+
<div id="command_result"></div>
|
43
|
+
</div>
|
44
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nofxx-god_web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesse Newland
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-09-
|
13
|
+
date: 2009-09-11 00:00:00 -07:00
|
14
14
|
default_executable: god_web
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -69,13 +69,16 @@ files:
|
|
69
69
|
- lib/god_web.rb
|
70
70
|
- public/.DS_Store
|
71
71
|
- public/app.css
|
72
|
+
- public/app.js
|
72
73
|
- public/icons/big_icon.png
|
73
74
|
- public/icons/bookmark.png
|
75
|
+
- public/icons/cpus.png
|
74
76
|
- public/icons/databases.png
|
75
77
|
- public/icons/gear.png
|
76
78
|
- public/icons/groups.png
|
77
79
|
- public/icons/info.png
|
78
80
|
- public/icons/key.png
|
81
|
+
- public/icons/mem.png
|
79
82
|
- public/icons/monitor.png
|
80
83
|
- public/icons/restart.png
|
81
84
|
- public/icons/ruby.png
|
@@ -93,6 +96,7 @@ files:
|
|
93
96
|
- public/iui/blueButton.png
|
94
97
|
- public/iui/cancel.png
|
95
98
|
- public/iui/grayButton.png
|
99
|
+
- public/iui/greenButton.png
|
96
100
|
- public/iui/iui-logo-touch-icon.png
|
97
101
|
- public/iui/iui.css
|
98
102
|
- public/iui/iui.js
|
@@ -111,11 +115,13 @@ files:
|
|
111
115
|
- public/iui/toolButton.png
|
112
116
|
- public/iui/toolbar.png
|
113
117
|
- public/iui/whiteButton.png
|
118
|
+
- public/iui/yellowButton.png
|
114
119
|
- spec/god_web_spec.rb
|
115
120
|
- spec/spec_helper.rb
|
116
121
|
- views/command.erb
|
117
122
|
- views/icon.erb
|
118
123
|
- views/status.erb
|
124
|
+
- views/top.erb
|
119
125
|
- views/watch.erb
|
120
126
|
has_rdoc: false
|
121
127
|
homepage: http://github.com/nofxx/god_web
|