que-view 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 892e7e3d60cac8ff0d076575cb10454e88a2210f537d446bf8af5942f8ba945c
4
- data.tar.gz: 92b8d7b993e6d9e6d7c572a144b63a8b00025e4ee9e28096f177f77bc41203f0
3
+ metadata.gz: 48aaed2dc98a7238f4baa10b5f12c0c67dbd03a5ea588a6d184d95f077f356dd
4
+ data.tar.gz: 27ed335bcfa4b1a21380438ab1fee77e6f92f123828b1d88d8f8ace39a269dce
5
5
  SHA512:
6
- metadata.gz: 6a67ca26a2c007d69be9bd7a036a726cc129bb083c9dd86671edd5aaa70882130158b2f8d7573574785b7523b3b2c2c06cad25bfb850e8d5d52dda694192e9eb
7
- data.tar.gz: 7b9e498a11c818b8f8cb6d67ba1d816d5d3a4387147fb7ae33ca31dfb400fc51d00e974e1ccacb7683aff92da0090bd170909729809cc0255255d82d0f73d120
6
+ metadata.gz: ef87394a2f147a65384f2aa44d8695a734f3ae9c1c451d25bb763dd45a0cd582269597f21809c5cc1847ad1a1113dca4940baac8751cfe1ccd08910222929d1e
7
+ data.tar.gz: 4f83aca9ad32a0dd37b6948d69511f6193412f9bf3221b0db53001e2f37535cc6aac053bc252612005af120270c059e6f3aa1889128f41dd1e0e466c85e268b7
@@ -15,6 +15,34 @@ module Que
15
15
 
16
16
  job[:last_error_message].lines.first || ''
17
17
  end
18
+
19
+ def humanized_job_args(job)
20
+ case job[:job_class]
21
+ when 'ActiveJob::QueueAdapters::QueAdapter::JobWrapper' then active_job_args(job)
22
+ else que_args(job)
23
+ end.join('<br />').html_safe
24
+ end
25
+
26
+ def humanized_enqueued_at(job)
27
+ case job[:job_class]
28
+ when 'ActiveJob::QueueAdapters::QueAdapter::JobWrapper'
29
+ job.dig(:args, 0, :enqueued_at).to_time.strftime('%Y-%m-%d %H:%M:%S')
30
+ end
31
+ end
32
+
33
+ private
34
+
35
+ def active_job_args(job)
36
+ job.dig(:args, 0, :arguments)&.map do |arg|
37
+ next arg.except(:_aj_ruby2_keywords, :_aj_symbol_keys) if arg.is_a?(Hash)
38
+
39
+ arg
40
+ end || []
41
+ end
42
+
43
+ def que_args(job)
44
+ job[:args].push(job[:kwargs])
45
+ end
18
46
  end
19
47
  end
20
48
  end
@@ -50,11 +50,7 @@
50
50
  <td><%= humanized_job_class(job) %></td>
51
51
  <td><%= job[:queue] %></td>
52
52
  <td><%= job[:run_at].strftime("%Y-%m-%d %H:%M:%S") %></td>
53
- <td>
54
- <% Array(job.dig(:args, 0, :arguments)).each do |argument| %>
55
- <p><%= argument %></p>
56
- <% end %>
57
- </td>
53
+ <td><%= humanized_job_args(job) %></td>
58
54
  <% if params[:status] == 'failing' %>
59
55
  <td><%= job[:error_count] %></td>
60
56
  <td><%= format_error(job) %></td>
@@ -20,7 +20,7 @@
20
20
  </tr>
21
21
  <tr>
22
22
  <th>Enqueued at</th>
23
- <td><%= @job.dig(:args, 0, :enqueued_at).to_time.strftime('%Y-%m-%d %H:%M:%S') %></td>
23
+ <td><%= humanized_enqueued_at(@job) %></td>
24
24
  </tr>
25
25
  <tr>
26
26
  <th>Run at</th>
@@ -33,9 +33,7 @@
33
33
  <tr>
34
34
  <th>Args</th>
35
35
  <td>
36
- <% Array(@job.dig(:args, 0, :arguments)).each do |argument| %>
37
- <p><%= argument %></p>
38
- <% end %>
36
+ <%= humanized_job_args(@job) %>
39
37
  </td>
40
38
  </tr>
41
39
  <tr>
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Que
4
4
  module View
5
- VERSION = '0.4.0'
5
+ VERSION = '0.4.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: que-view
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bogdanov Anton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-31 00:00:00.000000000 Z
11
+ date: 2024-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: que