rush_job_mongoid 1.2.0 → 1.4.0

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: bfe3e243025032efc67c34edd6acc243999d62de370ffbd8773d483ccccb639d
4
- data.tar.gz: 687116c6dad0b2fd37b23e63d21ef08da63d2236f3ced42335d1fdaca31ece9e
3
+ metadata.gz: 3054de3624de32c8d3dfb815b7ae7f41cd3ec094309f057beb420943a1f05b9e
4
+ data.tar.gz: 8eb924984ce3ac7e84d6d62975c9c3e3e0020ee519ccf1cd50589f14f15759cb
5
5
  SHA512:
6
- metadata.gz: ec16e5c8b09cd397694ae254ce88452d31f21328f4e3508924ef5a274eb52e1dbe6a9886e9f23a35d14476b9f61ec80b617c3d40e3c809d647cafb2488995202
7
- data.tar.gz: 6562c846568c565c98c24ccd2cd2f5e5ffebd5c084f05cba0ffcdd9833e99f4786dad70142bf6ecd35d9f5493a21d22321c3fbf5cf115d5f4c1f94b2cf64710e
6
+ metadata.gz: 7cc9a9715ccb15e9ead71841abd4c250164a92d6411a5de53374378273a124132c7dacb50f8d5d3c979205dda19ca8d4d8e71e1473977ad14dbee192ab6ba57f
7
+ data.tar.gz: 499a2698a09fa5cd7f7e8c21509b93f7801777302f7f70eb1436e7caf1881d6fdf902f6d1353b93844651260f5629be8bca1956c3f94a3a4b73f4c51c90f57e9
data/README.md CHANGED
@@ -30,7 +30,7 @@ Queues on the dashboard are eager loaded. If there are lots of queues this can a
30
30
  Add this line to your Ruby on Rails application's Gemfile:
31
31
 
32
32
  ```ruby
33
- gem 'rush_job_mongoid', '~> 1.2.0'
33
+ gem 'rush_job_mongoid', '~> 1.4'
34
34
  ```
35
35
 
36
36
  And then execute:
@@ -48,7 +48,7 @@ Open an issue or
48
48
  1. Fork
49
49
  2. Update
50
50
  3. Test
51
- 1. `bundle exec rails app:test:all` and check coverage in `test/coverage/index.html`
51
+ 1. `bundle exec rails test:all` and check coverage in `test/coverage/index.html`
52
52
  2. `bundle exec rubocop`
53
53
  3. `bundle exec brakeman`
54
54
  4. Open pull request
@@ -3,7 +3,7 @@ import { RushJobMongoidTableUpdateController } from './rush_job_mongoid_table_up
3
3
  let intervalID;
4
4
 
5
5
  export default class RushJobMongoidPollingController extends RushJobMongoidTableUpdateController {
6
- static targets = ['pollingTime', 'pollingTimeLabel', 'pollingSlide'];
6
+ static targets = ['pollingTime', 'pollingTimeLabel', 'pollingSlide', 'progressBar', 'progressBarProgress'];
7
7
 
8
8
  connect() {
9
9
  this.pollingChange();
@@ -22,17 +22,36 @@ export default class RushJobMongoidPollingController extends RushJobMongoidTable
22
22
 
23
23
  if (pollingSlide.checked === true) {
24
24
  this.startPolling();
25
+ this.progressBarTarget.style = 'height: 7px;';
25
26
  } else {
26
27
  this.stopPolling();
28
+ this.progressBarTarget.style = 'display: none;';
27
29
  }
28
30
  }
29
31
 
30
32
  startPolling() {
33
+ this.stopPolling();
31
34
  this.updateJobs();
32
35
 
33
- intervalID = setTimeout(() => {
34
- this.startPolling();
35
- }, this.pollingTime() * 1000);
36
+ let progressInterval = 100;
37
+ let progressPrecent = 1;
38
+ let progressIntervalTime = this.pollingTime() * 10;
39
+
40
+ if (progressIntervalTime < 130) {
41
+ progressPrecent = 10;
42
+ progressIntervalTime = progressIntervalTime * 10;
43
+ }
44
+
45
+ intervalID = setInterval(() => {
46
+ this.progressBarProgressTarget.style = `width: ${progressInterval}%;`;
47
+ this.progressBarTarget.setAttribute('aria-valuenow', progressInterval);
48
+
49
+ progressInterval -= progressPrecent;
50
+
51
+ if (progressInterval < 0) {
52
+ this.startPolling();
53
+ }
54
+ }, progressIntervalTime);
36
55
  }
37
56
 
38
57
  stopPolling() {
@@ -1,15 +1,24 @@
1
1
  import { Controller } from '@hotwired/stimulus';
2
2
 
3
3
  export class RushJobMongoidTableUpdateController extends Controller {
4
- updateJobs() {
4
+ async updateJobs() {
5
5
  const headers = { 'Accept': 'text/vnd.turbo-stream.html' };
6
6
 
7
7
  this.blurTable();
8
8
  this.clearFlash();
9
9
 
10
- fetch(document.location.href, { headers: headers })
11
- .then(response => response.text())
12
- .then(html => Turbo.renderStreamMessage(html));
10
+ try {
11
+ const response = await fetch(document.location.href, { headers: headers })
12
+
13
+ if (!response.ok) {
14
+ throw new Error(`Failed to fetch job data. Status: ${response.status}`);
15
+ }
16
+
17
+ const response_text = await response.text();
18
+ Turbo.renderStreamMessage(response_text);
19
+ } catch (error) {
20
+ console.error(error.message);
21
+ }
13
22
  }
14
23
 
15
24
  blurTable() {
@@ -45,10 +45,8 @@ module RushJobMongoid
45
45
  } }
46
46
  ]).to_a
47
47
 
48
- group_result = []
49
-
50
- groups.each do |group|
51
- group_result << { queue: group['_id']['queue'], priority: group['_id']['priority'], count: group['count'] }
48
+ group_result = groups.map do |group|
49
+ { queue: group['_id']['queue'], priority: group['_id']['priority'], count: group['count'] }
52
50
  end
53
51
 
54
52
  group_result.sort_by! { |group| [group[:priority], group[:queue]] }
@@ -2,6 +2,7 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>Rush job mongoid</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
5
6
  <%= csrf_meta_tags %>
6
7
  <%= csp_meta_tag %>
7
8
 
@@ -1,4 +1,4 @@
1
- <h3 class="text-body">Edit Job <%= @job.id %></h3>
1
+ <h3 class="text-body"><%= t :edit_job %> <%= @job.id %></h3>
2
2
 
3
3
  <%= link_to 'Back', :back, class: 'btn btn-primary btn-sm mb-3' %>
4
4
 
@@ -43,7 +43,7 @@
43
43
  <% end %>
44
44
 
45
45
  <div class="mt-3">
46
- <%= button_to "Delete",
46
+ <%= button_to t(:delete),
47
47
  rush_job_url(@job),
48
48
  class: "btn btn-danger",
49
49
  method: :delete,
@@ -1,4 +1,4 @@
1
- <h3 class="text-body">Delayed Jobs</h3>
1
+ <h3 class="text-body"><%= t :delayed_title %></h3>
2
2
 
3
3
  <%= render 'rush_job_mongoid/shared/polling' %>
4
4
 
@@ -13,6 +13,19 @@
13
13
  max="6"
14
14
  data-rush-job-mongoid-polling-target="pollingTime"
15
15
  data-action="input->rush-job-mongoid-polling#pollingChange">
16
+ <div id="rush-job-mongoid-polling-progress"
17
+ class="progress mb-2"
18
+ role="progressbar"
19
+ aria-label="polling progress"
20
+ aria-valuenow="100"
21
+ aria-valuemin="0"
22
+ aria-valuemax="100"
23
+ style="display: none;"
24
+ data-rush-job-mongoid-polling-target="progressBar">
25
+ <div class="progress-bar"
26
+ style="width: 100%;"
27
+ data-rush-job-mongoid-polling-target="progressBarProgress"></div>
28
+ </div>
16
29
  </div>
17
30
  <div class="col-3">
18
31
  <div class="form-check form-switch">
@@ -9,11 +9,13 @@ en:
9
9
  dark_mode: "Dark Mode"
10
10
  dashboard: "Dashboard"
11
11
  delayed_title: "Delayed Jobs"
12
+ delete: "Delete"
12
13
  deleted_job: "Deleted job %{job_id}"
13
14
  delete_job_confirmation: "Are you sure you want to delete job %{job_id} ?"
14
15
  disable_editing: "Disable Editing"
15
16
  disable_editing_confirmation: "Are you sure?"
16
17
  disable_queues: "Disable Queues"
18
+ edit_job: "Edit Job"
17
19
  edit_warning: "Verify workers are stopped before editing. Minimal validations are applied."
18
20
  enable_editing: "Enable Editing"
19
21
  enable_editing_confirmation: "Are you sure? Verify workers are stopped before editing."
@@ -1,3 +1,3 @@
1
1
  module RushJobMongoid
2
- VERSION = '1.2.0'.freeze
2
+ VERSION = '1.4.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rush_job_mongoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JavaKoala
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-15 00:00:00.000000000 Z
11
+ date: 2024-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '7.0'
19
+ version: '8.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '7.0'
26
+ version: '8.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '7.0'
33
+ version: '8.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '7.0'
40
+ version: '8.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: delayed_job
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -128,28 +128,28 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '6.0'
131
+ version: '6.2'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '6.0'
138
+ version: '6.2'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: capybara
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '3.39'
145
+ version: '3.40'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '3.39'
152
+ version: '3.40'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: database_cleaner-mongoid
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -170,84 +170,84 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: '1.8'
173
+ version: '1.9'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: '1.8'
180
+ version: '1.9'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: puma
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: '6.3'
187
+ version: '6.4'
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: '6.3'
194
+ version: '6.4'
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: rubocop-capybara
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
199
  - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: '2.18'
201
+ version: '2.21'
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: '2.18'
208
+ version: '2.21'
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: rubocop-minitest
211
211
  requirement: !ruby/object:Gem::Requirement
212
212
  requirements:
213
213
  - - "~>"
214
214
  - !ruby/object:Gem::Version
215
- version: 0.31.0
215
+ version: 0.36.0
216
216
  type: :development
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - "~>"
221
221
  - !ruby/object:Gem::Version
222
- version: 0.31.0
222
+ version: 0.36.0
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: rubocop-rails
225
225
  requirement: !ruby/object:Gem::Requirement
226
226
  requirements:
227
227
  - - "~>"
228
228
  - !ruby/object:Gem::Version
229
- version: '2.21'
229
+ version: '2.27'
230
230
  type: :development
231
231
  prerelease: false
232
232
  version_requirements: !ruby/object:Gem::Requirement
233
233
  requirements:
234
234
  - - "~>"
235
235
  - !ruby/object:Gem::Version
236
- version: '2.21'
236
+ version: '2.27'
237
237
  - !ruby/object:Gem::Dependency
238
238
  name: selenium-webdriver
239
239
  requirement: !ruby/object:Gem::Requirement
240
240
  requirements:
241
241
  - - "~>"
242
242
  - !ruby/object:Gem::Version
243
- version: '4.12'
243
+ version: '4.26'
244
244
  type: :development
245
245
  prerelease: false
246
246
  version_requirements: !ruby/object:Gem::Requirement
247
247
  requirements:
248
248
  - - "~>"
249
249
  - !ruby/object:Gem::Version
250
- version: '4.12'
250
+ version: '4.26'
251
251
  - !ruby/object:Gem::Dependency
252
252
  name: simplecov
253
253
  requirement: !ruby/object:Gem::Requirement
@@ -268,14 +268,14 @@ dependencies:
268
268
  requirements:
269
269
  - - "~>"
270
270
  - !ruby/object:Gem::Version
271
- version: '3.4'
271
+ version: '3.5'
272
272
  type: :development
273
273
  prerelease: false
274
274
  version_requirements: !ruby/object:Gem::Requirement
275
275
  requirements:
276
276
  - - "~>"
277
277
  - !ruby/object:Gem::Version
278
- version: '3.4'
278
+ version: '3.5'
279
279
  description: Rails web interface for delayed_job using Rails::Engine and MongoDB
280
280
  email:
281
281
  - javakoala1@gmail.com