que-view 0.4.0 → 0.4.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca1165b499081e6a124caf37e168c75bd7e74d79c6cd7d4e6445925b9c32589e
|
4
|
+
data.tar.gz: e844c8f96e9eb7021124bb8e420302629805637fa0af9caef16d1b5aad5b03a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0256e1fce181ec2ff9864bbe1e9b90deff9191cd0421415ebf077445683bd23b1f9a2418bfb5f582c4a679c2c0509fe478b644e4f561fbf6f1936be27c5abae
|
7
|
+
data.tar.gz: ca009f6f1c8b8af5bfb9963daef9c32eaead6120b0558eb37542dd5a49845ffe9faeebf97ae6594e5023f171346858c9ed869cc214db56a3ac74979e63456521
|
@@ -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
|
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
|
-
|
37
|
-
<p><%= argument %></p>
|
38
|
-
<% end %>
|
36
|
+
<%= humanized_job_args(@job) %>
|
39
37
|
</td>
|
40
38
|
</tr>
|
41
39
|
<tr>
|
data/lib/que/view/dsl.rb
CHANGED
@@ -163,10 +163,17 @@ module Que
|
|
163
163
|
|
164
164
|
def fetch_job_names_sql(queue_name)
|
165
165
|
<<-SQL.squish
|
166
|
-
SELECT COUNT(*) AS count_all,
|
166
|
+
SELECT COUNT(*) AS count_all,
|
167
|
+
CASE
|
168
|
+
WHEN job_class = 'ActiveJob::QueueAdapters::QueAdapter::JobWrapper' THEN args #>> '{0, job_class}'
|
169
|
+
ELSE job_class
|
170
|
+
END AS job_name
|
167
171
|
FROM que_jobs
|
168
172
|
#{queue_name.present? ? "WHERE queue = '#{queue_name}'" : ""}
|
169
|
-
GROUP BY
|
173
|
+
GROUP BY CASE
|
174
|
+
WHEN job_class = 'ActiveJob::QueueAdapters::QueAdapter::JobWrapper' THEN args #>> '{0, job_class}'
|
175
|
+
ELSE job_class
|
176
|
+
END
|
170
177
|
SQL
|
171
178
|
end
|
172
179
|
|
@@ -208,7 +215,17 @@ module Que
|
|
208
215
|
def search_condition(params)
|
209
216
|
result = ''
|
210
217
|
result += "AND queue = '#{params[:queue_name]}'" if params[:queue_name].present?
|
211
|
-
|
218
|
+
if params[:job_name].present?
|
219
|
+
result += <<~SQL
|
220
|
+
AND (
|
221
|
+
job_class = '#{params[:job_name]}'
|
222
|
+
OR (
|
223
|
+
job_class = 'ActiveJob::QueueAdapters::QueAdapter::JobWrapper'
|
224
|
+
AND args #>> '{0, job_class}' = '#{params[:job_name]}'
|
225
|
+
)
|
226
|
+
)
|
227
|
+
SQL
|
228
|
+
end
|
212
229
|
result
|
213
230
|
end
|
214
231
|
|
data/lib/que/view/version.rb
CHANGED
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.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bogdanov Anton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: que
|