sidekiq-cron 2.1.0 → 2.4.0

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.
@@ -1,113 +1,104 @@
1
- <header class='row'>
2
- <div class='col-sm-5 pull-left'>
3
- <h3>
1
+ <section>
2
+ <header>
3
+ <h2>
4
4
  <%= t('CronJobs') %>
5
- <small><%= @current_namespace %></small>
6
- </h3>
7
- </div>
8
- <div class='col-sm-7 pull-right h2'>
5
+ <small>(<%= CGI.escapeHTML(@current_namespace.to_s) %>)</small>
6
+ </h2>
9
7
  <% if @cron_jobs.size > 0 %>
10
- <form action="<%= root_path %>cron/namespaces/<%= @current_namespace %>/all/delete" method="post" class="pull-right">
11
- <%= csrf_tag %>
12
- <input class="btn btn-danger" type="submit" name="delete" value="<%= t('DeleteAll') %>" data-confirm="<%= t('AreYouSureDeleteCronJobs') %>" />
13
- </form>
14
- <form action="<%= root_path %>cron/namespaces/<%= @current_namespace %>/all/disable" method="post" class="pull-right">
15
- <%= csrf_tag %>
16
- <input class="btn btn-warn" type="submit" name="enqueue" value="<%= t('DisableAll') %>" />
17
- </form>
18
- <form action="<%= root_path %>cron/namespaces/<%= @current_namespace %>/all/enable" method="post" class="pull-right">
19
- <%= csrf_tag %>
20
- <input class="btn btn-warn" type="submit" name="enqueue" value="<%= t('EnableAll') %>" />
21
- </form>
22
- <form action="<%= root_path %>cron/namespaces/<%= @current_namespace %>/all/enqueue" method="post" class="pull-right">
23
- <%= csrf_tag %>
24
- <input class="btn btn-warn" type="submit" name="enqueue" value="<%= t('EnqueueAll') %>" data-confirm="<%= t('AreYouSureEnqueueCronJobs') %>" />
25
- </form>
8
+ <% escaped_current_namespace = CGI.escape(@current_namespace) %>
9
+ <div class="filter buttons-row">
10
+ <form action="<%= root_path %>cron/namespaces/<%= escaped_current_namespace %>/all/delete" method="post">
11
+ <%= csrf_tag %>
12
+ <input class="btn btn-danger" type="submit" name="delete" value="<%= t('DeleteAll') %>" data-confirm="<%= t('AreYouSureDeleteCronJobs') %>" />
13
+ </form>
14
+ <form action="<%= root_path %>cron/namespaces/<%= escaped_current_namespace %>/all/disable" method="post">
15
+ <%= csrf_tag %>
16
+ <input class="btn btn-primary" type="submit" name="enqueue" value="<%= t('DisableAll') %>" />
17
+ </form>
18
+ <form action="<%= root_path %>cron/namespaces/<%= escaped_current_namespace %>/all/enable" method="post">
19
+ <%= csrf_tag %>
20
+ <input class="btn btn-primary" type="submit" name="enqueue" value="<%= t('EnableAll') %>" />
21
+ </form>
22
+ <form action="<%= root_path %>cron/namespaces/<%= escaped_current_namespace %>/all/enqueue" method="post">
23
+ <%= csrf_tag %>
24
+ <input class="btn btn-primary" type="submit" name="enqueue" value="<%= t('EnqueueAll') %>" data-confirm="<%= t('AreYouSureEnqueueCronJobs') %>" />
25
+ </form>
26
+ </div>
27
+ <% end %>
28
+ </header>
29
+ <!-- Namespaces -->
30
+ <div class="cards-container">
31
+ <% Sidekiq::Cron::Namespace.all_with_count.sort_by { |namespace| namespace[:name] }.each do |namespace| %>
32
+ <article>
33
+ <a href="<%= root_path %>cron/namespaces/<%= namespace[:name] %>">
34
+ <span class="count"><%= namespace[:count] %></span>
35
+ <span class="desc"><%= namespace[:name] %></span>
36
+ </a>
37
+ </article>
26
38
  <% end %>
27
39
  </div>
28
- </header>
29
-
30
- <!-- Namespaces -->
31
- <div class='row'>
32
- <div class="col-sm-12 summary_bar">
33
- <ul class="list-unstyled summary row">
34
- <% Sidekiq::Cron::Namespace.all_with_count.sort_by { |namespace| namespace[:name] }.each do |namespace| %>
35
- <li class="col-sm-1">
36
- <a href="<%= root_path %>cron/namespaces/<%= namespace[:name] %>">
37
- <span class="count"><%= namespace[:count] %></span>
38
- <span class="desc"><%= namespace[:name] %></span>
39
- </a>
40
- </li>
41
- <% end %>
42
- </ul>
43
- </div>
44
- </div>
45
- <!-- Namespaces -->
46
-
47
- <% if @cron_jobs.size > 0 %>
48
- <table class="table table-hover table-bordered table-striped table-white">
49
- <thead>
50
- <tr>
51
- <th><%= t('Status') %></th>
52
- <th width="50%"><%= t('Name') %></th>
53
- <th><%= t('CronString') %></th>
54
- <th><%= t('LastEnqueued') %></th>
55
- <th width="180"><%= t('Actions') %></th>
56
- </tr>
57
- </thead>
58
-
59
- <tbody>
60
- <% @cron_jobs.sort{ |a,b| a.sort_name <=> b.sort_name }.each do |job| %>
61
- <% klass = (job.status == 'disabled') ? 'bg-danger text-muted' : '' %>
62
- <% escaped_job_name = CGI.escape(job.name).gsub('+', '%20') %>
40
+ <!-- Namespaces -->
41
+ <% if @cron_jobs.size > 0 %>
42
+ <table class="table table-hover table-bordered table-striped table-white">
43
+ <thead>
63
44
  <tr>
64
- <td class="<%= klass %>"><%= t job.status %></td>
65
- <td class="<%= klass %>">
66
- <a href="<%= root_path %>cron/namespaces/<%= job.namespace %>/jobs/<%= escaped_job_name %>" title="<%= job.description %>">
67
- <b class="<%= klass %>"><%= job.name %></b>
68
- </a>
69
- <br/>
70
- <% if job.message and job.message.to_s.size > 100 %>
71
- <details>
72
- <summary class="btn btn-warn btn-xs">Show message</summary>
73
- <p><small><%= job.message %></small></p>
74
- </details>
75
- <% else %>
76
- <small><%= job.message %></small>
77
- <% end %>
78
- </td>
79
- <td class="<%= klass %>"><b><%= job.human_cron %><br/><small><%= job.cron.gsub(" ", "&nbsp;") %></small></b></td>
80
- <td class="<%= klass %>"><%= job.last_enqueue_time ? relative_time(job.last_enqueue_time) : "-" %></td>
81
- <td class="<%= klass %>">
82
- <% if job.status == 'enabled' %>
83
- <form action="<%= root_path %>cron/namespaces/<%= job.namespace %>/jobs/<%= escaped_job_name %>/enqueue" method="post">
84
- <%= csrf_tag %>
85
- <input class='btn btn-warn btn-xs pull-left' type="submit" name="enqueue" value="<%= t('EnqueueNow') %>" data-confirm="<%= t('AreYouSureEnqueueCronJob', :job => job.name) %>"/>
86
- </form>
87
- <form action="<%= root_path %>cron/namespaces/<%= job.namespace %>/jobs/<%= escaped_job_name %>/disable" method="post">
88
- <%= csrf_tag %>
89
- <input class='btn btn-warn btn-xs pull-left' type="submit" name="disable" value="<%= t('Disable') %>"/>
90
- </form>
91
- <% else %>
92
- <form action="<%= root_path %>cron/namespaces/<%= job.namespace %>/jobs/<%= escaped_job_name %>/enqueue" method="post">
93
- <%= csrf_tag %>
94
- <input class='btn btn-warn btn-xs pull-left' type="submit" name="enqueue" value="<%= t('EnqueueNow') %>" data-confirm="<%= t('AreYouSureEnqueueCronJob', :job => job.name) %>"/>
95
- </form>
96
- <form action="<%= root_path %>cron/namespaces/<%= job.namespace %>/jobs/<%= escaped_job_name %>/enable" method="post">
97
- <%= csrf_tag %>
98
- <input class='btn btn-warn btn-xs pull-left' type="submit" name="enable" value="<%= t('Enable') %>"/>
99
- </form>
100
- <form action="<%= root_path %>cron/namespaces/<%= job.namespace %>/jobs/<%= escaped_job_name %>/delete" method="post">
101
- <%= csrf_tag %>
102
- <input class='btn btn-xs btn-danger pull-left help-block' type="submit" name="delete" value="<%= t('Delete') %>" data-confirm="<%= t('AreYouSureDeleteCronJob', :job => job.name) %>"/>
103
- </form>
104
- <% end %>
105
- </td>
45
+ <th><%= t('Status') %></th>
46
+ <th width="50%"><%= t('Name') %></th>
47
+ <th><%= t('CronString') %></th>
48
+ <th><%= t('LastEnqueued') %></th>
49
+ <th width="180"><%= t('Actions') %></th>
106
50
  </tr>
107
- <% end %>
108
- </tbody>
109
- </table>
110
- <% else %>
111
- <div class='alert alert-success'><%= t('NoCronJobsWereFound') %></div>
112
- <% end %>
113
-
51
+ </thead>
52
+ <tbody>
53
+ <% @cron_jobs.sort{ |a,b| a.sort_name <=> b.sort_name }.each do |job| %>
54
+ <% klass = (job.status == 'disabled') ? 'bg-danger text-muted' : '' %>
55
+ <% escaped_job_name = CGI.escape(job.name).gsub('+', '%20') %>
56
+ <tr>
57
+ <td class="<%= klass %>"><%= t job.status %></td>
58
+ <td class="<%= klass %>">
59
+ <a href="<%= root_path %>cron/namespaces/<%= job.namespace %>/jobs/<%= escaped_job_name %>" title="<%= job.description %>">
60
+ <b class="<%= klass %>"><%= job.name %></b>
61
+ </a>
62
+ <br/>
63
+ <% if job.message and job.message.to_s.size > 100 %>
64
+ <details>
65
+ <p><small><%= job.message %></small></p>
66
+ </details>
67
+ <% else %>
68
+ <small><%= job.message %></small>
69
+ <% end %>
70
+ </td>
71
+ <td class="<%= klass %>"><b><%= job.human_cron %><br/>
72
+ <small><%= job.cron.gsub(" ", "&nbsp;") %></small></b></td>
73
+ <td class="<%= klass %>"><%= job.last_enqueue_time ? relative_time(job.last_enqueue_time) : "-" %></td>
74
+ <td class="<%= klass %>">
75
+ <div class="pagination" style="padding: 0px">
76
+ <form action="<%= root_path %>cron/namespaces/<%= job.namespace %>/jobs/<%= escaped_job_name %>/enqueue" method="post">
77
+ <%= csrf_tag %>
78
+ <input class='btn btn-warn' type="submit" name="enqueue" value="<%= t('EnqueueNow') %>" data-confirm="<%= t('AreYouSureEnqueueCronJob', :job => job.name) %>"/>
79
+ </form>
80
+ <% if job.status == 'enabled' %>
81
+ <form action="<%= root_path %>cron/namespaces/<%= job.namespace %>/jobs/<%= escaped_job_name %>/disable" method="post">
82
+ <%= csrf_tag %>
83
+ <input class='btn btn-warn' type="submit" name="disable" value="<%= t('Disable') %>"/>
84
+ </form>
85
+ <% else %>
86
+ <form action="<%= root_path %>cron/namespaces/<%= job.namespace %>/jobs/<%= escaped_job_name %>/enable" method="post">
87
+ <%= csrf_tag %>
88
+ <input class='btn btn-warn' type="submit" name="enable" value="<%= t('Enable') %>"/>
89
+ </form>
90
+ <form action="<%= root_path %>cron/namespaces/<%= job.namespace %>/jobs/<%= escaped_job_name %>/delete" method="post">
91
+ <%= csrf_tag %>
92
+ <input class='btn btn-danger' type="submit" name="delete" value="<%= t('Delete') %>" data-confirm="<%= t('AreYouSureDeleteCronJob', :job => job.name) %>"/>
93
+ </form>
94
+ <% end %>
95
+ </div>
96
+ </td>
97
+ </tr>
98
+ <% end %>
99
+ </tbody>
100
+ </table>
101
+ <% else %>
102
+ <div class='alert alert-success'><%= t('NoCronJobsWereFound') %></div>
103
+ <% end %>
104
+ </section>
@@ -1,92 +1,93 @@
1
- <header class="row">
2
- <div class="span col-sm-5 pull-left">
3
- <h3>
4
- <%= "#{t('Cron')} #{t('Job')}" %>
5
- <small><%= @job.name %></small>
6
- </h3>
7
- </div>
8
- <div class="span col-sm-7 pull-right h2">
1
+ <section>
2
+ <header>
3
+ <div>
4
+ <h2>
5
+ <%= "#{t('Cron')} #{t('Job')}" %>
6
+ <small><%= @job.name %></small>
7
+ </h2>
8
+ </div>
9
9
  <% cron_job_path = "#{root_path}cron/namespaces/#{@current_namespace}/jobs/#{CGI.escape(@job.name).gsub('+', '%20')}" %>
10
- <form action="<%= cron_job_path %>/enqueue?redirect=<%= cron_job_path %>" class="pull-right" method="post">
11
- <%= csrf_tag %>
12
- <input class="btn btn-warn pull-left" name="enqueue" type="submit" value="<%= t('EnqueueNow') %>" data-confirm="<%= t('AreYouSureEnqueueCronJob', :job => @job.name) %>" />
13
- </form>
14
- <% if @job.status == 'enabled' %>
15
- <form action="<%= cron_job_path %>/disable?redirect=<%= cron_job_path %>" class="pull-right" method="post">
10
+ <div class="filter buttons-row">
11
+ <form action="<%= cron_job_path %>/enqueue?redirect=<%= cron_job_path %>" method="post">
16
12
  <%= csrf_tag %>
17
- <input class="btn btn-warn pull-left" name="disable" type="submit" value="<%= t('Disable') %>" />
13
+ <input class="btn btn-primary" name="enqueue" type="submit" value="<%= t('EnqueueNow') %>" data-confirm="<%= t('AreYouSureEnqueueCronJob', :job => @job.name) %>" />
18
14
  </form>
19
- <% else %>
20
- <form action="<%= cron_job_path %>/enable?redirect=<%= cron_job_path %>" class="pull-right" method="post">
21
- <%= csrf_tag %>
22
- <input class="btn btn-warn pull-left" name="enable" type="submit" value="<%= t('Enable') %>" />
23
- </form>
24
- <form action="<%= cron_job_path %>/delete" class="pull-right" method="post">
25
- <%= csrf_tag %>
26
- <input class="btn btn-danger pull-left" data-confirm="<%= t('AreYouSureDeleteCronJob', :job => @job.name) %>" name="delete" type="submit" value="<%= t('Delete') %>" />
27
- </form>
28
- <% end %>
29
- </div>
30
- </header>
31
-
32
- <table class="table table-bordered table-striped">
33
- <tbody>
34
- <tr>
35
- <th><%= t 'Status' %></th>
36
- <td><%= @job.status %></td>
37
- </tr>
38
- <tr>
39
- <th><%= t 'Name' %></th>
40
- <td><%= @job.name %></td>
41
- </tr>
42
- <tr>
43
- <th><%= t 'Namespace' %></th>
44
- <td><%= @job.namespace %></td>
45
- </tr>
46
- <tr>
47
- <th><%= t 'Description' %></th>
48
- <td><%= @job.description %></td>
49
- </tr>
50
- <tr>
51
- <th><%= t 'Message' %></th>
52
- <td><pre><%= @job.pretty_message %></pre></td>
53
- </tr>
54
- <tr>
55
- <th><%= t 'Cron' %></th>
56
- <td><%= @job.cron.gsub(" ", "&nbsp;") %></td>
57
- </tr>
58
- <tr>
59
- <th><%= t 'Last enqueued' %></th>
60
- <td><%= @job.last_enqueue_time ? relative_time(@job.last_enqueue_time) : "-" %></td>
61
- </tr>
62
- </tbody>
63
- </table>
64
-
65
- <header class="row">
66
- <div class="col-sm-12">
67
- <h4>
68
- <%= t 'History' %>
69
- </h4>
70
- </div>
71
- </header>
72
-
73
- <% if @job.jid_history_from_redis.size > 0 %>
74
- <table class="table table-hover table-bordered table-striped">
75
- <thead>
76
- <tr>
77
- <th><%= t 'Enqueued' %></th>
78
- <th><%= t 'JID' %></th>
79
- </tr>
80
- </thead>
15
+ <% if @job.status == 'enabled' %>
16
+ <form action="<%= cron_job_path %>/disable?redirect=<%= cron_job_path %>" method="post">
17
+ <%= csrf_tag %>
18
+ <input class="btn btn-primary" name="disable" type="submit" value="<%= t('Disable') %>" />
19
+ </form>
20
+ <% else %>
21
+ <form action="<%= cron_job_path %>/enable?redirect=<%= cron_job_path %>" method="post">
22
+ <%= csrf_tag %>
23
+ <input class="btn btn-primary" name="enable" type="submit" value="<%= t('Enable') %>" />
24
+ </form>
25
+ <form action="<%= cron_job_path %>/delete" method="post">
26
+ <%= csrf_tag %>
27
+ <input class="btn btn-danger" data-confirm="<%= t('AreYouSureDeleteCronJob', :job => @job.name) %>" name="delete" type="submit" value="<%= t('Delete') %>" />
28
+ </form>
29
+ <% end %>
30
+ </div>
31
+ </header>
32
+ <table class="table table-bordered table-striped">
81
33
  <tbody>
82
- <% @job.jid_history_from_redis.each do |jid_history| %>
83
34
  <tr>
84
- <td><%= jid_history['enqueued'] %></td>
85
- <td><%= jid_history['jid'] %></td>
35
+ <th><%= t 'Status' %></th>
36
+ <td><%= @job.status %></td>
37
+ </tr>
38
+ <tr>
39
+ <th><%= t 'Name' %></th>
40
+ <td><%= @job.name %></td>
41
+ </tr>
42
+ <tr>
43
+ <th><%= t 'Namespace' %></th>
44
+ <td><%= @job.namespace %></td>
45
+ </tr>
46
+ <tr>
47
+ <th><%= t 'Description' %></th>
48
+ <td><%= @job.description %></td>
49
+ </tr>
50
+ <tr>
51
+ <th><%= t 'Message' %></th>
52
+ <td>
53
+ <pre><%= @job.pretty_message %></pre>
54
+ </td>
55
+ </tr>
56
+ <tr>
57
+ <th><%= t 'Cron' %></th>
58
+ <td><%= @job.cron.gsub(" ", "&nbsp;") %></td>
59
+ </tr>
60
+ <tr>
61
+ <th><%= t 'Last enqueued' %></th>
62
+ <td><%= @job.last_enqueue_time ? relative_time(@job.last_enqueue_time) : "-" %></td>
86
63
  </tr>
87
- <% end %>
88
64
  </tbody>
89
65
  </table>
90
- <% else %>
91
- <div class='alert alert-success'><%= t 'NoHistoryWereFound' %></div>
92
- <% end %>
66
+ <header>
67
+ <div>
68
+ <h4>
69
+ <%= t 'History' %>
70
+ </h4>
71
+ </div>
72
+ </header>
73
+ <% if @job.jid_history_from_redis.size > 0 %>
74
+ <table class="table table-hover table-bordered table-striped">
75
+ <thead>
76
+ <tr>
77
+ <th><%= t 'Enqueued' %></th>
78
+ <th><%= t 'JID' %></th>
79
+ </tr>
80
+ </thead>
81
+ <tbody>
82
+ <% @job.jid_history_from_redis.each do |jid_history| %>
83
+ <tr>
84
+ <td><%= jid_history['enqueued'] %></td>
85
+ <td><%= jid_history['jid'] %></td>
86
+ </tr>
87
+ <% end %>
88
+ </tbody>
89
+ </table>
90
+ <% else %>
91
+ <div class='alert alert-success'><%= t 'NoHistoryWereFound' %></div>
92
+ <% end %>
93
+ </section>
@@ -0,0 +1,114 @@
1
+ <header class='row'>
2
+ <div class='col-sm-5 pull-left'>
3
+ <h3>
4
+ <%= t('CronJobs') %>
5
+ <small><%= CGI.escapeHTML(@current_namespace.to_s) %></small>
6
+ </h3>
7
+ </div>
8
+ <div class='col-sm-7 pull-right h2'>
9
+ <% if @cron_jobs.size > 0 %>
10
+ <% escaped_current_namespace = CGI.escape(@current_namespace) %>
11
+ <form action="<%= root_path %>cron/namespaces/<%= escaped_current_namespace %>/all/delete" method="post" class="pull-right">
12
+ <%= csrf_tag %>
13
+ <input class="btn btn-danger" type="submit" name="delete" value="<%= t('DeleteAll') %>" data-confirm="<%= t('AreYouSureDeleteCronJobs') %>" />
14
+ </form>
15
+ <form action="<%= root_path %>cron/namespaces/<%= escaped_current_namespace %>/all/disable" method="post" class="pull-right">
16
+ <%= csrf_tag %>
17
+ <input class="btn btn-warn" type="submit" name="enqueue" value="<%= t('DisableAll') %>" />
18
+ </form>
19
+ <form action="<%= root_path %>cron/namespaces/<%= escaped_current_namespace %>/all/enable" method="post" class="pull-right">
20
+ <%= csrf_tag %>
21
+ <input class="btn btn-warn" type="submit" name="enqueue" value="<%= t('EnableAll') %>" />
22
+ </form>
23
+ <form action="<%= root_path %>cron/namespaces/<%= escaped_current_namespace %>/all/enqueue" method="post" class="pull-right">
24
+ <%= csrf_tag %>
25
+ <input class="btn btn-warn" type="submit" name="enqueue" value="<%= t('EnqueueAll') %>" data-confirm="<%= t('AreYouSureEnqueueCronJobs') %>" />
26
+ </form>
27
+ <% end %>
28
+ </div>
29
+ </header>
30
+
31
+ <!-- Namespaces -->
32
+ <div class='row'>
33
+ <div class="col-sm-12 summary_bar">
34
+ <ul class="list-unstyled summary row">
35
+ <% Sidekiq::Cron::Namespace.all_with_count.sort_by { |namespace| namespace[:name] }.each do |namespace| %>
36
+ <li class="col-sm-1">
37
+ <a href="<%= root_path %>cron/namespaces/<%= namespace[:name] %>">
38
+ <span class="count"><%= namespace[:count] %></span>
39
+ <span class="desc"><%= namespace[:name] %></span>
40
+ </a>
41
+ </li>
42
+ <% end %>
43
+ </ul>
44
+ </div>
45
+ </div>
46
+ <!-- Namespaces -->
47
+
48
+ <% if @cron_jobs.size > 0 %>
49
+ <table class="table table-hover table-bordered table-striped table-white">
50
+ <thead>
51
+ <tr>
52
+ <th><%= t('Status') %></th>
53
+ <th width="50%"><%= t('Name') %></th>
54
+ <th><%= t('CronString') %></th>
55
+ <th><%= t('LastEnqueued') %></th>
56
+ <th width="180"><%= t('Actions') %></th>
57
+ </tr>
58
+ </thead>
59
+
60
+ <tbody>
61
+ <% @cron_jobs.sort{ |a,b| a.sort_name <=> b.sort_name }.each do |job| %>
62
+ <% klass = (job.status == 'disabled') ? 'bg-danger text-muted' : '' %>
63
+ <% escaped_job_name = CGI.escape(job.name).gsub('+', '%20') %>
64
+ <tr>
65
+ <td class="<%= klass %>"><%= t job.status %></td>
66
+ <td class="<%= klass %>">
67
+ <a href="<%= root_path %>cron/namespaces/<%= job.namespace %>/jobs/<%= escaped_job_name %>" title="<%= job.description %>">
68
+ <b class="<%= klass %>"><%= job.name %></b>
69
+ </a>
70
+ <br/>
71
+ <% if job.message and job.message.to_s.size > 100 %>
72
+ <details>
73
+ <summary class="btn btn-warn btn-xs">Show message</summary>
74
+ <p><small><%= job.message %></small></p>
75
+ </details>
76
+ <% else %>
77
+ <small><%= job.message %></small>
78
+ <% end %>
79
+ </td>
80
+ <td class="<%= klass %>"><b><%= job.human_cron %><br/><small><%= job.cron_expression_string.gsub(" ", "&nbsp;") %></small></b></td>
81
+ <td class="<%= klass %>"><%= job.last_enqueue_time ? relative_time(job.last_enqueue_time) : "-" %></td>
82
+ <td class="<%= klass %>">
83
+ <% if job.status == 'enabled' %>
84
+ <form action="<%= root_path %>cron/namespaces/<%= job.namespace %>/jobs/<%= escaped_job_name %>/enqueue" method="post">
85
+ <%= csrf_tag %>
86
+ <input class='btn btn-warn btn-xs pull-left' type="submit" name="enqueue" value="<%= t('EnqueueNow') %>" data-confirm="<%= t('AreYouSureEnqueueCronJob', :job => job.name) %>"/>
87
+ </form>
88
+ <form action="<%= root_path %>cron/namespaces/<%= job.namespace %>/jobs/<%= escaped_job_name %>/disable" method="post">
89
+ <%= csrf_tag %>
90
+ <input class='btn btn-warn btn-xs pull-left' type="submit" name="disable" value="<%= t('Disable') %>"/>
91
+ </form>
92
+ <% else %>
93
+ <form action="<%= root_path %>cron/namespaces/<%= job.namespace %>/jobs/<%= escaped_job_name %>/enqueue" method="post">
94
+ <%= csrf_tag %>
95
+ <input class='btn btn-warn btn-xs pull-left' type="submit" name="enqueue" value="<%= t('EnqueueNow') %>" data-confirm="<%= t('AreYouSureEnqueueCronJob', :job => job.name) %>"/>
96
+ </form>
97
+ <form action="<%= root_path %>cron/namespaces/<%= job.namespace %>/jobs/<%= escaped_job_name %>/enable" method="post">
98
+ <%= csrf_tag %>
99
+ <input class='btn btn-warn btn-xs pull-left' type="submit" name="enable" value="<%= t('Enable') %>"/>
100
+ </form>
101
+ <form action="<%= root_path %>cron/namespaces/<%= job.namespace %>/jobs/<%= escaped_job_name %>/delete" method="post">
102
+ <%= csrf_tag %>
103
+ <input class='btn btn-xs btn-danger pull-left help-block' type="submit" name="delete" value="<%= t('Delete') %>" data-confirm="<%= t('AreYouSureDeleteCronJob', :job => job.name) %>"/>
104
+ </form>
105
+ <% end %>
106
+ </td>
107
+ </tr>
108
+ <% end %>
109
+ </tbody>
110
+ </table>
111
+ <% else %>
112
+ <div class='alert alert-success'><%= t('NoCronJobsWereFound') %></div>
113
+ <% end %>
114
+
@@ -0,0 +1,92 @@
1
+ <header class="row">
2
+ <div class="span col-sm-5 pull-left">
3
+ <h3>
4
+ <%= "#{t('Cron')} #{t('Job')}" %>
5
+ <small><%= @job.name %></small>
6
+ </h3>
7
+ </div>
8
+ <div class="span col-sm-7 pull-right h2">
9
+ <% cron_job_path = "#{root_path}cron/namespaces/#{@current_namespace}/jobs/#{CGI.escape(@job.name).gsub('+', '%20')}" %>
10
+ <form action="<%= cron_job_path %>/enqueue?redirect=<%= cron_job_path %>" class="pull-right" method="post">
11
+ <%= csrf_tag %>
12
+ <input class="btn btn-warn pull-left" name="enqueue" type="submit" value="<%= t('EnqueueNow') %>" data-confirm="<%= t('AreYouSureEnqueueCronJob', :job => @job.name) %>" />
13
+ </form>
14
+ <% if @job.status == 'enabled' %>
15
+ <form action="<%= cron_job_path %>/disable?redirect=<%= cron_job_path %>" class="pull-right" method="post">
16
+ <%= csrf_tag %>
17
+ <input class="btn btn-warn pull-left" name="disable" type="submit" value="<%= t('Disable') %>" />
18
+ </form>
19
+ <% else %>
20
+ <form action="<%= cron_job_path %>/enable?redirect=<%= cron_job_path %>" class="pull-right" method="post">
21
+ <%= csrf_tag %>
22
+ <input class="btn btn-warn pull-left" name="enable" type="submit" value="<%= t('Enable') %>" />
23
+ </form>
24
+ <form action="<%= cron_job_path %>/delete" class="pull-right" method="post">
25
+ <%= csrf_tag %>
26
+ <input class="btn btn-danger pull-left" data-confirm="<%= t('AreYouSureDeleteCronJob', :job => @job.name) %>" name="delete" type="submit" value="<%= t('Delete') %>" />
27
+ </form>
28
+ <% end %>
29
+ </div>
30
+ </header>
31
+
32
+ <table class="table table-bordered table-striped">
33
+ <tbody>
34
+ <tr>
35
+ <th><%= t 'Status' %></th>
36
+ <td><%= @job.status %></td>
37
+ </tr>
38
+ <tr>
39
+ <th><%= t 'Name' %></th>
40
+ <td><%= @job.name %></td>
41
+ </tr>
42
+ <tr>
43
+ <th><%= t 'Namespace' %></th>
44
+ <td><%= @job.namespace %></td>
45
+ </tr>
46
+ <tr>
47
+ <th><%= t 'Description' %></th>
48
+ <td><%= @job.description %></td>
49
+ </tr>
50
+ <tr>
51
+ <th><%= t 'Message' %></th>
52
+ <td><pre><%= @job.pretty_message %></pre></td>
53
+ </tr>
54
+ <tr>
55
+ <th><%= t 'Cron' %></th>
56
+ <td><%= @job.cron.gsub(" ", "&nbsp;") %></td>
57
+ </tr>
58
+ <tr>
59
+ <th><%= t 'Last enqueued' %></th>
60
+ <td><%= @job.last_enqueue_time ? relative_time(@job.last_enqueue_time) : "-" %></td>
61
+ </tr>
62
+ </tbody>
63
+ </table>
64
+
65
+ <header class="row">
66
+ <div class="col-sm-12">
67
+ <h4>
68
+ <%= t 'History' %>
69
+ </h4>
70
+ </div>
71
+ </header>
72
+
73
+ <% if @job.jid_history_from_redis.size > 0 %>
74
+ <table class="table table-hover table-bordered table-striped">
75
+ <thead>
76
+ <tr>
77
+ <th><%= t 'Enqueued' %></th>
78
+ <th><%= t 'JID' %></th>
79
+ </tr>
80
+ </thead>
81
+ <tbody>
82
+ <% @job.jid_history_from_redis.each do |jid_history| %>
83
+ <tr>
84
+ <td><%= jid_history['enqueued'] %></td>
85
+ <td><%= jid_history['jid'] %></td>
86
+ </tr>
87
+ <% end %>
88
+ </tbody>
89
+ </table>
90
+ <% else %>
91
+ <div class='alert alert-success'><%= t 'NoHistoryWereFound' %></div>
92
+ <% end %>
@@ -3,7 +3,16 @@ require "sidekiq/cron/job"
3
3
  require "sidekiq/cron/namespace"
4
4
 
5
5
  if defined?(Sidekiq::Web)
6
- if Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new('7.3.0')
6
+ if Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new('8.0.0')
7
+ Sidekiq::Web.configure do |config|
8
+ config.register(
9
+ Sidekiq::Cron::WebExtension, # Class which contains the HTTP actions, required
10
+ name: "cron", # the name of the extension, used to namespace assets
11
+ tab: "Cron", # labels(s) of the UI tabs
12
+ index: "cron", # index route(s) for each tab
13
+ )
14
+ end
15
+ elsif Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new('7.3.0')
7
16
  Sidekiq::Web.register(
8
17
  Sidekiq::Cron::WebExtension, # Class which contains the HTTP actions, required
9
18
  name: "cron", # the name of the extension, used to namespace assets