sidekiq 7.3.8 → 8.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/Changes.md +24 -0
  3. data/README.md +16 -13
  4. data/bin/sidekiqload +10 -10
  5. data/bin/webload +69 -0
  6. data/lib/active_job/queue_adapters/sidekiq_adapter.rb +5 -18
  7. data/lib/sidekiq/api.rb +108 -36
  8. data/lib/sidekiq/capsule.rb +1 -1
  9. data/lib/sidekiq/cli.rb +15 -19
  10. data/lib/sidekiq/client.rb +13 -16
  11. data/lib/sidekiq/component.rb +30 -2
  12. data/lib/sidekiq/config.rb +18 -15
  13. data/lib/sidekiq/embedded.rb +1 -0
  14. data/lib/sidekiq/job/iterable.rb +3 -5
  15. data/lib/sidekiq/job_retry.rb +2 -2
  16. data/lib/sidekiq/job_util.rb +5 -1
  17. data/lib/sidekiq/launcher.rb +1 -1
  18. data/lib/sidekiq/logger.rb +6 -10
  19. data/lib/sidekiq/manager.rb +0 -1
  20. data/lib/sidekiq/metrics/query.rb +1 -3
  21. data/lib/sidekiq/middleware/current_attributes.rb +5 -17
  22. data/lib/sidekiq/paginator.rb +8 -1
  23. data/lib/sidekiq/processor.rb +21 -14
  24. data/lib/sidekiq/profiler.rb +59 -0
  25. data/lib/sidekiq/rails.rb +12 -2
  26. data/lib/sidekiq/redis_client_adapter.rb +0 -1
  27. data/lib/sidekiq/testing.rb +2 -2
  28. data/lib/sidekiq/version.rb +2 -2
  29. data/lib/sidekiq/web/action.rb +101 -85
  30. data/lib/sidekiq/web/application.rb +339 -333
  31. data/lib/sidekiq/web/config.rb +116 -0
  32. data/lib/sidekiq/web/helpers.rb +40 -15
  33. data/lib/sidekiq/web/router.rb +60 -76
  34. data/lib/sidekiq/web.rb +51 -156
  35. data/sidekiq.gemspec +5 -4
  36. data/web/assets/javascripts/application.js +6 -13
  37. data/web/assets/javascripts/base-charts.js +30 -18
  38. data/web/assets/javascripts/dashboard-charts.js +2 -0
  39. data/web/assets/javascripts/dashboard.js +6 -0
  40. data/web/assets/javascripts/metrics.js +1 -1
  41. data/web/assets/stylesheets/style.css +750 -0
  42. data/web/locales/ar.yml +1 -0
  43. data/web/locales/cs.yml +1 -0
  44. data/web/locales/da.yml +1 -0
  45. data/web/locales/de.yml +1 -0
  46. data/web/locales/el.yml +1 -0
  47. data/web/locales/en.yml +9 -0
  48. data/web/locales/es.yml +24 -2
  49. data/web/locales/fa.yml +1 -0
  50. data/web/locales/fr.yml +1 -0
  51. data/web/locales/gd.yml +1 -0
  52. data/web/locales/he.yml +1 -0
  53. data/web/locales/hi.yml +1 -0
  54. data/web/locales/it.yml +1 -0
  55. data/web/locales/ja.yml +1 -0
  56. data/web/locales/ko.yml +1 -0
  57. data/web/locales/lt.yml +1 -0
  58. data/web/locales/nb.yml +1 -0
  59. data/web/locales/nl.yml +1 -0
  60. data/web/locales/pl.yml +1 -0
  61. data/web/locales/{pt-br.yml → pt-BR.yml} +2 -1
  62. data/web/locales/pt.yml +1 -0
  63. data/web/locales/ru.yml +1 -0
  64. data/web/locales/sv.yml +1 -0
  65. data/web/locales/ta.yml +1 -0
  66. data/web/locales/tr.yml +1 -0
  67. data/web/locales/uk.yml +1 -0
  68. data/web/locales/ur.yml +1 -0
  69. data/web/locales/vi.yml +1 -0
  70. data/web/locales/{zh-cn.yml → zh-CN.yml} +85 -73
  71. data/web/locales/{zh-tw.yml → zh-TW.yml} +2 -1
  72. data/web/views/_footer.erb +31 -34
  73. data/web/views/_job_info.erb +91 -89
  74. data/web/views/_metrics_period_select.erb +1 -1
  75. data/web/views/_nav.erb +14 -21
  76. data/web/views/_paging.erb +23 -21
  77. data/web/views/_poll_link.erb +2 -2
  78. data/web/views/_summary.erb +16 -16
  79. data/web/views/busy.erb +124 -122
  80. data/web/views/dashboard.erb +62 -64
  81. data/web/views/dead.erb +31 -27
  82. data/web/views/filtering.erb +3 -3
  83. data/web/views/layout.erb +5 -21
  84. data/web/views/metrics.erb +83 -80
  85. data/web/views/metrics_for_job.erb +39 -42
  86. data/web/views/morgue.erb +61 -70
  87. data/web/views/profiles.erb +43 -0
  88. data/web/views/queue.erb +54 -52
  89. data/web/views/queues.erb +43 -41
  90. data/web/views/retries.erb +66 -75
  91. data/web/views/retry.erb +32 -27
  92. data/web/views/scheduled.erb +58 -54
  93. data/web/views/scheduled_job_info.erb +1 -1
  94. metadata +32 -22
  95. data/web/assets/stylesheets/application-dark.css +0 -147
  96. data/web/assets/stylesheets/application-rtl.css +0 -163
  97. data/web/assets/stylesheets/application.css +0 -759
  98. data/web/assets/stylesheets/bootstrap-rtl.min.css +0 -9
  99. data/web/assets/stylesheets/bootstrap.css +0 -5
  100. data/web/views/_status.erb +0 -4
@@ -2,89 +2,92 @@
2
2
  <script type="text/javascript" src="<%= root_path %>javascripts/chartjs-plugin-annotation.min.js" nonce="<%= csp_nonce %>"></script>
3
3
  <script type="text/javascript" src="<%= root_path %>javascripts/base-charts.js" nonce="<%= csp_nonce %>"></script>
4
4
 
5
- <div class="header-container">
6
- <div class="page-title-container">
7
- <h1><%= t('Metrics') %></h1>
8
- <a target="blank" href="https://github.com/sidekiq/sidekiq/wiki/Metrics"><span class="info-circle" title="Click to learn more about metrics">?</span></a>
9
- </div>
10
-
11
- <div>
12
- <form id="metrics-form" class="form-inline" action="<%= root_path %>metrics" method="get">
13
- <label for="substr"><%= t('Filter') %></label>
14
- <input id="class-filter" class="form-control" type="text" name="substr" placeholder="<%= t('Name') %>" value="<%= h params[:substr] %>">
15
- <select id="period-selector" class="form-control" name="period">
16
- <% @periods.each_key do |code| %>
17
- <% if code == @period %>
18
- <option selected value="<%= code %>"><%= code %></option>
19
- <% else %>
20
- <option value="<%= code %>"><%= code %></option>
5
+ <section>
6
+ <header>
7
+ <h1>
8
+ <%= t('Metrics') %>
9
+ <a target="blank" href="https://github.com/sidekiq/sidekiq/wiki/Metrics"><span class="info-circle" title="Click to learn more about metrics">?</span></a>
10
+ </h1>
11
+
12
+ <div class="filter">
13
+ <form id="metrics-form" class="form-inline" action="<%= root_path %>metrics" method="get">
14
+ <label for="substr"><%= t('Filter') %></label>
15
+ <input id="class-filter" class="form-control" type="text" name="substr" placeholder="<%= t('Name') %>" value="<%= h url_params("substr") %>">
16
+ <select id="period-selector" class="form-control" name="period">
17
+ <% @periods.each_key do |code| %>
18
+ <% if code == @period %>
19
+ <option selected value="<%= code %>"><%= code %></option>
20
+ <% else %>
21
+ <option value="<%= code %>"><%= code %></option>
22
+ <% end %>
21
23
  <% end %>
22
- <% end %>
23
- </select>
24
- </form>
25
- </div>
26
- </div>
24
+ </select>
25
+ </form>
26
+ </div>
27
+ </header>
27
28
 
28
- <%
29
- table_limit = 20
30
- chart_limit = 5
31
- job_results = @query_result.job_results.sort_by { |(kls, jr)| jr.totals["s"] }.reverse.first(table_limit)
32
- visible_kls = job_results.first(chart_limit).map(&:first)
33
- %>
29
+ <%
30
+ table_limit = 20
31
+ chart_limit = 5
32
+ job_results = @query_result.job_results.sort_by { |(kls, jr)| jr.totals["s"] }.reverse.first(table_limit)
33
+ visible_kls = job_results.first(chart_limit).map(&:first)
34
+ %>
34
35
 
35
- <% if job_results.any? %>
36
- <canvas id="job-metrics-overview-chart">
37
- <%= to_json({
38
- series: job_results.map { |(kls, jr)| [kls, jr.dig("series", "s")] }.to_h,
39
- marks: @query_result.marks.map { |m| [m.bucket, m.label] },
40
- labels: @query_result.buckets,
41
- visibleKls: visible_kls,
42
- yLabel: t('TotalExecutionTime'),
43
- units: t('Seconds').downcase,
44
- markLabel: t('Deploy'),
45
- }) %>
46
- </canvas>
47
- <% end %>
36
+ <% if job_results.any? %>
37
+ <canvas id="job-metrics-overview-chart">
38
+ <%= to_json({
39
+ series: job_results.map { |(kls, jr)| [kls, jr.dig("series", "s")] }.to_h,
40
+ marks: @query_result.marks.map { |m| [m.bucket, m.label] },
41
+ labels: @query_result.buckets,
42
+ visibleKls: visible_kls,
43
+ yLabel: t('TotalExecutionTime'),
44
+ units: t('Seconds').downcase,
45
+ markLabel: t('Deploy'),
46
+ }) %>
47
+ </canvas>
48
+ <% end %>
48
49
 
49
- <div class="table_container">
50
- <table class="table table-bordered table-striped table-hover">
51
- <tbody>
52
- <tr>
53
- <th><%= t('Name') %></th>
54
- <th><%= t('Success') %></th>
55
- <th><%= t('Failure') %></th>
56
- <th><%= t('TotalExecutionTime') %> (<%= t('Seconds') %>)</th>
57
- <th><%= t('AvgExecutionTime') %> (<%= t('Seconds') %>)</th>
58
- </tr>
59
- <% if job_results.any? %>
60
- <% job_results.each_with_index do |(kls, jr), i| %>
61
- <tr>
62
- <td>
63
- <div class="metrics-swatch-wrapper">
64
- <% id = "metrics-swatch-#{kls}" %>
65
- <input
66
- type="checkbox"
67
- id="<%= id %>"
68
- class="metrics-swatch"
69
- value="<%= kls %>"
70
- <%= visible_kls.include?(kls) ? 'checked' : '' %>
71
- />
72
- <code><a href="<%= root_path %>metrics/<%= kls %>?period=<%= @period %>"><%= kls %></a></code>
73
- </div>
74
- </td>
75
- <td class="num"><%= number_with_delimiter(jr.dig("totals", "p") - jr.dig("totals", "f")) %></td>
76
- <td class="num"><%= number_with_delimiter(jr.dig("totals", "f")) %></td>
77
- <td class="num"><%= number_with_delimiter(jr.dig("totals", "s"), precision: 2) %></td>
78
- <td class="num"><%= number_with_delimiter(jr.total_avg("s"), precision: 2) %></td>
79
- </tr>
50
+ <div class="table_container">
51
+ <table>
52
+ <thead>
53
+ <tr>
54
+ <th><%= t('Name') %></th>
55
+ <th><%= t('Success') %></th>
56
+ <th><%= t('Failure') %></th>
57
+ <th><%= t('TotalExecutionTime') %> (<%= t('Seconds') %>)</th>
58
+ <th><%= t('AvgExecutionTime') %> (<%= t('Seconds') %>)</th>
59
+ </tr>
60
+ </thead>
61
+ <tbody>
62
+ <% if job_results.any? %>
63
+ <% job_results.each_with_index do |(kls, jr), i| %>
64
+ <tr>
65
+ <td>
66
+ <div class="metrics-swatch-wrapper">
67
+ <% id = "metrics-swatch-#{kls}" %>
68
+ <input
69
+ type="checkbox"
70
+ id="<%= id %>"
71
+ class="metrics-swatch"
72
+ value="<%= kls %>"
73
+ <%= visible_kls.include?(kls) ? 'checked' : '' %>
74
+ />
75
+ <code><a href="<%= root_path %>metrics/<%= kls %>?period=<%= @period %>"><%= kls %></a></code>
76
+ </div>
77
+ </td>
78
+ <td class="num"><%= number_with_delimiter(jr.dig("totals", "p") - jr.dig("totals", "f")) %></td>
79
+ <td class="num"><%= number_with_delimiter(jr.dig("totals", "f")) %></td>
80
+ <td class="num"><%= number_with_delimiter(jr.dig("totals", "s"), precision: 2) %></td>
81
+ <td class="num"><%= number_with_delimiter(jr.total_avg("s"), precision: 2) %></td>
82
+ </tr>
83
+ <% end %>
84
+ <% else %>
85
+ <tr><td colspan=5><%= t("NoDataFound") %></td></tr>
80
86
  <% end %>
81
- <% else %>
82
- <tr><td colspan=5><%= t("NoDataFound") %></td></tr>
83
- <% end %>
84
- </tbody>
85
- </table>
86
- </div>
87
-
88
- <!--p><small>Data from <%= @query_result.starts_at %> to <%= @query_result.ends_at %></small></p-->
87
+ </tbody>
88
+ </table>
89
+ </div>
89
90
 
90
- <script type="text/javascript" src="<%= root_path %>javascripts/metrics.js" nonce="<%= csp_nonce %>"></script>
91
+ <!--p><small>Data from <%= @query_result.starts_at %> to <%= @query_result.ends_at %></small></p-->
92
+ </section>
93
+ <script type="text/javascript" src="<%= root_path %>javascripts/metrics.js" nonce="<%= csp_nonce %>"></script>
@@ -8,52 +8,49 @@
8
8
  bucket_labels = Sidekiq::Metrics::Histogram::LABELS
9
9
  bucket_intervals = Sidekiq::Metrics::Histogram::BUCKET_INTERVALS
10
10
  %>
11
-
12
- <% if job_result.totals["s"] > 0 %>
13
- <div class="header-container">
14
- <div class="page-title-container">
11
+ <section>
12
+ <% if job_result.totals["s"] > 0 %>
13
+ <header>
15
14
  <h1>
16
15
  <a href="<%= root_path %>metrics?period=<%= @period %>"><%= t('Metrics') %></a> /
17
16
  <%= h @name %>
17
+ <a target="blank" href="https://github.com/sidekiq/sidekiq/wiki/Metrics"><span class="info-circle" title="Click to learn more about metrics">?</span></a>
18
18
  </h1>
19
-
20
- <a target="blank" href="https://github.com/sidekiq/sidekiq/wiki/Metrics"><span class="info-circle" title="Click to learn more about metrics">?</span></a>
21
- </div>
22
-
23
- <%= erb :_metrics_period_select, locals: { periods: @periods, period: @period, path: "#{root_path}metrics/#{@name}" } %>
24
- </div>
25
-
26
- <canvas id="hist-totals-chart">
27
- <%= to_json({
28
- series: hist_totals,
29
- labels: bucket_labels,
30
- xLabel: t('ExecutionTime'),
31
- yLabel: t('Jobs'),
32
- units: t('Jobs').downcase,
33
- }) %>
34
- </canvas>
35
-
36
- <canvas id="hist-bubble-chart">
37
- <%= to_json({
38
- hist: job_result.hist,
39
- marks: @query_result.marks.map { |m| [m.bucket, m.label] },
40
- labels: @query_result.buckets,
41
- histIntervals: bucket_intervals,
42
- yLabel: t('ExecutionTime'),
43
- markLabel: t('Deploy'),
44
- yUnits: t('Seconds').downcase,
45
- zUnits: t('Jobs').downcase,
46
- }) %>
47
- </canvas>
19
+ <%= erb :_metrics_period_select, locals: { periods: @periods, period: @period, path: "#{root_path}metrics/#{@name}" } %>
20
+ </header>
21
+
22
+ <canvas id="hist-totals-chart">
23
+ <%= to_json({
24
+ series: hist_totals,
25
+ labels: bucket_labels,
26
+ xLabel: t('ExecutionTime'),
27
+ yLabel: t('Jobs'),
28
+ units: t('Jobs').downcase,
29
+ }) %>
30
+ </canvas>
31
+
32
+ <canvas id="hist-bubble-chart">
33
+ <%= to_json({
34
+ hist: job_result.hist,
35
+ marks: @query_result.marks.map { |m| [m.bucket, m.label] },
36
+ labels: @query_result.buckets,
37
+ histIntervals: bucket_intervals,
38
+ yLabel: t('ExecutionTime'),
39
+ markLabel: t('Deploy'),
40
+ yUnits: t('Seconds').downcase,
41
+ zUnits: t('Jobs').downcase,
42
+ }) %>
43
+ </canvas>
48
44
 
49
45
  <!--p><small>Data from <%= @query_result.starts_at %> to <%= @query_result.ends_at %></small></p-->
50
- <% else %>
51
- <h1>
52
- <a href="<%= root_path %>/metrics"><%= t('Metrics') %></a> /
53
- <%= h @name %>
54
- </h1>
55
-
56
- <div class="alert alert-success"><%= t('NoJobMetricsFound') %></div>
57
- <% end %>
58
-
46
+ <% else %>
47
+ <header>
48
+ <h1>
49
+ <a href="<%= root_path %>/metrics"><%= t('Metrics') %></a> /
50
+ <%= h @name %>
51
+ </h1>
52
+ </header>
53
+ <div class="alert alert-success"><%= t('NoJobMetricsFound') %></div>
54
+ <% end %>
55
+ </section>
59
56
  <script type="text/javascript" src="<%= root_path %>javascripts/metrics.js" nonce="<%= csp_nonce %>"></script>
data/web/views/morgue.erb CHANGED
@@ -1,74 +1,65 @@
1
- <div class="header-container">
2
- <h1><%= t('DeadJobs') %></h1>
3
- <% if @dead.size > 0 && @total_size > @count %>
4
- <%= erb :_paging, locals: { url: "#{root_path}morgue" } %>
5
- <% end %>
6
- <%= filtering('morgue') %>
7
- </div>
8
-
9
- <% if @dead.size > 0 %>
10
- <form action="<%= root_path %>morgue" method="post">
11
- <%= csrf_tag %>
12
- <div class="table_container">
13
- <table class="table table-striped table-bordered table-hover">
14
- <thead>
15
- <tr>
16
- <th class="table-checkbox checkbox-column">
17
- <label>
18
- <input type="checkbox" class="check_all" />
19
- </label>
20
- </th>
21
- <th><%= t('LastRetry') %></th>
22
- <th><%= t('Queue') %></th>
23
- <th><%= t('Job') %></th>
24
- <th><%= t('Arguments') %></th>
25
- <th><%= t('Error') %></th>
26
- </tr>
27
- </thead>
28
- <% @dead.each do |entry| %>
29
- <tr>
30
- <td class="table-checkbox">
31
- <label>
32
- <input type='checkbox' name='key[]' value='<%= job_params(entry.item, entry.score) %>' class='shift_clickable' />
33
- </label>
34
- </td>
35
- <td>
36
- <a href="<%= root_path %>morgue/<%= job_params(entry.item, entry.score) %>"><%= relative_time(entry.at) %></a>
37
- </td>
38
- <td>
39
- <a href="<%= root_path %>queues/<%= entry.queue %>"><%= entry.queue %></a>
40
- </td>
41
- <td>
42
- <%= entry.display_class %>
43
- <%= display_tags(entry, "morgue") %>
44
- </td>
45
- <td>
46
- <div class="args"><%= display_args(entry.display_args) %></div>
47
- </td>
48
- <td>
49
- <% if entry.error? %>
50
- <div><%= h truncate("#{entry['error_class']}: #{entry['error_message']}", 200) %></div>
51
- <% end %>
52
- </td>
53
- </tr>
54
- <% end %>
55
- </table>
56
- </div>
57
- <input class="btn btn-primary pull-left flip" type="submit" name="retry" value="<%= t('RetryNow') %>" />
58
- <input class="btn btn-danger pull-left flip" type="submit" name="delete" value="<%= t('Delete') %>" />
59
- </form>
1
+ <section>
2
+ <header>
3
+ <h1><%= t('DeadJobs') %></h1>
4
+ <% if @dead.size > 0 && @total_size > @count %>
5
+ <%= erb :_paging, locals: { url: "#{root_path}morgue" } %>
6
+ <% end %>
7
+ <%= filtering('morgue') %>
8
+ </header>
60
9
 
61
- <% unfiltered? do %>
62
- <form action="<%= root_path %>morgue/all/delete" method="post">
63
- <%= csrf_tag %>
64
- <input class="btn btn-danger pull-right flip" type="submit" name="delete" value="<%= t('DeleteAll') %>" data-confirm="<%= t('AreYouSure') %>" />
65
- </form>
66
- <form action="<%= root_path %>morgue/all/retry" method="post">
10
+ <% if @dead.size > 0 %>
11
+ <form action="<%= root_path %>morgue" method="post">
67
12
  <%= csrf_tag %>
68
- <input class="btn btn-danger pull-right flip" type="submit" name="retry" value="<%= t('RetryAll') %>" data-confirm="<%= t('AreYouSure') %>" />
13
+ <div class="table_container">
14
+ <table>
15
+ <thead>
16
+ <tr>
17
+ <th>
18
+ <label>
19
+ <input type="checkbox" class="check_all" />
20
+ </label>
21
+ </th>
22
+ <th><%= t('LastRetry') %></th>
23
+ <th><%= t('Queue') %></th>
24
+ <th><%= t('Job') %></th>
25
+ <th><%= t('Arguments') %></th>
26
+ <th><%= t('Error') %></th>
27
+ </tr>
28
+ </thead>
29
+ <% @dead.each do |entry| %>
30
+ <tr>
31
+ <td>
32
+ <label>
33
+ <input type='checkbox' name='key[]' value='<%= job_params(entry.item, entry.score) %>' class='shift_clickable' />
34
+ </label>
35
+ </td>
36
+ <td>
37
+ <a href="<%= root_path %>morgue/<%= job_params(entry.item, entry.score) %>"><%= relative_time(entry.at) %></a>
38
+ </td>
39
+ <td>
40
+ <a href="<%= root_path %>queues/<%= entry.queue %>"><%= entry.queue %></a>
41
+ </td>
42
+ <td>
43
+ <%= entry.display_class %>
44
+ <%= display_tags(entry, "morgue") %>
45
+ </td>
46
+ <td>
47
+ <div class="args"><%= display_args(entry.display_args) %></div>
48
+ </td>
49
+ <td>
50
+ <% if entry.error? %>
51
+ <div><a href="<%= root_path %>morgue/<%= job_params(entry.item, entry.score) %>"><%= h truncate("#{entry['error_class']}: #{entry['error_message']}", 200) %></a></div>
52
+ <% end %>
53
+ </td>
54
+ </tr>
55
+ <% end %>
56
+ </table>
57
+ </div>
58
+ <input class="btn btn-primary pull-left flip" type="submit" name="retry" value="<%= t('RetryNow') %>" />
59
+ <input class="btn btn-danger pull-left flip" type="submit" name="delete" value="<%= t('Delete') %>" />
69
60
  </form>
70
- <% end %>
71
61
 
72
- <% else %>
73
- <div class="alert alert-success"><%= t('NoDeadJobsFound') %></div>
74
- <% end %>
62
+ <% else %>
63
+ <div class="alert alert-success"><%= t('NoDeadJobsFound') %></div>
64
+ <% end %>
65
+ </section>
@@ -0,0 +1,43 @@
1
+ <section>
2
+ <header>
3
+ <h1>
4
+ <%= t('Profiles') %>
5
+ <a target="blank" href="https://github.com/sidekiq/sidekiq/wiki/Profiling"><span class="info-circle" title="Click to learn more about profiling">?</span></a>
6
+ </h1>
7
+ </header>
8
+
9
+ <% @profiles = Sidekiq::ProfileSet.new %>
10
+ <% if @profiles.size > 0 %>
11
+ <div class="table_container">
12
+ <table>
13
+ <thead>
14
+ <th><%= t('CreatedAt') %></th>
15
+ <th><%= t('Type') %></th>
16
+ <th><%= t('JID') %></th>
17
+ <th><%= t('Token') %></th>
18
+ <th><%= t('Size') %></th>
19
+ <th><%= t('ElapsedTime') %></th>
20
+ <th>&nbsp</th>
21
+ </thead>
22
+ <% @profiles.each do |record| %>
23
+ <tr>
24
+ <td><%= relative_time(record.started_at) %></td>
25
+ <td><%= record.type %> </td>
26
+ <td><%= record.jid %> </td>
27
+ <td><%= record.token %> </td>
28
+ <td><%= format_memory(record.size / 1024) %> </td>
29
+ <td><%= number_with_delimiter(record.elapsed, precision: 2) %> </td>
30
+ <td>
31
+ <% if config[:profile_store_url] %>
32
+ <a target="_blank" class="btn" href="<%= root_path %>profiles/<%= CGI.escape(record.key) %>"><%= t("View") %></a>
33
+ <% end %>
34
+ <a class="btn" href="<%= root_path %>profiles/<%= CGI.escape(record.key) %>/data"><%= t("Data") %></a>
35
+ </td>
36
+ </tr>
37
+ <% end %>
38
+ </table>
39
+ </div>
40
+ <% else %>
41
+ <div class="alert alert-success"><%= t('NoDataFound') %></div>
42
+ <% end %>
43
+ </section>
data/web/views/queue.erb CHANGED
@@ -1,55 +1,57 @@
1
- <div class="header-container">
2
- <h1><%= t('CurrentMessagesInQueue', :queue => h(@name)) %>
3
- <% if @queue.paused? %>
4
- <span class="label label-danger"><%= t('Paused') %></span>
5
- <% end %>
6
- <span class="badge badge-secondary"><%= number_with_delimiter(@total_size) %></span>
7
- </h1>
8
- <%= erb :_paging, locals: { url: "#{root_path}queues/#{CGI.escape(@name)}" } %>
9
- </div>
1
+ <section>
2
+ <header>
3
+ <h1><%= t('CurrentMessagesInQueue', :queue => h(@name)) %>
4
+ <% if @queue.paused? %>
5
+ <span class="label label-danger"><%= t('Paused') %></span>
6
+ <% end %>
7
+ <span class="badge badge-secondary"><%= number_with_delimiter(@total_size) %></span>
8
+ </h1>
9
+ <%= erb :_paging, locals: { url: "#{root_path}queues/#{CGI.escape(@name)}" } %>
10
+ </header>
10
11
 
11
- <div class="table_container">
12
- <table class="queue table table-hover table-bordered table-striped">
13
- <thead>
14
- <th><a href="<%= url %>?direction=<%= params[:direction] == 'asc' ? 'desc' : 'asc' %>"># <%= sort_direction_label %></a></th>
15
- <th><%= t('Job') %></th>
16
- <th><%= t('Arguments') %></th>
17
- <th><%= t('Context') %></th>
18
- <th></th>
19
- </thead>
20
- <% @jobs.each_with_index do |job, index| %>
21
- <tr title="<%= job.jid %>">
22
- <% if params[:direction] == 'asc' %>
23
- <td><%= @count * (@current_page - 1) + index + 1 %></td>
24
- <% else %>
25
- <td><%= @total_size - (@count * (@current_page - 1) + index) %></td>
26
- <% end %>
27
- <td>
28
- <%= h(job.display_class) %>
29
- <%= display_tags(job, nil) %>
30
- </td>
31
- <td>
32
- <% a = job.display_args %>
33
- <% if a.inspect.size > 100 %>
34
- <span id="job_<%= index %>"><%= h(a.inspect[0..100]) + "... " %></span>
35
- <button data-toggle="job_<%= index %>_full" class="btn btn-default btn-xs"><%= t('ShowAll') %></button>
36
- <div class="toggle" id="job_<%= index %>_full"><%= display_args(a) %></div>
12
+ <div class="table_container">
13
+ <table>
14
+ <thead>
15
+ <th><a href="<%= url %>?direction=<%= url_params("direction") == 'asc' ? 'desc' : 'asc' %>"># <%= sort_direction_label %></a></th>
16
+ <th><%= t('Job') %></th>
17
+ <th><%= t('Arguments') %></th>
18
+ <th><%= t('Context') %></th>
19
+ <th><%= t('Actions') %></th>
20
+ </thead>
21
+ <% @jobs.each_with_index do |job, index| %>
22
+ <tr title="<%= job.jid %>">
23
+ <% if url_params("direction") == 'asc' %>
24
+ <td><%= @count * (@current_page - 1) + index + 1 %></td>
37
25
  <% else %>
38
- <%= display_args(job.display_args) %>
26
+ <td><%= @total_size - (@count * (@current_page - 1) + index) %></td>
39
27
  <% end %>
40
- </td>
41
- <td>
42
- <%= h(job["cattr"].inspect) if job["cattr"]&.any? %>
43
- </td>
44
- <td>
45
- <form action="<%= root_path %>queues/<%= CGI.escape(@name) %>/delete" method="post">
46
- <%= csrf_tag %>
47
- <input name="key_val" value="<%= h job.value %>" type="hidden" />
48
- <input class="btn btn-danger btn-xs" type="submit" name="delete" value="<%= t('Delete') %>" data-confirm="<%= t('AreYouSure') %>" />
49
- </form>
50
- </td>
51
- </tr>
52
- <% end %>
53
- </table>
54
- </div>
55
- <%= erb :_paging, locals: { url: "#{root_path}queues/#{CGI.escape(@name)}" } %>
28
+ <td>
29
+ <%= h(job.display_class) %>
30
+ <%= display_tags(job, nil) %>
31
+ </td>
32
+ <td>
33
+ <% a = job.display_args %>
34
+ <% if a.inspect.size > 100 %>
35
+ <span id="job_<%= index %>"><%= h(a.inspect[0..100]) + "... " %></span>
36
+ <button data-toggle="job_<%= index %>_full" class="btn btn-default btn-xs"><%= t('ShowAll') %></button>
37
+ <div class="toggle" id="job_<%= index %>_full"><%= display_args(a) %></div>
38
+ <% else %>
39
+ <code><%= display_args(job.display_args) %></code>
40
+ <% end %>
41
+ </td>
42
+ <td>
43
+ <%= h(job["cattr"].inspect) if job["cattr"]&.any? %>
44
+ </td>
45
+ <td>
46
+ <form action="<%= root_path %>queues/<%= CGI.escape(@name) %>/delete" method="post">
47
+ <%= csrf_tag %>
48
+ <input name="key_val" value="<%= h job.value %>" type="hidden" />
49
+ <input class="btn btn-danger" type="submit" name="delete" value="<%= t('Delete') %>" data-confirm="<%= t('AreYouSure') %>" />
50
+ </form>
51
+ </td>
52
+ </tr>
53
+ <% end %>
54
+ </table>
55
+ </div>
56
+ <%= erb :_paging, locals: { url: "#{root_path}queues/#{CGI.escape(@name)}" } %>
57
+ </section>