rewritten 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/README.rdoc +93 -0
- data/Rakefile +28 -0
- data/bin/rewritten-web.rb +25 -0
- data/config.ru +4 -0
- data/lib/rack/dummy.rb +22 -0
- data/lib/rack/html.rb +44 -0
- data/lib/rack/record.rb +30 -0
- data/lib/rack/url.rb +47 -0
- data/lib/rewritten/config.ru +4 -0
- data/lib/rewritten/helpers.rb +58 -0
- data/lib/rewritten/server/public/favicon.ico +0 -0
- data/lib/rewritten/server/public/idle.png +0 -0
- data/lib/rewritten/server/public/jquery-1.3.2.min.js +19 -0
- data/lib/rewritten/server/public/jquery.relatize_date.js +95 -0
- data/lib/rewritten/server/public/poll.png +0 -0
- data/lib/rewritten/server/public/ranger.js +73 -0
- data/lib/rewritten/server/public/reset.css +48 -0
- data/lib/rewritten/server/public/style.css +85 -0
- data/lib/rewritten/server/public/working.png +0 -0
- data/lib/rewritten/server/test_helper.rb +19 -0
- data/lib/rewritten/server/views/clear_hits.erb +10 -0
- data/lib/rewritten/server/views/delete.erb +16 -0
- data/lib/rewritten/server/views/error.erb +1 -0
- data/lib/rewritten/server/views/failed.erb +64 -0
- data/lib/rewritten/server/views/hits.erb +30 -0
- data/lib/rewritten/server/views/key_sets.erb +19 -0
- data/lib/rewritten/server/views/key_string.erb +11 -0
- data/lib/rewritten/server/views/layout.erb +44 -0
- data/lib/rewritten/server/views/mappings.erb +61 -0
- data/lib/rewritten/server/views/new.erb +16 -0
- data/lib/rewritten/server/views/next_more.erb +11 -0
- data/lib/rewritten/server/views/overview.erb +8 -0
- data/lib/rewritten/server/views/queues.erb +49 -0
- data/lib/rewritten/server/views/stats.erb +62 -0
- data/lib/rewritten/server/views/to.erb +22 -0
- data/lib/rewritten/server/views/workers.erb +109 -0
- data/lib/rewritten/server/views/working.erb +72 -0
- data/lib/rewritten/server.rb +209 -0
- data/lib/rewritten/version.rb +3 -0
- data/lib/rewritten.rb +403 -0
- data/lib/test.ru +17 -0
- data/rewritten.gemspec +40 -0
- data/test/test_rewritten.rb +6 -0
- metadata +174 -0
@@ -0,0 +1,73 @@
|
|
1
|
+
$(function() {
|
2
|
+
var poll_interval = 2
|
3
|
+
|
4
|
+
var relatizer = function(){
|
5
|
+
var dt = $(this).text(), relatized = $.relatizeDate(this)
|
6
|
+
if ($(this).parents("a").length > 0 || $(this).is("a")) {
|
7
|
+
$(this).relatizeDate()
|
8
|
+
if (!$(this).attr('title')) {
|
9
|
+
$(this).attr('title', dt)
|
10
|
+
}
|
11
|
+
} else {
|
12
|
+
$(this)
|
13
|
+
.text('')
|
14
|
+
.append( $('<a href="#" class="toggle_format" title="' + dt + '" />')
|
15
|
+
.append('<span class="date_time">' + dt +
|
16
|
+
'</span><span class="relatized_time">' +
|
17
|
+
relatized + '</span>') )
|
18
|
+
}
|
19
|
+
};
|
20
|
+
|
21
|
+
$('.time').each(relatizer);
|
22
|
+
|
23
|
+
$('.time a.toggle_format .date_time').hide()
|
24
|
+
|
25
|
+
var format_toggler = function(){
|
26
|
+
$('.time a.toggle_format span').toggle()
|
27
|
+
$(this).attr('title', $('span:hidden',this).text())
|
28
|
+
return false
|
29
|
+
};
|
30
|
+
|
31
|
+
$('.time a.toggle_format').click(format_toggler);
|
32
|
+
|
33
|
+
$('.backtrace').click(function() {
|
34
|
+
$(this).next().toggle()
|
35
|
+
return false
|
36
|
+
})
|
37
|
+
|
38
|
+
$('a[rel=poll]').click(function() {
|
39
|
+
var href = $(this).attr('href')
|
40
|
+
$(this).parent().text('Starting...')
|
41
|
+
$("#main").addClass('polling')
|
42
|
+
|
43
|
+
setInterval(function() {
|
44
|
+
$.ajax({dataType: 'text', type: 'get', url: href, success: function(data) {
|
45
|
+
$('#main').html(data)
|
46
|
+
$('#main .time').relatizeDate()
|
47
|
+
}})
|
48
|
+
}, poll_interval * 1000)
|
49
|
+
|
50
|
+
return false
|
51
|
+
})
|
52
|
+
|
53
|
+
$('ul.failed li').hover(function() {
|
54
|
+
$(this).addClass('hover');
|
55
|
+
}, function() {
|
56
|
+
$(this).removeClass('hover');
|
57
|
+
})
|
58
|
+
|
59
|
+
$('ul.failed a[rel=retry]').click(function() {
|
60
|
+
var href = $(this).attr('href');
|
61
|
+
$(this).text('Retrying...');
|
62
|
+
var parent = $(this).parent();
|
63
|
+
$.ajax({dataType: 'text', type: 'get', url: href, success: function(data) {
|
64
|
+
parent.html('Retried <b><span class="time">' + data + '</span></b>');
|
65
|
+
relatizer.apply($('.time', parent));
|
66
|
+
$('.date_time', parent).hide();
|
67
|
+
$('a.toggle_format span', parent).click(format_toggler);
|
68
|
+
}});
|
69
|
+
return false;
|
70
|
+
})
|
71
|
+
|
72
|
+
|
73
|
+
})
|
@@ -0,0 +1,48 @@
|
|
1
|
+
html, body, div, span, applet, object, iframe,
|
2
|
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
3
|
+
a, abbr, acronym, address, big, cite, code,
|
4
|
+
del, dfn, em, font, img, ins, kbd, q, s, samp,
|
5
|
+
small, strike, strong, sub, sup, tt, var,
|
6
|
+
dl, dt, dd, ul, li,
|
7
|
+
form, label, legend,
|
8
|
+
table, caption, tbody, tfoot, thead, tr, th, td {
|
9
|
+
margin: 0;
|
10
|
+
padding: 0;
|
11
|
+
border: 0;
|
12
|
+
outline: 0;
|
13
|
+
font-weight: inherit;
|
14
|
+
font-style: normal;
|
15
|
+
font-size: 100%;
|
16
|
+
font-family: inherit;
|
17
|
+
}
|
18
|
+
|
19
|
+
:focus {
|
20
|
+
outline: 0;
|
21
|
+
}
|
22
|
+
|
23
|
+
body {
|
24
|
+
line-height: 1;
|
25
|
+
}
|
26
|
+
|
27
|
+
ul {
|
28
|
+
list-style: none;
|
29
|
+
}
|
30
|
+
|
31
|
+
table {
|
32
|
+
border-collapse: collapse;
|
33
|
+
border-spacing: 0;
|
34
|
+
}
|
35
|
+
|
36
|
+
caption, th, td {
|
37
|
+
text-align: left;
|
38
|
+
font-weight: normal;
|
39
|
+
}
|
40
|
+
|
41
|
+
blockquote:before, blockquote:after,
|
42
|
+
q:before, q:after {
|
43
|
+
content: "";
|
44
|
+
}
|
45
|
+
|
46
|
+
blockquote, q {
|
47
|
+
quotes: "" "";
|
48
|
+
}
|
@@ -0,0 +1,85 @@
|
|
1
|
+
html { background:#efefef; font-family:Arial, Verdana, sans-serif; font-size:13px; }
|
2
|
+
body { padding:0; margin:0; }
|
3
|
+
|
4
|
+
.header { background:#000; padding:8px 5% 0 5%; border-bottom:1px solid #444;border-bottom:5px solid #ce1212;}
|
5
|
+
.header h1 { color:#333; font-size:90%; font-weight:bold; margin-bottom:6px;}
|
6
|
+
.header ul li { display:inline;}
|
7
|
+
.header ul li a { color:#fff; text-decoration:none; margin-right:10px; display:inline-block; padding:8px; -webkit-border-top-right-radius:6px; -webkit-border-top-left-radius:6px; -moz-border-radius-topleft:6px; -moz-border-radius-topright:6px; }
|
8
|
+
.header ul li a:hover { background:#333;}
|
9
|
+
.header ul li.current a { background:#ce1212; font-weight:bold; color:#fff;}
|
10
|
+
|
11
|
+
.header .namespace { position: absolute; right: 75px; top: 10px; color: #7A7A7A; }
|
12
|
+
|
13
|
+
.subnav { padding:2px 5% 7px 5%; background:#ce1212; font-size:90%;}
|
14
|
+
.subnav li { display:inline;}
|
15
|
+
.subnav li a { color:#fff; text-decoration:none; margin-right:10px; display:inline-block; background:#dd5b5b; padding:5px; -webkit-border-radius:3px; -moz-border-radius:3px;}
|
16
|
+
.subnav li.current a { background:#fff; font-weight:bold; color:#ce1212;}
|
17
|
+
.subnav li a:active { background:#b00909;}
|
18
|
+
|
19
|
+
#main { padding:10px 5%; background:#fff; overflow:hidden; }
|
20
|
+
#main .logo { float:right; margin:10px;}
|
21
|
+
#main span.hl { background:#efefef; padding:2px;}
|
22
|
+
#main h1 { margin:10px 0; font-size:190%; font-weight:bold; color:#ce1212;}
|
23
|
+
#main h2 { margin:10px 0; font-size:130%;}
|
24
|
+
#main table { width:100%; margin:10px 0;}
|
25
|
+
#main table tr td, #main table tr th { border:1px solid #ccc; padding:6px;}
|
26
|
+
#main table tr th { background:#efefef; color:#888; font-size:80%; font-weight:bold;}
|
27
|
+
#main table tr td.no-data { text-align:center; padding:40px 0; color:#999; font-style:italic; font-size:130%;}
|
28
|
+
#main a { color:#111;}
|
29
|
+
#main p { margin:5px 0;}
|
30
|
+
#main p.intro { margin-bottom:15px; font-size:85%; color:#999; margin-top:0; line-height:1.3;}
|
31
|
+
#main h1.wi { margin-bottom:5px;}
|
32
|
+
#main p.sub { font-size:95%; color:#999;}
|
33
|
+
|
34
|
+
#main table.queues { width:40%;}
|
35
|
+
#main table.queues td.queue { font-weight:bold; width:50%;}
|
36
|
+
#main table.queues tr.failed td { border-top:2px solid; font-size:90%; }
|
37
|
+
#main table.queues tr.failure td { background:#ffecec; border-top:2px solid #d37474; font-size:90%; color:#d37474;}
|
38
|
+
#main table.queues tr.failure td a{ color:#d37474;}
|
39
|
+
|
40
|
+
#main table.jobs td.class { font-family:Monaco, "Courier New", monospace; font-size:90%; width:50%;}
|
41
|
+
#main table.jobs td.args{ width:50%;}
|
42
|
+
|
43
|
+
#main table.workers td.icon {width:1%; background:#efefef;text-align:center;}
|
44
|
+
#main table.workers td.where { width:25%;}
|
45
|
+
#main table.workers td.queues { width:35%;}
|
46
|
+
#main .queue-tag { background:#b1d2e9; padding:2px; margin:0 3px; font-size:80%; text-decoration:none; text-transform:uppercase; font-weight:bold; color:#3274a2; -webkit-border-radius:4px; -moz-border-radius:4px;}
|
47
|
+
#main table.workers td.queues.queue { width:10%;}
|
48
|
+
#main table.workers td.process { width:35%;}
|
49
|
+
#main table.workers td.process span.waiting { color:#999; font-size:90%;}
|
50
|
+
#main table.workers td.process small { font-size:80%; margin-left:5px;}
|
51
|
+
#main table.workers td.process code { font-family:Monaco, "Courier New", monospace; font-size:90%;}
|
52
|
+
#main table.workers td.process small a { color:#999;}
|
53
|
+
#main.polling table.workers tr.working td { background:#f4ffe4; color:#7ac312;}
|
54
|
+
#main.polling table.workers tr.working td.where a { color:#7ac312;}
|
55
|
+
#main.polling table.workers tr.working td.process code { font-weight:bold;}
|
56
|
+
|
57
|
+
|
58
|
+
#main table.stats th { font-size:100%; width:40%; color:#000;}
|
59
|
+
#main hr { border:0; border-top:5px solid #efefef; margin:15px 0;}
|
60
|
+
|
61
|
+
#footer { padding:10px 5%; background:#efefef; color:#999; font-size:85%; line-height:1.5; border-top:5px solid #ccc; padding-top:10px;}
|
62
|
+
#footer p a { color:#999;}
|
63
|
+
|
64
|
+
#main p.poll { background:url(poll.png) no-repeat 0 2px; padding:3px 0; padding-left:23px; float:right; font-size:85%; }
|
65
|
+
|
66
|
+
#main ul.failed {}
|
67
|
+
#main ul.failed li {background:-webkit-gradient(linear, left top, left bottom, from(#efefef), to(#fff)) #efefef; margin-top:10px; padding:10px; overflow:hidden; -webkit-border-radius:5px; border:1px solid #ccc; }
|
68
|
+
#main ul.failed li dl dt {font-size:80%; color:#999; width:60px; float:left; padding-top:1px; text-align:right;}
|
69
|
+
#main ul.failed li dl dd {margin-bottom:10px; margin-left:70px;}
|
70
|
+
#main ul.failed li dl dd .retried { float:right; text-align: right; }
|
71
|
+
#main ul.failed li dl dd .retried .remove { display:none; margin-top: 8px; }
|
72
|
+
#main ul.failed li.hover dl dd .retried .remove { display:block; }
|
73
|
+
#main ul.failed li dl dd .controls { display:none; float:right; }
|
74
|
+
#main ul.failed li.hover dl dd .controls { display:block; }
|
75
|
+
#main ul.failed li dl dd code, #main ul.failed li dl dd pre { font-family:Monaco, "Courier New", monospace; font-size:90%; white-space: pre-wrap;}
|
76
|
+
#main ul.failed li dl dd.error a {font-family:Monaco, "Courier New", monospace; font-size:90%; }
|
77
|
+
#main ul.failed li dl dd.error pre { margin-top:3px; line-height:1.3;}
|
78
|
+
|
79
|
+
#main p.pagination { background:#efefef; padding:10px; overflow:hidden;}
|
80
|
+
#main p.pagination a.less { float:left;}
|
81
|
+
#main p.pagination a.more { float:right;}
|
82
|
+
|
83
|
+
#main form {float:right; margin-top:-10px;}
|
84
|
+
|
85
|
+
#main .time a.toggle_format {text-decoration:none;}
|
Binary file
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rack/test'
|
2
|
+
require 'resque/server'
|
3
|
+
|
4
|
+
module Resque
|
5
|
+
module TestHelper
|
6
|
+
class Test::Unit::TestCase
|
7
|
+
include Rack::Test::Methods
|
8
|
+
def app
|
9
|
+
Resque::Server.new
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.should_respond_with_success
|
13
|
+
test "should respond with success" do
|
14
|
+
assert last_response.ok?, last_response.errors
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
|
2
|
+
<div style="float:left">
|
3
|
+
<p>Are you sure you want to delete all hits (this cannot be undone) ? </p>
|
4
|
+
<form action='<%= u("/hits/clear")%>' method="post" style="margin-top: 10px ">
|
5
|
+
<input type="submit" value="Yes, clear all!">
|
6
|
+
<a href='<%= u("/hits") %>'>Cancel</a>
|
7
|
+
</form>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<div style="float:left">
|
2
|
+
<% if @from && @to %>
|
3
|
+
<h2><%= @from %> -> <%= @to %> </h2>
|
4
|
+
<p>Are you sure you want to delete above translation?</p>
|
5
|
+
<form action='<%= u("/delete")%>' method="post" style="margin-top: 10px ">
|
6
|
+
<input type="hidden" name="_method" value="delete">
|
7
|
+
<input type="hidden" name="from" value="<%= @from %>">
|
8
|
+
<input type="hidden" name="to" value="<%= @to %>">
|
9
|
+
<input type="submit" value="Yes, Delete It!">
|
10
|
+
<a href='<%= u("/to?to=#{@to}") %>'>Cancel</a>
|
11
|
+
</form>
|
12
|
+
<% else %>
|
13
|
+
<p>Translation not found.</p>
|
14
|
+
<% end %>
|
15
|
+
</div>
|
16
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1 style="font-size:110%;font-family:Arial, sans-serif;"><%= error %></h1>
|
@@ -0,0 +1,64 @@
|
|
1
|
+
<%start = params[:start].to_i %>
|
2
|
+
<%failed = Resque::Failure.all(start, 20)%>
|
3
|
+
<% index = 0 %>
|
4
|
+
<% date_format = "%Y/%m/%d %T %z" %>
|
5
|
+
|
6
|
+
<h1>Failed Jobs</h1>
|
7
|
+
<%unless failed.empty?%>
|
8
|
+
<form method="POST" action="<%=u 'failed/clear'%>" class='clear-failed'>
|
9
|
+
<input type='submit' name='' value='Clear Failed Jobs' />
|
10
|
+
</form>
|
11
|
+
<%end%>
|
12
|
+
|
13
|
+
<p class='sub'>Showing <%=start%> to <%= start + 20 %> of <b><%= size = Resque::Failure.count %></b> jobs</p>
|
14
|
+
|
15
|
+
<ul class='failed'>
|
16
|
+
<%for job in failed%>
|
17
|
+
<% index += 1 %>
|
18
|
+
<li>
|
19
|
+
<dl>
|
20
|
+
<% if job.nil? %>
|
21
|
+
<dt>Error</dt>
|
22
|
+
<dd>Job <%= index%> could not be parsed; perhaps it contains invalid JSON?</dd>
|
23
|
+
<% else %>
|
24
|
+
<dt>Worker</dt>
|
25
|
+
<dd>
|
26
|
+
<a href="<%= u(:workers, job['worker']) %>"><%= job['worker'].split(':')[0...2].join(':') %></a> on <b class='queue-tag'><%= job['queue'] %></b > at <b><span class="time"><%= Time.parse(job['failed_at']).strftime(date_format) %></span></b>
|
27
|
+
<% if job['retried_at'] %>
|
28
|
+
<div class='retried'>
|
29
|
+
Retried <b><span class="time"><%= Time.parse(job['retried_at']).strftime(date_format) %></span></b>
|
30
|
+
<a href="<%= u "failed/remove/#{start + index - 1}" %>" class="remove" rel="remove">Remove</a>
|
31
|
+
</div>
|
32
|
+
<% else %>
|
33
|
+
<div class='controls'>
|
34
|
+
<a href="<%= u "failed/requeue/#{start + index - 1}" %>" rel="retry">Retry</a>
|
35
|
+
or
|
36
|
+
<a href="<%= u "failed/remove/#{start + index - 1}" %>" rel="remove">Remove</a>
|
37
|
+
</div>
|
38
|
+
<% end %>
|
39
|
+
</dd>
|
40
|
+
<dt>Class</dt>
|
41
|
+
<dd><code><%= job['payload'] ? job['payload']['class'] : 'nil' %></code></dd>
|
42
|
+
<dt>Arguments</dt>
|
43
|
+
<dd><pre><%=h job['payload'] ? show_args(job['payload']['args']) : 'nil' %></pre></dd>
|
44
|
+
<dt>Exception</dt>
|
45
|
+
<dd><code><%= job['exception'] %></code></dd>
|
46
|
+
<dt>Error</dt>
|
47
|
+
<dd class='error'>
|
48
|
+
<% if job['backtrace'] %>
|
49
|
+
<a href="#" class="backtrace"><%= h(job['error']) %></a>
|
50
|
+
<pre style='display:none'><%=h job['backtrace'].join("\n") %></pre>
|
51
|
+
<% else %>
|
52
|
+
<%=h job['error'] %>
|
53
|
+
<% end %>
|
54
|
+
</dd>
|
55
|
+
<% end %>
|
56
|
+
</dl>
|
57
|
+
<div class='r'>
|
58
|
+
</div>
|
59
|
+
</li>
|
60
|
+
<%end%>
|
61
|
+
</ul>
|
62
|
+
|
63
|
+
<%= partial :next_more, :start => start, :size => size %>
|
64
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
<h1>Hits</h1>
|
3
|
+
|
4
|
+
<p>
|
5
|
+
This is a list of all successful or redirected hit paths.
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<a href="<%= u('/hits/clear') %>">clear all!</a>
|
9
|
+
|
10
|
+
|
11
|
+
<table class='queues' style="width: 90%">
|
12
|
+
<tr>
|
13
|
+
<th>PATH</th>
|
14
|
+
<th>Content-Type</th>
|
15
|
+
<th>Status</th>
|
16
|
+
</tr>
|
17
|
+
|
18
|
+
<% for h in Rewritten.all_hits %>
|
19
|
+
<tr>
|
20
|
+
<td class=''><%= h['path'] %></td>
|
21
|
+
<td class=''><%= h['content_type'] %></td>
|
22
|
+
<td class=''><%= h['code'] %></td>
|
23
|
+
</tr>
|
24
|
+
<% end %>
|
25
|
+
|
26
|
+
</table>
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<% if key = params[:key] %>
|
2
|
+
|
3
|
+
<p class='sub'>
|
4
|
+
Showing <%= start = params[:start].to_i %> to <%= start + 20 %> of <b><%=size = redis_get_size(key) %></b>
|
5
|
+
</p>
|
6
|
+
|
7
|
+
<h1>Key "<%= key %>" is a <%= resque.redis.type key %></h1>
|
8
|
+
<table>
|
9
|
+
<% for row in redis_get_value_as_array(key, start) %>
|
10
|
+
<tr>
|
11
|
+
<td>
|
12
|
+
<%= row %>
|
13
|
+
</td>
|
14
|
+
</tr>
|
15
|
+
<% end %>
|
16
|
+
</table>
|
17
|
+
|
18
|
+
<%= partial :next_more, :start => start, :size => size %>
|
19
|
+
<% end %>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8" />
|
5
|
+
<title>Rewritten.</title>
|
6
|
+
<link href="<%=u 'reset.css' %>" media="screen" rel="stylesheet" type="text/css">
|
7
|
+
<link href="<%=u 'style.css' %>" media="screen" rel="stylesheet" type="text/css">
|
8
|
+
<script src="<%=u 'jquery-1.3.2.min.js' %>" type="text/javascript"></script>
|
9
|
+
<script src="<%=u 'jquery.relatize_date.js' %>" type="text/javascript"></script>
|
10
|
+
<script src="<%=u 'ranger.js' %>" type="text/javascript"></script>
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
<div class="header">
|
14
|
+
<ul class='nav'>
|
15
|
+
<% tabs.each do |tab_name| %>
|
16
|
+
<%= tab tab_name %>
|
17
|
+
<% end %>
|
18
|
+
</ul>
|
19
|
+
<% if Rewritten.redis.namespace != :resque %>
|
20
|
+
<abbr class="namespace" title="Resque's Redis Namespace">
|
21
|
+
<%= Rewritten.redis.namespace %>
|
22
|
+
</abbr>
|
23
|
+
<% end %>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<% if @subtabs %>
|
27
|
+
<ul class='subnav'>
|
28
|
+
<% for subtab in @subtabs %>
|
29
|
+
<li <%= class_if_current "#{current_section}/#{subtab}" %>><a href="<%= current_section %>/<%= subtab %>"><span><%= subtab %></span></a></li>
|
30
|
+
<% end %>
|
31
|
+
</ul>
|
32
|
+
<% end %>
|
33
|
+
|
34
|
+
<div id="main">
|
35
|
+
<%= yield %>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<div id="footer">
|
39
|
+
<p>Powered by <a href="http://github.com/learnjin/rewritten">Rewritten</a> v<%=Rewritten::VERSION%></p>
|
40
|
+
<p>Connected to Redis namespace <%= Rewritten.redis.namespace %> on <%=Rewritten.redis_id%></p>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
</body>
|
44
|
+
</html>
|
@@ -0,0 +1,61 @@
|
|
1
|
+
|
2
|
+
<%# @subtabs = resque.queues unless partial? || params[:id].nil? %>
|
3
|
+
|
4
|
+
<% if false and queue = params[:id] %>
|
5
|
+
|
6
|
+
<h1>Pending jobs on <span class='hl'><%= queue %></span></h1>
|
7
|
+
<form method="POST" action="<%=u "/queues/#{queue}/remove" %>" class='remove-queue'>
|
8
|
+
<input type='submit' name='' value='Remove Queue' onclick='return confirm("Are you absolutely sure? This cannot be undone.");' />
|
9
|
+
</form>
|
10
|
+
<p class='sub'>Showing <%= start = params[:start].to_i + 1 %> to <%= start + 20 %> of <b><%=size = rewritten.size(queue)%></b> jobs</p>
|
11
|
+
<table class='jobs'>
|
12
|
+
<tr>
|
13
|
+
<th>Class</th>
|
14
|
+
<th>Args</th>
|
15
|
+
</tr>
|
16
|
+
<% for job in (jobs = rewritten.peek(queue, start, 20)) %>
|
17
|
+
<tr>
|
18
|
+
<td class='class'><%= job['class'] %></td>
|
19
|
+
<td class='args'><%=h job['args'].inspect %></td>
|
20
|
+
</tr>
|
21
|
+
<% end %>
|
22
|
+
<% if jobs.empty? %>
|
23
|
+
<tr>
|
24
|
+
<td class='no-data' colspan='2'>There are no pending jobs in this queue</td>
|
25
|
+
</tr>
|
26
|
+
<% end %>
|
27
|
+
</table>
|
28
|
+
<%= partial :next_more, :start => start, :size => size %>
|
29
|
+
<% else %>
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
<h1 class='wi'>Translations</h1>
|
34
|
+
|
35
|
+
<p class='intro'>The list below contains all the registered translations from
|
36
|
+
url to target url. Select a target from above to view all mappings for the
|
37
|
+
target.</p>
|
38
|
+
|
39
|
+
<a href="<%= u('/new') %>"> + New Mapping </a>
|
40
|
+
|
41
|
+
<p class='sub'>Showing <%= (start = params[:start].to_i)+1 %> to <%= start + Rewritten.per_page %> of <b><%=size = Rewritten.size('froms')%></b> translations. </p>
|
42
|
+
|
43
|
+
<table class='queues'>
|
44
|
+
<tr>
|
45
|
+
<th>from URL (Browser Location)</th>
|
46
|
+
<th>to URL (Your App)</th>
|
47
|
+
</tr>
|
48
|
+
|
49
|
+
<% for mapping in Rewritten.list_range("froms", params[:start].to_i, Rewritten.per_page) %>
|
50
|
+
<tr>
|
51
|
+
<td class=''><a href="<%= mapping %>" target="new"><%= mapping %></td>
|
52
|
+
<td class='queue'><a href="<%= u("/to?to=#{to=Rewritten.redis.get("from:#{mapping}")}") %>"><%= to %></td>
|
53
|
+
</tr>
|
54
|
+
<% end %>
|
55
|
+
|
56
|
+
</table>
|
57
|
+
|
58
|
+
<% end %>
|
59
|
+
|
60
|
+
<%= partial :next_more, :start => start, :size => size %>
|
61
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
<h1>Create New Mapping</h1>
|
4
|
+
|
5
|
+
|
6
|
+
<div style="float: left; margin-top: 10px">
|
7
|
+
<form method="POST" action="<%= u "/mappings" %>">
|
8
|
+
<label>From:</label><br/> <input type="text" name="from" /> <br />
|
9
|
+
<label>To:</label><br/> <input type="text" name="to" value="<%= params[:to] %>" /> <br />
|
10
|
+
<input type="submit" value="Create" />
|
11
|
+
</form>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%if start - Rewritten.per_page >= 0 || start + Rewritten.per_page < size%>
|
2
|
+
<p class='pagination'>
|
3
|
+
<% if start - Rewritten.per_page >= 0 %>
|
4
|
+
<a href="<%= current_page %>?start=<%= start - Rewritten.per_page %>" class='less'>« less</a>
|
5
|
+
<% end %>
|
6
|
+
<% if start + Rewritten.per_page <= size %>
|
7
|
+
<a href="<%= current_page %>?start=<%= start + Rewritten.per_page %>" class='more'>more »</a>
|
8
|
+
<% end %>
|
9
|
+
</p>
|
10
|
+
<%end%>
|
11
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<%# @subtabs = resque.queues unless partial? || params[:id].nil? %>
|
2
|
+
|
3
|
+
<% if queue = params[:id] %>
|
4
|
+
|
5
|
+
<h1>Pending jobs on <span class='hl'><%= queue %></span></h1>
|
6
|
+
<form method="POST" action="<%=u "/queues/#{queue}/remove" %>" class='remove-queue'>
|
7
|
+
<input type='submit' name='' value='Remove Queue' onclick='return confirm("Are you absolutely sure? This cannot be undone.");' />
|
8
|
+
</form>
|
9
|
+
<p class='sub'>Showing <%= start = params[:start].to_i %> to <%= start + 20 %> of <b><%=size = rewritten.size(queue)%></b> jobs</p>
|
10
|
+
<table class='jobs'>
|
11
|
+
<tr>
|
12
|
+
<th>Class</th>
|
13
|
+
<th>Args</th>
|
14
|
+
</tr>
|
15
|
+
<% for job in (jobs = rewritten.peek(queue, start, 20)) %>
|
16
|
+
<tr>
|
17
|
+
<td class='class'><%= job['class'] %></td>
|
18
|
+
<td class='args'><%=h job['args'].inspect %></td>
|
19
|
+
</tr>
|
20
|
+
<% end %>
|
21
|
+
<% if jobs.empty? %>
|
22
|
+
<tr>
|
23
|
+
<td class='no-data' colspan='2'>There are no pending jobs in this queue</td>
|
24
|
+
</tr>
|
25
|
+
<% end %>
|
26
|
+
</table>
|
27
|
+
<%= partial :next_more, :start => start, :size => size %>
|
28
|
+
<% else %>
|
29
|
+
|
30
|
+
<h1 class='wi'>Queues</h1>
|
31
|
+
<p class='intro'>The list below contains all the registered queues with the number of jobs currently in the queue. Select a queue from above to view all jobs currently pending on the queue.</p>
|
32
|
+
<table class='queues'>
|
33
|
+
<tr>
|
34
|
+
<th>Name</th>
|
35
|
+
<th>Jobs</th>
|
36
|
+
</tr>
|
37
|
+
<% for queue in rewritten.queues.sort_by { |q| q.to_s } %>
|
38
|
+
<tr>
|
39
|
+
<td class='queue'><a class="queue" href="<%= u "queues/#{queue}" %>"><%= queue %></a></td>
|
40
|
+
<td class='size'><%= rewritten.size queue %></td>
|
41
|
+
</tr>
|
42
|
+
<% end %>
|
43
|
+
<tr class="<%= Rewritten::Failure.count.zero? ? "failed" : "failure" %>">
|
44
|
+
<td class='queue failed'><a class="queue" href="<%= u :failed %>">failed</a></td>
|
45
|
+
<td class='size'><%= Rewritten::Failure.count %></td>
|
46
|
+
</tr>
|
47
|
+
</table>
|
48
|
+
|
49
|
+
<% end %>
|
@@ -0,0 +1,62 @@
|
|
1
|
+
<% @subtabs = %w( resque redis keys ) %>
|
2
|
+
|
3
|
+
<% if params[:key] %>
|
4
|
+
|
5
|
+
<%= partial resque.redis.type(params[:key]).eql?("string") ? :key_string : :key_sets %>
|
6
|
+
|
7
|
+
<% elsif params[:id] == "resque" %>
|
8
|
+
|
9
|
+
<h1><%= resque %></h1>
|
10
|
+
<table class='stats'>
|
11
|
+
<% for key, value in resque.info.to_a.sort_by { |i| i[0].to_s } %>
|
12
|
+
<tr>
|
13
|
+
<th>
|
14
|
+
<%= key %>
|
15
|
+
</th>
|
16
|
+
<td>
|
17
|
+
<%= value %>
|
18
|
+
</td>
|
19
|
+
</tr>
|
20
|
+
<% end %>
|
21
|
+
</table>
|
22
|
+
|
23
|
+
<% elsif params[:id] == 'redis' %>
|
24
|
+
|
25
|
+
<h1><%= resque.redis_id %></h1>
|
26
|
+
<table class='stats'>
|
27
|
+
<% for key, value in resque.redis.info.to_a.sort_by { |i| i[0].to_s } %>
|
28
|
+
<tr>
|
29
|
+
<th>
|
30
|
+
<%= key %>
|
31
|
+
</th>
|
32
|
+
<td>
|
33
|
+
<%= value %>
|
34
|
+
</td>
|
35
|
+
</tr>
|
36
|
+
<% end %>
|
37
|
+
</table>
|
38
|
+
|
39
|
+
<% elsif params[:id] == 'keys' %>
|
40
|
+
|
41
|
+
<h1>Keys owned by <%= resque %></h1>
|
42
|
+
<p class='sub'>(All keys are actually prefixed with "<%= Resque.redis.namespace %>:")</p>
|
43
|
+
<table class='stats'>
|
44
|
+
<tr>
|
45
|
+
<th>key</th>
|
46
|
+
<th>type</th>
|
47
|
+
<th>size</th>
|
48
|
+
</tr>
|
49
|
+
<% for key in resque.keys.sort %>
|
50
|
+
<tr>
|
51
|
+
<th>
|
52
|
+
<a href="<%=u "/stats/keys/#{key}" %>"><%= key %></a>
|
53
|
+
</th>
|
54
|
+
<td><%= resque.redis.type key %></td>
|
55
|
+
<td><%= redis_get_size key %></td>
|
56
|
+
</tr>
|
57
|
+
<% end %>
|
58
|
+
</table>
|
59
|
+
|
60
|
+
<% else %>
|
61
|
+
|
62
|
+
<% end %>
|