rush_job_mongoid 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/assets/javascript/rush_job_mongoid/controllers/rush_job_mongoid_polling_controller.js +23 -4
- data/app/assets/javascript/rush_job_mongoid/controllers/rush_job_mongoid_table_update_controller.js +13 -4
- data/app/views/layouts/rush_job_mongoid/application.html.erb +1 -0
- data/app/views/rush_job_mongoid/shared/_polling.html.erb +13 -0
- data/lib/rush_job_mongoid/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3054de3624de32c8d3dfb815b7ae7f41cd3ec094309f057beb420943a1f05b9e
|
4
|
+
data.tar.gz: 8eb924984ce3ac7e84d6d62975c9c3e3e0020ee519ccf1cd50589f14f15759cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
33
|
+
gem 'rush_job_mongoid', '~> 1.4'
|
34
34
|
```
|
35
35
|
|
36
36
|
And then execute:
|
data/app/assets/javascript/rush_job_mongoid/controllers/rush_job_mongoid_polling_controller.js
CHANGED
@@ -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
|
-
|
34
|
-
|
35
|
-
|
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() {
|
data/app/assets/javascript/rush_job_mongoid/controllers/rush_job_mongoid_table_update_controller.js
CHANGED
@@ -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
|
-
|
11
|
-
|
12
|
-
|
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() {
|
@@ -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">
|
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.
|
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-
|
11
|
+
date: 2024-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|