rush_job 0.6.0 → 0.6.1
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/application.js +9 -10
- data/app/assets/javascript/rush_job/controllers/rush_job_polling_controller.js +18 -17
- data/app/assets/javascript/rush_job/controllers/rush_job_reload_jobs_table_controller.js +2 -2
- data/app/assets/javascript/rush_job/controllers/rush_job_table_update_controller.js +7 -7
- data/app/views/rush_job/rush_jobs/index.js.erb +1 -0
- data/lib/rush_job/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: 9f1f2016e98628b8ca8df65ab968afd510ae17cec5c27f1c32bb310d9e566cc7
|
4
|
+
data.tar.gz: 58461cac54f6376f5505ef433b100c17acb4059b267611b63b2284fec3868535
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6bebec349e0ec4975275946490aff4908914c1cdc6420b05e5e8b8bb7977119fee0d8199cf8b69577646d591bb9bf124f13f40d43786f73762d87282da765b2
|
7
|
+
data.tar.gz: 0c9175a6c11f22a8b93f422bfa5d4346c10f5daed5d8e18a5d512146aa138cc126f2eb48f2f6f535ad68f5e3fe368c9a43c4ad6442df579027c4326e7318a497
|
data/README.md
CHANGED
@@ -1,12 +1,11 @@
|
|
1
|
-
import '
|
2
|
-
import Rails from '@rails/ujs'
|
3
|
-
|
4
|
-
|
5
|
-
import
|
1
|
+
import { Application } from '@hotwired/stimulus';
|
2
|
+
import Rails from '@rails/ujs';
|
3
|
+
import RushJobPollingController from './controllers/rush_job_polling_controller';
|
4
|
+
import RushJobReloadJobsTableController from './controllers/rush_job_reload_jobs_table_controller';
|
5
|
+
import 'bootstrap';
|
6
6
|
|
7
|
-
|
8
|
-
import RushJobReloadJobsTableController from './controllers/rush_job_reload_jobs_table_controller'
|
7
|
+
Rails.start();
|
9
8
|
|
10
|
-
window.Stimulus = Application.start()
|
11
|
-
Stimulus.register('rush-job-polling', RushJobPollingController)
|
12
|
-
Stimulus.register('rush-job-reload-jobs-table', RushJobReloadJobsTableController)
|
9
|
+
window.Stimulus = Application.start();
|
10
|
+
Stimulus.register('rush-job-polling', RushJobPollingController);
|
11
|
+
Stimulus.register('rush-job-reload-jobs-table', RushJobReloadJobsTableController);
|
@@ -1,49 +1,50 @@
|
|
1
|
-
import
|
1
|
+
import { RushJobTableUpdateController } from './rush_job_table_update_controller';
|
2
2
|
|
3
|
-
let intervalID
|
3
|
+
let intervalID;
|
4
4
|
|
5
5
|
export default class extends RushJobTableUpdateController {
|
6
|
-
static targets = [
|
6
|
+
static targets = ['pollingTime', 'pollingTimeLabel', 'pollingSlide'];
|
7
7
|
|
8
8
|
connect() {
|
9
|
-
this.pollingChange()
|
10
|
-
this.stopPolling()
|
9
|
+
this.pollingChange();
|
10
|
+
this.stopPolling();
|
11
11
|
}
|
12
12
|
|
13
13
|
pollingChange() {
|
14
14
|
const pollingLabelRegex = /\d+/;
|
15
|
-
|
16
|
-
|
15
|
+
const pollingTimeTargetHtml = this.pollingTimeLabelTarget.innerHTML;
|
16
|
+
const pollingLabelUpdate = pollingTimeTargetHtml.replace(pollingLabelRegex, this.pollingTime());
|
17
|
+
this.pollingTimeLabelTarget.innerHTML = pollingLabelUpdate;
|
17
18
|
}
|
18
19
|
|
19
20
|
pollingToggle() {
|
20
|
-
|
21
|
+
const pollingSlide = this.pollingSlideTarget;
|
21
22
|
|
22
23
|
if (pollingSlide.checked === true) {
|
23
|
-
this.startPolling()
|
24
|
+
this.startPolling();
|
24
25
|
} else {
|
25
|
-
this.stopPolling()
|
26
|
+
this.stopPolling();
|
26
27
|
}
|
27
28
|
}
|
28
29
|
|
29
30
|
startPolling() {
|
30
|
-
this.updateJobs()
|
31
|
+
this.updateJobs();
|
31
32
|
|
32
33
|
intervalID = setTimeout(() => {
|
33
|
-
this.startPolling()
|
34
|
-
}, this.pollingTime() * 1000)
|
34
|
+
this.startPolling();
|
35
|
+
}, this.pollingTime() * 1000);
|
35
36
|
}
|
36
37
|
|
37
38
|
stopPolling() {
|
38
39
|
if (intervalID) {
|
39
|
-
clearInterval(intervalID)
|
40
|
+
clearInterval(intervalID);
|
40
41
|
}
|
41
42
|
}
|
42
43
|
|
43
44
|
pollingTime() {
|
44
|
-
const pollingTimes = [3, 5, 8, 13, 21, 34, 55]
|
45
|
-
|
45
|
+
const pollingTimes = [3, 5, 8, 13, 21, 34, 55];
|
46
|
+
const pollingTime = this.pollingTimeTarget.value || 3;
|
46
47
|
|
47
|
-
return pollingTimes[pollingTime]
|
48
|
+
return pollingTimes[pollingTime];
|
48
49
|
}
|
49
50
|
}
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import
|
1
|
+
import { RushJobTableUpdateController } from './rush_job_table_update_controller';
|
2
2
|
|
3
3
|
export default class extends RushJobTableUpdateController {
|
4
4
|
reloadJobs() {
|
5
|
-
this.updateJobs()
|
5
|
+
this.updateJobs();
|
6
6
|
}
|
7
7
|
}
|
@@ -1,19 +1,19 @@
|
|
1
|
-
import { Controller } from '@hotwired/stimulus'
|
2
|
-
import Rails from '@rails/ujs'
|
1
|
+
import { Controller } from '@hotwired/stimulus';
|
2
|
+
import Rails from '@rails/ujs';
|
3
3
|
|
4
4
|
export class RushJobTableUpdateController extends Controller {
|
5
5
|
updateJobs() {
|
6
|
-
this.blurTable()
|
6
|
+
this.blurTable();
|
7
7
|
|
8
8
|
Rails.ajax({
|
9
9
|
url: document.location.href,
|
10
10
|
type: 'GET',
|
11
|
-
dataType: 'script'
|
12
|
-
})
|
11
|
+
dataType: 'script',
|
12
|
+
});
|
13
13
|
}
|
14
14
|
|
15
15
|
blurTable() {
|
16
|
-
|
17
|
-
|
16
|
+
const jobsContainer = document.getElementById('rush-job-jobs-container');
|
17
|
+
jobsContainer.classList.add('table-refresh');
|
18
18
|
}
|
19
19
|
}
|
data/lib/rush_job/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rush_job
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JavaKoala
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|