1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
<header class='row'>
<div class='col-sm-5 pull-left'>
<h3><%= t('CronJobs') %></h3>
</div>
<div class='col-sm-7 pull-right' style="margin-top: 20px; margin-bottom: 10px;">
<% if @cron_jobs.size > 0 %>
<form action="<%= root_path %>cron/__all__/delete" method="post" class="pull-right">
<%= csrf_tag if respond_to?(:csrf_tag) %>
<input class="btn btn-danger" type="submit" name="delete" value="<%= t('DeleteAll') %>" data-confirm="<%= t('AreYouSureDeleteCronJobs') %>" />
</form>
<form action="<%= root_path %>cron/__all__/disable" method="post" class="pull-right">
<%= csrf_tag if respond_to?(:csrf_tag) %>
<input class="btn btn-warn" type="submit" name="enque" value="<%= t('DisableAll') %>" />
</form>
<form action="<%= root_path %>cron/__all__/enable" method="post" class="pull-right">
<%= csrf_tag if respond_to?(:csrf_tag) %>
<input class="btn btn-warn" type="submit" name="enque" value="<%= t('EnableAll') %>" />
</form>
<form action="<%= root_path %>cron/__all__/enque" method="post" class="pull-right">
<%= csrf_tag if respond_to?(:csrf_tag) %>
<input class="btn btn-warn" type="submit" name="enque" value="<%= t('EnqueueAll') %>" data-confirm="<%= t('AreYouSureEnqueueCronJobs') %>" />
</form>
<% end %>
</div>
</header>
<% if @cron_jobs.size > 0 %>
<table class="table table-hover table-bordered table-striped table-white">
<thead>
<th><%= t('Status') %></th>
<th><%= t('Name') %></th>
<th><%= t('Cron string') %></th>
<th><%= t('Last enqueued') %></th>
<th width="180"><%= t('Actions')%></th>
</thead>
<tbody>
<% @cron_jobs.sort{|a,b| a.sort_name <=> b.sort_name }.each_with_index do |job, index| %>
<% style = "#{job.status == 'disabled' ? "background: #ecc; color: #585454;": ""}" %>
<tr>
<td style="<%= style %>"><%= t job.status %></td>
<td style="<%= style %>">
<a href="<%= root_path %>cron/<%= CGI.escape(job.name).gsub('+', '%20') %>">
<b style="<%= style %>"><%= job.name %></b>
</a>
<hr style="margin:3px;border:0;">
<small>
<% if job.message and job.message.to_s.size > 100 %>
<% if Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new("6.3.0") %>
<button data-toggle="job_<%= index %>" class="btn btn-warn btn-xs"><%= t('ShowAll')%></button>
<div class="toggle" id="job_<%= index %>" style="display: inline;"><%= job.message[0..100] + "... " %></div>
<div class="toggle" id="job_<%= index %>_full" style="display: none;"><%= job.message %></div>
<% else %>
<button data-toggle="collapse" data-target=".worker_<%= index %>" class="btn btn-warn btn-xs"><%= t('ShowAll')%></button>
<div class="toggle worker_<%= index %>" style="display: inline;"><%= job.message[0..100] + "... " %></div>
<div class="toggle worker_<%= index %>" style="display: none;"><%= job.message %></div>
<% end %>
<% else %>
<%= job.message %>
<% end %>
</small>
</td>
<td style="<%= style %>"><b><%= job.cron.gsub(" ", " ") %></b></td>
<td style="<%= style %>"><%= job.last_enqueue_time ? relative_time(job.last_enqueue_time) : "-" %></td>
<td style="<%= style %>">
<% if job.status == 'enabled' %>
<form action="<%= root_path %>cron/<%= CGI.escape(job.name).gsub('+', '%20') %>/enque" method="post">
<%= csrf_tag if respond_to?(:csrf_tag) %>
<input class='btn btn-warn btn-xs pull-left' type="submit" name="enque" value="<%= t('EnqueueNow') %>" data-confirm="<%= t('AreYouSureEnqueueCronJob', :job => job.name) %>"/>
</form>
<form action="<%= root_path %>cron/<%= CGI.escape(job.name).gsub('+', '%20') %>/disable" method="post">
<%= csrf_tag if respond_to?(:csrf_tag) %>
<input class='btn btn-warn btn-xs pull-left' type="submit" name="disable" value="<%= t('Disable') %>"/>
</form>
<% else %>
<form action="<%= root_path %>cron/<%= CGI.escape(job.name).gsub('+', '%20') %>/enque" method="post">
<%= csrf_tag if respond_to?(:csrf_tag) %>
<input class='btn btn-warn btn-xs pull-left' type="submit" name="enque" value="<%= t('EnqueueNow') %>"/>
</form>
<form action="<%= root_path %>cron/<%= CGI.escape(job.name).gsub('+', '%20') %>/enable" method="post">
<%= csrf_tag if respond_to?(:csrf_tag) %>
<input class='btn btn-warn btn-xs pull-left' type="submit" name="enable" value="<%= t('Enable') %>"/>
</form>
<form action="<%= root_path %>cron/<%= CGI.escape(job.name).gsub('+', '%20') %>/delete" method="post">
<%= csrf_tag if respond_to?(:csrf_tag) %>
<input class='btn btn-xs btn-danger pull-left' type="submit" name="delete" value="<%= t('Delete') %>" data-confirm="<%= t('AreYouSureDeleteCronJob', :job => job.name) %>"/>
</form>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<div class='alert alert-success'><%= t('NoCronJobsWereFound') %></div>
<% end %>
|