solid_queue_monitor 0.3.0 → 0.3.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d2911139409c2a387a2c425c0ef9927071a05dcf5f718e5aefc7bfb86cc4b7b6
4
- data.tar.gz: 398de34669f64b9d4cab2cf1ed7e1f19da6fcd56b67df8da2c2682410308a905
3
+ metadata.gz: 9866a9be02d283c7d46d4b9097e4b1a5ad33e3d9817f25f026bd45ac15f9585b
4
+ data.tar.gz: 2e4fa6b8ec14ad8297a5020ec607c5c261e3093b77c0deaac66b53a541de8fed
5
5
  SHA512:
6
- metadata.gz: 9357fee483f20555b92b1fd913224c536ae934bb8442968f42470c672c1cc19a8388d13a5cd7741f36158a67c594913074b5cdafbeae8caaa6aa67e5161cc373
7
- data.tar.gz: 32a1c6d65dbbcf9d837ded2fca261d0d715546c446a716073881c7a199d7ee3d561a94971880f5c144f270484199e265fd0b367230babd811891409b56849a2e
6
+ metadata.gz: 4cbcab451ad976ea10d098d3f624e636088a8ab22dc4600b9e92cf77781b227bcc496cc1fc4e0c2fea85b8826f8adff1ca93a78ee9f139b5b1791f2c25c4c90b
7
+ data.tar.gz: 8211a5d9500a91e3a3b72b43d80d2f104b2f9e20040c4bf6f8816125e0f2d68bf4d43e4ebd2f97d39422868663190d8d216157a2096cd653af521c266fba989f
data/README.md CHANGED
@@ -33,11 +33,11 @@ A lightweight, zero-dependency web interface for monitoring Solid Queue backgrou
33
33
 
34
34
  ### Dashboard Overview
35
35
 
36
- ![Dashboard Overview](screenshots/dashboard-2.png)
36
+ ![Dashboard Overview](screenshots/dashboard-3.png)
37
37
 
38
38
  ### Failed Jobs
39
39
 
40
- ![Failed Jobs](screenshots/failed_jobs.png)
40
+ ![Failed Jobs](screenshots/failed-jobs-2.png)
41
41
 
42
42
  ## Installation
43
43
 
@@ -81,15 +81,24 @@ module SolidQueueMonitor
81
81
  def format_arguments(arguments)
82
82
  return '-' if arguments.blank?
83
83
 
84
- # For ActiveJob format
85
- if arguments.is_a?(Hash) && arguments['arguments'].present?
86
- return "<code>#{arguments['arguments'].inspect}</code>"
87
- elsif arguments.is_a?(Array) && arguments.length == 1 && arguments[0].is_a?(Hash) && arguments[0]['arguments'].present?
88
- return "<code>#{arguments[0]['arguments'].inspect}</code>"
84
+ # Extract and format the arguments more cleanly
85
+ formatted_args = if arguments.is_a?(Hash) && arguments['arguments'].present?
86
+ format_job_arguments(arguments)
87
+ elsif arguments.is_a?(Array) && arguments.length == 1 && arguments[0].is_a?(Hash) && arguments[0]['arguments'].present?
88
+ format_job_arguments(arguments[0])
89
+ else
90
+ arguments.inspect
91
+ end
92
+
93
+ if formatted_args.length <= 50
94
+ "<code class='args-single-line'>#{formatted_args}</code>"
95
+ else
96
+ <<-HTML
97
+ <div class="args-container">
98
+ <code class="args-content">#{formatted_args}</code>
99
+ </div>
100
+ HTML
89
101
  end
90
-
91
- # For regular arguments format
92
- "<code>#{arguments.inspect}</code>"
93
102
  end
94
103
 
95
104
  def format_hash(hash)
@@ -102,18 +111,14 @@ module SolidQueueMonitor
102
111
  "<code>#{formatted}</code>"
103
112
  end
104
113
 
105
- # Helper method to get the current request path
106
114
  def request_path
107
- # Try to get the current path from the controller's request
108
115
  if defined?(controller) && controller.respond_to?(:request)
109
116
  controller.request.path
110
117
  else
111
- # Fallback to a default path if we can't get the current path
112
118
  '/solid_queue'
113
119
  end
114
120
  end
115
121
 
116
- # Helper method to get the mount point of the engine
117
122
  def engine_mount_point
118
123
  path_parts = request_path.split('/')
119
124
  if path_parts.length >= 3
@@ -134,13 +139,24 @@ module SolidQueueMonitor
134
139
  params.empty? ? '' : "&#{params.join('&')}"
135
140
  end
136
141
 
137
- # Helper method to get the full path for a route
138
142
  def full_path(route_name, *args)
139
- # Try to use the engine routes first
140
143
  SolidQueueMonitor::Engine.routes.url_helpers.send(route_name, *args)
141
144
  rescue NoMethodError
142
- # Fall back to main app routes
143
145
  Rails.application.routes.url_helpers.send("solid_queue_#{route_name}", *args)
144
146
  end
147
+
148
+ def format_job_arguments(job_data)
149
+ args = if job_data['arguments'].is_a?(Array)
150
+ if job_data['arguments'].first.is_a?(Hash) && job_data['arguments'].first['_aj_ruby2_keywords'].present?
151
+ job_data['arguments'].first.except('_aj_ruby2_keywords')
152
+ else
153
+ job_data['arguments']
154
+ end
155
+ else
156
+ job_data['arguments']
157
+ end
158
+
159
+ args.inspect
160
+ end
145
161
  end
146
162
  end
@@ -282,6 +282,51 @@ module SolidQueueMonitor
282
282
  font-weight: 500;
283
283
  }
284
284
 
285
+ /* Arguments styling */
286
+ .solid_queue_monitor .args-container {
287
+ position: relative;
288
+ max-height: 100px;
289
+ overflow: hidden;
290
+ }
291
+
292
+ .solid_queue_monitor .args-content {
293
+ display: block;
294
+ white-space: pre-wrap;
295
+ word-break: break-word;
296
+ max-height: 100px;
297
+ overflow-y: auto;
298
+ padding: 8px;
299
+ background: #f5f5f5;
300
+ border-radius: 4px;
301
+ font-size: 0.9em;
302
+ }
303
+
304
+ .solid_queue_monitor .args-single-line {
305
+ display: inline-block;
306
+ padding: 4px 8px;
307
+ background: #f5f5f5;
308
+ border-radius: 4px;
309
+ font-size: 0.9em;
310
+ }
311
+
312
+ .solid_queue_monitor .args-content::-webkit-scrollbar {
313
+ width: 8px;
314
+ }
315
+
316
+ .solid_queue_monitor .args-content::-webkit-scrollbar-track {
317
+ background: #f1f1f1;
318
+ border-radius: 4px;
319
+ }
320
+
321
+ .solid_queue_monitor .args-content::-webkit-scrollbar-thumb {
322
+ background: #888;
323
+ border-radius: 4px;
324
+ }
325
+
326
+ .solid_queue_monitor .args-content::-webkit-scrollbar-thumb:hover {
327
+ background: #666;
328
+ }
329
+
285
330
  @media (max-width: 768px) {
286
331
  .solid_queue_monitor .container {
287
332
  padding: 0.5rem;
@@ -432,7 +477,6 @@ module SolidQueueMonitor
432
477
  background: #e5e7eb;
433
478
  }
434
479
 
435
- /* Action buttons for retry/discard */
436
480
  .solid_queue_monitor .action-button {
437
481
  padding: 0.5rem 1rem;
438
482
  border-radius: 0.375rem;
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidQueueMonitor
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solid_queue_monitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vishal Sadriya