rush_job 0.3.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/assets/javascript/rush_job/application.js +12 -1
  4. data/app/assets/javascript/rush_job/controllers/rush_job_polling_controller.js +49 -0
  5. data/app/assets/javascript/rush_job/controllers/rush_job_reload_jobs_table_controller.js +7 -0
  6. data/app/assets/javascript/rush_job/controllers/rush_job_table_update_controller.js +19 -0
  7. data/app/assets/stylesheets/rush_job/application.scss +3 -1
  8. data/app/assets/stylesheets/rush_job/components/_pagination.scss +15 -0
  9. data/app/assets/stylesheets/rush_job/components/_polling.scss +26 -0
  10. data/app/assets/stylesheets/rush_job/pages/_rush_jobs_index.scss +10 -0
  11. data/app/assets/stylesheets/rush_job/themes/_dark.scss +4 -0
  12. data/app/assets/stylesheets/rush_job/themes/_light.scss +4 -0
  13. data/app/controllers/rush_job/dashboard_controller.rb +22 -0
  14. data/app/controllers/rush_job/rush_jobs_controller.rb +6 -1
  15. data/app/helpers/rush_job/dashboard_helper.rb +5 -0
  16. data/app/helpers/rush_job/rush_jobs_helper.rb +1 -1
  17. data/app/models/rush_job/rush_job.rb +3 -0
  18. data/app/views/layouts/rush_job/_navbar.html.erb +32 -0
  19. data/app/views/layouts/rush_job/application.html.erb +1 -0
  20. data/app/views/rush_job/dashboard/_dashboard_tables.html.erb +75 -0
  21. data/app/views/rush_job/dashboard/index.html.erb +5 -0
  22. data/app/views/rush_job/dashboard/index.js.erb +1 -0
  23. data/app/views/rush_job/rush_jobs/_jobs_table.html.erb +47 -0
  24. data/app/views/rush_job/rush_jobs/index.html.erb +3 -68
  25. data/app/views/rush_job/rush_jobs/index.js.erb +1 -0
  26. data/app/views/rush_job/shared/_polling.html.erb +32 -0
  27. data/config/importmap.rb +2 -0
  28. data/config/locales/en.yml +13 -2
  29. data/config/routes.rb +2 -1
  30. data/lib/rush_job/engine.rb +1 -0
  31. data/lib/rush_job/version.rb +1 -1
  32. metadata +17 -3
  33. data/app/assets/stylesheets/rush_job/pages/_index.scss +0 -35
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a6a851e49e6f1885c14bb796537b7e508beab734f7997884a3a4ff586821c115
4
- data.tar.gz: ad8614b76e4f5e1c88b3d34e9327f2780328bb3b8539e813cd2c3da0eedf0444
3
+ metadata.gz: b07a4492ebffa031a0903966f625369665abd50885b8475fdb6d7d5da699f0c0
4
+ data.tar.gz: 51dd10bfdd6071e5bcc2671f24ed741d98648b2d7f583e5ae782a6212bf0d283
5
5
  SHA512:
6
- metadata.gz: e6462e003fe4e0726deebffde8c579da9b631539c18bc535365dee4d865a084d1dba2e71f7e728421ed909d26c6dfaa5c5e2208cc392f45d776c9e65b0144dd2
7
- data.tar.gz: 96963d1457393cf3d63829d6232527f531a453d88be6d7d74c90451aeee8998b80a0a198d2cbb2ed4388f5750476824eaab5c3a722ba3e91f56dbbf6913d6d74
6
+ metadata.gz: d9d69af4d01e8906ced6fb3a67906118358035e60d091b07a6e8759a7a881a4aa97d1aaf8e411ebe6ed2206a67864bc5538521c8733594ad68905c6dff94c95d
7
+ data.tar.gz: 28e5e62dac3f62f6bf342116f43bb102974e064830210592ead0f1034fefb9c15ab3f9ca5961b13a7f4fb507736a59375a14ede4710408d72ef2a5d7d52b67aa
data/README.md CHANGED
@@ -14,7 +14,7 @@ Navigate to the `/rush_job` route in your application to see the Delayed Jobs. L
14
14
  Add this line to your Ruby on Rails application's Gemfile:
15
15
 
16
16
  ```ruby
17
- gem 'rush_job', '~> 0.3.2'
17
+ gem 'rush_job', '~> 0.5.0'
18
18
  ```
19
19
 
20
20
  And then execute:
@@ -1 +1,12 @@
1
- import "bootstrap"
1
+ import 'bootstrap'
2
+ import Rails from '@rails/ujs'
3
+ Rails.start();
4
+
5
+ import { Application } from '@hotwired/stimulus'
6
+
7
+ import RushJobPollingController from './controllers/rush_job_polling_controller'
8
+ import RushJobReloadJobsTableController from './controllers/rush_job_reload_jobs_table_controller'
9
+
10
+ window.Stimulus = Application.start()
11
+ Stimulus.register('rush-job-polling', RushJobPollingController)
12
+ Stimulus.register('rush-job-reload-jobs-table', RushJobReloadJobsTableController)
@@ -0,0 +1,49 @@
1
+ import { RushJobTableUpdateController } from './rush_job_table_update_controller.js'
2
+
3
+ let intervalID
4
+
5
+ export default class extends RushJobTableUpdateController {
6
+ static targets = [ 'pollingTime', 'pollingTimeLabel', 'pollingSlide' ]
7
+
8
+ connect() {
9
+ this.pollingChange()
10
+ this.stopPolling()
11
+ }
12
+
13
+ pollingChange() {
14
+ const pollingLabelRegex = /\d+/;
15
+ let pollingLabelUpdate = this.pollingTimeLabelTarget.innerHTML.replace(pollingLabelRegex, this.pollingTime())
16
+ this.pollingTimeLabelTarget.innerHTML = pollingLabelUpdate
17
+ }
18
+
19
+ pollingToggle() {
20
+ let pollingSlide = this.pollingSlideTarget
21
+
22
+ if (pollingSlide.checked === true) {
23
+ this.startPolling()
24
+ } else {
25
+ this.stopPolling()
26
+ }
27
+ }
28
+
29
+ startPolling() {
30
+ this.updateJobs()
31
+
32
+ intervalID = setTimeout(() => {
33
+ this.startPolling()
34
+ }, this.pollingTime() * 1000)
35
+ }
36
+
37
+ stopPolling() {
38
+ if (intervalID) {
39
+ clearInterval(intervalID)
40
+ }
41
+ }
42
+
43
+ pollingTime() {
44
+ const pollingTimes = [3, 5, 8, 13, 21, 34, 55]
45
+ let pollingTime = this.pollingTimeTarget.value || 3
46
+
47
+ return pollingTimes[pollingTime]
48
+ }
49
+ }
@@ -0,0 +1,7 @@
1
+ import { RushJobTableUpdateController } from './rush_job_table_update_controller.js'
2
+
3
+ export default class extends RushJobTableUpdateController {
4
+ reloadJobs() {
5
+ this.updateJobs()
6
+ }
7
+ }
@@ -0,0 +1,19 @@
1
+ import { Controller } from '@hotwired/stimulus'
2
+ import Rails from '@rails/ujs'
3
+
4
+ export class RushJobTableUpdateController extends Controller {
5
+ updateJobs() {
6
+ this.blurTable()
7
+
8
+ Rails.ajax({
9
+ url: document.location.href,
10
+ type: 'GET',
11
+ dataType: 'script'
12
+ })
13
+ }
14
+
15
+ blurTable() {
16
+ let jobs_container = document.getElementById('rush-job-jobs-container')
17
+ jobs_container.classList.add('table-refresh')
18
+ }
19
+ }
@@ -12,6 +12,8 @@
12
12
  *
13
13
  */
14
14
  @import "../../../vendor/stylesheets/rush_job/bootstrap";
15
+ @import "components/pagination";
16
+ @import "components/polling";
15
17
  @import "themes/dark";
16
18
  @import "themes/light";
17
- @import "pages/index";
19
+ @import "pages/rush_jobs_index";
@@ -0,0 +1,15 @@
1
+ .page-link.disabled, .disabled > .page-link {
2
+ color: rgb(68, 110, 155);
3
+ }
4
+
5
+ .page-item:first-child .page-link {
6
+ color: rgb(68, 110, 155);
7
+ }
8
+
9
+ .page-item:last-child .page-link {
10
+ color: rgb(68, 110, 155);
11
+ }
12
+
13
+ .page-link {
14
+ color: rgb(68, 110, 155);
15
+ }
@@ -0,0 +1,26 @@
1
+ .polling-container {
2
+ margin-left: 5%;
3
+ margin-right: 5%;
4
+ }
5
+
6
+ .polling-range-form-label-dark {
7
+ color: rgb(0, 0, 0);
8
+ margin-bottom: 0.5rem;
9
+ }
10
+
11
+ .polling-range-form-label-light {
12
+ color: rgb(255, 255, 255);
13
+ margin-bottom: 0.5rem;
14
+ }
15
+
16
+ .form-check-label-dark {
17
+ color: rgb(0, 0, 0);
18
+ }
19
+
20
+ .form-check-label-light {
21
+ color: rgb(255, 255, 255);
22
+ }
23
+
24
+ .table-refresh {
25
+ opacity: 0.3;
26
+ }
@@ -0,0 +1,10 @@
1
+ .jobs-container {
2
+ margin-left: 5%;
3
+ margin-right: 5%;
4
+ }
5
+
6
+ .footer-container {
7
+ margin-left: 5%;
8
+ margin-right: 5%;
9
+ float: right;
10
+ }
@@ -1,3 +1,7 @@
1
1
  .background-color-dark {
2
2
  background-color: #000;
3
3
  }
4
+
5
+ .color-dark {
6
+ color: #000;
7
+ }
@@ -1,3 +1,7 @@
1
1
  .background-color-light {
2
2
  background-color: #fff;
3
3
  }
4
+
5
+ .color-light {
6
+ color: #fff;
7
+ }
@@ -0,0 +1,22 @@
1
+ module RushJob
2
+ class DashboardController < ApplicationController
3
+ include Pagy::Backend
4
+
5
+ rescue_from Pagy::OverflowError, with: :redirect_to_first_page
6
+
7
+ def index
8
+ @pagy_locked_jobs, @locked_jobs = pagy(RushJob.locked_jobs,
9
+ items: 10,
10
+ page_param: :locked_jobs_page)
11
+
12
+ @queue_groups = RushJob.queue_groups
13
+ @pagy_queue, @job_queues = pagy_array(@queue_groups.keys,
14
+ items: 10,
15
+ page_param: :queue_page)
16
+ end
17
+
18
+ def redirect_to_first_page
19
+ redirect_to root_path, notice: t(:invalid_page_notice)
20
+ end
21
+ end
22
+ end
@@ -7,12 +7,17 @@ module RushJob
7
7
 
8
8
  def index
9
9
  @pagy, @rush_jobs = pagy(RushJob.order("#{sort_column} #{sort_direction}"))
10
+
11
+ respond_to do |format|
12
+ format.html
13
+ format.js
14
+ end
10
15
  end
11
16
 
12
17
  private
13
18
 
14
19
  def redirect_to_first_page
15
- redirect_to root_path, notice: t(:invalid_page_notice)
20
+ redirect_to rush_jobs_path, notice: t(:invalid_page_notice)
16
21
  end
17
22
  end
18
23
  end
@@ -0,0 +1,5 @@
1
+ module RushJob
2
+ module DashboardHelper
3
+ include Pagy::Frontend
4
+ end
5
+ end
@@ -6,7 +6,7 @@ module RushJob
6
6
 
7
7
  def sortable(column)
8
8
  direction = column == sort_column && sort_direction == 'asc' ? 'desc' : 'asc'
9
- link_to t(column), rush_job.root_path({ sort: column, direction: }), class: "link-#{invert_theme}"
9
+ link_to t(column), rush_job.rush_jobs_path({ sort: column, direction: }), class: "link-#{invert_theme}"
10
10
  end
11
11
 
12
12
  def sort_arrow(column)
@@ -2,6 +2,9 @@ module RushJob
2
2
  class RushJob < ApplicationRecord
3
3
  self.table_name = 'delayed_jobs'
4
4
 
5
+ scope :locked_jobs, -> { where.not(locked_at: nil).order(locked_at: :desc) }
6
+ scope :queue_groups, -> { group(:queue, :priority).order(:priority).count }
7
+
5
8
  def job_class
6
9
  job_data[:job_class]
7
10
  end
@@ -0,0 +1,32 @@
1
+ <div class="bs-component mb-1">
2
+ <nav class="navbar navbar-expand-lg bg-primary"
3
+ data-bs-theme="dark"
4
+ aria-label="Navigation">
5
+ <div class="container-fluid">
6
+ <%= link_to t(:delayed_title), root_path, class: "navbar-brand" %>
7
+ <button class="navbar-toggler"
8
+ type="button"
9
+ data-bs-toggle="collapse"
10
+ data-bs-target="#rush-job-navbar-links"
11
+ aria-controls="rush-job-navbar-links"
12
+ aria-expanded="false"
13
+ aria-label="Toggle navigation">
14
+ <span class="navbar-toggler-icon"></span>
15
+ </button>
16
+
17
+ <div class="collapse navbar-collapse" id="rush-job-navbar-links">
18
+ <ul class="navbar-nav me-auto">
19
+ <li class="nav-item">
20
+ <%= link_to t(:dashboard), root_path, class: "nav-link" %>
21
+ </li>
22
+ <li class="nav-item">
23
+ <%= link_to t(:jobs), rush_jobs_path, class: "nav-link" %>
24
+ </li>
25
+ <li class="nav-item">
26
+ <%= link_to t("#{invert_theme}_mode"), theme_path, class: "nav-link", method: :patch %>
27
+ </li>
28
+ </ul>
29
+ </div>
30
+ </div>
31
+ </nav>
32
+ </div>
@@ -11,6 +11,7 @@
11
11
  <%= stylesheet_link_tag "rush_job/application", media: "all" %>
12
12
  </head>
13
13
  <body class="background-color-<%= current_theme %>">
14
+ <%= render 'layouts/rush_job/navbar' %>
14
15
  <% flash.each do |type, msg| %>
15
16
  <div class="alert alert-<%= invert_theme %>" role="alert">
16
17
  <%= msg %>
@@ -0,0 +1,75 @@
1
+ <div id="rush-job-jobs-container"
2
+ class="jobs-container"
3
+ role="main">
4
+ <div class="d-flex justify-content-left">
5
+ <h2 class="color-<%= invert_theme %>"><%= t :locked_jobs %></h2>
6
+ </div>
7
+ <div id="rush-job-dashboard-locked-jobs" class="mb-2 d-flex justify-content-left">
8
+ <div class="table-responsive">
9
+ <table class="table
10
+ table-bordered
11
+ table-striped
12
+ table-<%= current_theme %>">
13
+ <thead>
14
+ <tr>
15
+ <th><%= t :id %></th>
16
+ <th><%= t :locked_at %></th>
17
+ <th><%= t :locked_by %></th>
18
+ <th><%= t :job_class %></th>
19
+ <th><%= t :arguments %></th>
20
+ </tr>
21
+ </thead>
22
+ <tbody class="table-group-divider">
23
+ <% @locked_jobs.each do |job| %>
24
+ <tr>
25
+ <td><%= job.id %></td>
26
+ <td><%= job.locked_at %></td>
27
+ <td><%= job.locked_by %></td>
28
+ <td><%= job.job_class %></td>
29
+ <td><%= job.job_arguments %></td>
30
+ </tr>
31
+ <% end %>
32
+ </tbody>
33
+ </table>
34
+ </div>
35
+ </div>
36
+ <div id="rush-job-locked-job-pagination"
37
+ class="d-flex justify-content-left"
38
+ data-bs-theme="<%= current_theme %>">
39
+ <%== pagy_bootstrap_nav(@pagy_locked_jobs) if @pagy_locked_jobs.pages > 1 %>
40
+ </div>
41
+
42
+ <div class="d-flex justify-content-left">
43
+ <h2 class="color-<%= invert_theme %>"><%= t :queues %></h2>
44
+ </div>
45
+ <div id="rush-job-dashboard-queues" class="d-flex justify-content-left">
46
+ <div class="table-responsive">
47
+ <table class="table
48
+ table-bordered
49
+ table-striped
50
+ table-<%= current_theme %>">
51
+ <thead>
52
+ <tr>
53
+ <th><%= t :name %></th>
54
+ <th><%= t :priority %></th>
55
+ <th><%= t :count %></th>
56
+ </tr>
57
+ </thead>
58
+ <tbody class="table-group-divider">
59
+ <% @job_queues.each do |queue| %>
60
+ <tr>
61
+ <td><%= queue[0] %></td>
62
+ <td><%= queue[1] %></td>
63
+ <td><%= @queue_groups[queue] %></td>
64
+ </tr>
65
+ <% end %>
66
+ </tbody>
67
+ </table>
68
+ </div>
69
+ </div>
70
+ <div id="rush-job-locked-queue-pagination"
71
+ class="d-flex justify-content-left"
72
+ data-bs-theme="<%= current_theme %>">
73
+ <%== pagy_bootstrap_nav(@pagy_queue) if @pagy_queue.pages > 1 %>
74
+ </div>
75
+ </div>
@@ -0,0 +1,5 @@
1
+ <%= render 'rush_job/shared/polling' %>
2
+
3
+ <div id="rush-job-jobs">
4
+ <%= render 'dashboard_tables' %>
5
+ </div>
@@ -0,0 +1 @@
1
+ document.getElementById('rush-job-jobs').innerHTML = "<%= j (render partial: 'dashboard_tables') %>"
@@ -0,0 +1,47 @@
1
+ <div id="rush-job-jobs-container"
2
+ class="jobs-container"
3
+ role="main">
4
+ <div class="table-responsive">
5
+ <table class="table
6
+ table-bordered
7
+ table-striped
8
+ table-<%= current_theme %>">
9
+ <thead>
10
+ <tr>
11
+ <th><%= sortable 'id' %><%= sort_arrow 'id' %></th>
12
+ <th><%= sortable 'priority' %><%= sort_arrow 'priority' %></th>
13
+ <th><%= sortable 'attempts' %><%= sort_arrow 'attempts' %></th>
14
+ <th><%= t :job_class %></th>
15
+ <th><%= t :arguments %></th>
16
+ <th><%= sortable 'last_error' %><%= sort_arrow 'last_error' %></th>
17
+ <th><%= sortable 'run_at' %><%= sort_arrow 'run_at' %></th>
18
+ <th><%= sortable 'locked_at' %><%= sort_arrow 'locked_at' %></th>
19
+ <th><%= sortable 'failed_at' %><%= sort_arrow 'failed_at' %></th>
20
+ <th><%= sortable 'locked_by' %><%= sort_arrow'locked_by' %></th>
21
+ <th><%= sortable 'queue' %><%= sort_arrow 'queue' %></th>
22
+ </tr>
23
+ </thead>
24
+ <tbody class="table-group-divider">
25
+ <% @rush_jobs.each do |job| %>
26
+ <tr>
27
+ <td><%= job.id %></td>
28
+ <td><%= job.priority %></td>
29
+ <td><%= job.attempts %></td>
30
+ <td><%= job.job_class %></td>
31
+ <td><%= job.job_arguments %></td>
32
+ <td><%= job.last_error %></td>
33
+ <td><%= job.run_at %></td>
34
+ <td><%= job.locked_at %></td>
35
+ <td><%= job.failed_at %></td>
36
+ <td><%= job.locked_by %></td>
37
+ <td><%= job.queue %></td>
38
+ </tr>
39
+ <% end %>
40
+ </tbody>
41
+ </table>
42
+ </div>
43
+ </div>
44
+
45
+ <div class="footer-container" data-bs-theme="<%= current_theme %>">
46
+ <%== pagy_bootstrap_nav(@pagy) if @pagy.pages > 1 %>
47
+ </div>
@@ -1,70 +1,5 @@
1
- <div class="header-container" role="heading" aria-level="1">
2
- <div class="container text-center">
3
- <div class="row align-items-center">
4
- <div class="col-6" role="banner">
5
- <h2 class="delayed_title">
6
- <%= t :delayed_title %>
7
- </h2>
8
- </div>
9
- <div class="col-3">
10
- <button
11
- type="button"
12
- class="btn btn-primary"
13
- onclick="location.reload();">
14
- <%= t :reload %>
15
- </button>
16
- </div>
17
- <div class="col-3">
18
- <%= form_with url: theme_path, method: 'patch' do |form| %>
19
- <%= form.button "#{invert_theme.titleize} Mode", class: "btn btn-#{invert_theme}" %>
20
- <% end %>
21
- </div>
22
- </div>
23
- </div>
24
- </div>
25
-
26
- <div class="jobs-container" role="main">
27
- <div class="table-responsive">
28
- <table class="table
29
- table-bordered
30
- table-striped
31
- table-<%= current_theme %>">
32
- <thead>
33
- <tr>
34
- <th><%= sortable 'id' %><%= sort_arrow 'id' %></th>
35
- <th><%= sortable 'priority' %><%= sort_arrow 'priority' %></th>
36
- <th><%= sortable 'attempts' %><%= sort_arrow 'attempts' %></th>
37
- <th><%= t :job_class %></th>
38
- <th><%= t :arguments %></th>
39
- <th><%= sortable 'last_error' %><%= sort_arrow 'last_error' %></th>
40
- <th><%= sortable 'run_at' %><%= sort_arrow 'run_at' %></th>
41
- <th><%= sortable 'locked_at' %><%= sort_arrow 'locked_at' %></th>
42
- <th><%= sortable 'failed_at' %><%= sort_arrow 'failed_at' %></th>
43
- <th><%= sortable 'locked_by' %><%= sort_arrow'locked_by' %></th>
44
- <th><%= sortable 'queue' %><%= sort_arrow 'queue' %></th>
45
- </tr>
46
- </thead>
47
- <tbody class="table-group-divider">
48
- <% @rush_jobs.each do |job| %>
49
- <tr>
50
- <td><%= job.id %></td>
51
- <td><%= job.priority %></td>
52
- <td><%= job.attempts %></td>
53
- <td><%= job.job_class %></td>
54
- <td><%= job.job_arguments %></td>
55
- <td><%= job.last_error %></td>
56
- <td><%= job.run_at %></td>
57
- <td><%= job.locked_at %></td>
58
- <td><%= job.failed_at %></td>
59
- <td><%= job.locked_by %></td>
60
- <td><%= job.queue %></td>
61
- </tr>
62
- <% end %>
63
- </tbody>
64
- </table>
65
- </div>
66
- </div>
1
+ <%= render 'rush_job/shared/polling' %>
67
2
 
68
- <div class="footer-container">
69
- <%== pagy_bootstrap_nav(@pagy) if @pagy.pages > 1 %>
3
+ <div id="rush-job-jobs">
4
+ <%= render 'jobs_table' %>
70
5
  </div>
@@ -0,0 +1 @@
1
+ document.getElementById('rush-job-jobs').innerHTML = "<%= j (render partial: 'jobs_table') %>"
@@ -0,0 +1,32 @@
1
+ <div class="polling-container" data-controller="rush-job-polling">
2
+ <div class="row align-items-center">
3
+ <div class="col-3">
4
+ <label for="rush-job-polling-range"
5
+ class="polling-range-form-label-<%= invert_theme %>"
6
+ data-rush-job-polling-target="pollingTimeLabel">
7
+ <%= t :polling_time %> 13 <%= t :polling_time_unit %>
8
+ </label>
9
+ <input id="rush-job-polling-range"
10
+ type="range"
11
+ class="form-range"
12
+ min="0"
13
+ max="6"
14
+ data-rush-job-polling-target="pollingTime"
15
+ data-action="input->rush-job-polling#pollingChange">
16
+ </div>
17
+ <div class="col-3">
18
+ <div class="form-check form-switch">
19
+ <input id="rush-job-polling"
20
+ class="form-check-input"
21
+ type="checkbox"
22
+ role="switch"
23
+ data-rush-job-polling-target="pollingSlide"
24
+ data-action="input->rush-job-polling#pollingToggle">
25
+ <label class="form-check-label-<%= invert_theme %>" for="rush-job-polling"><%= t :enable_polling %></label>
26
+ </div>
27
+ </div>
28
+ <div class="col-3" data-controller="rush-job-reload-jobs-table">
29
+ <button class="btn btn-primary" data-action="click->rush-job-reload-jobs-table#reloadJobs"><%= t :reload %></button>
30
+ </div>
31
+ </div>
32
+ </div>
data/config/importmap.rb CHANGED
@@ -1,3 +1,5 @@
1
1
  pin 'rush_job/application', preload: true
2
2
  pin 'bootstrap', to: 'https://ga.jspm.io/npm:bootstrap@5.3.1/dist/js/bootstrap.esm.js'
3
3
  pin '@popperjs/core', to: 'https://ga.jspm.io/npm:@popperjs/core@2.11.8/lib/index.js'
4
+ pin '@rails/ujs', to: 'https://ga.jspm.io/npm:@rails/ujs@7.0.6/lib/assets/compiled/rails-ujs.js'
5
+ pin '@hotwired/stimulus', to: 'https://ga.jspm.io/npm:@hotwired/stimulus@3.2.2/dist/stimulus.js'
@@ -1,15 +1,26 @@
1
1
  en:
2
2
  arguments: "Arguments"
3
3
  attempts: "Attempts"
4
- delayed_title: "Delayed jobs"
4
+ count: "Count"
5
+ dark_mode: "Dark Mode"
6
+ dashboard: "Dashboard"
7
+ delayed_title: "Delayed Jobs"
8
+ enable_polling: "Enable polling"
5
9
  failed_at: "Failed at"
6
10
  id: "Id"
7
11
  invalid_page_notice: "No jobs on that page, redirected to first page."
8
12
  job_class: "Job class"
13
+ jobs: "Jobs"
9
14
  last_error: "Last error"
15
+ light_mode: "Light Mode"
10
16
  locked_at: "Locked at"
11
17
  locked_by: "Locked by"
18
+ locked_jobs: "Locked Jobs"
19
+ name: "Name"
20
+ polling_time: "Polling time:"
21
+ polling_time_unit: "seconds"
12
22
  priority: "Priority"
13
23
  queue: "Queue"
24
+ queues: "Queues"
14
25
  reload: "Reload"
15
- run_at: "Run at"
26
+ run_at: "Run at"
data/config/routes.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  RushJob::Engine.routes.draw do
2
- root 'rush_jobs#index'
2
+ root 'dashboard#index'
3
+ get '/rush_jobs', to: 'rush_jobs#index'
3
4
  patch '/theme', to: 'themes#update'
4
5
  end
@@ -1,6 +1,7 @@
1
1
  module RushJob
2
2
  require 'importmap-rails'
3
3
  require 'pagy'
4
+ require 'pagy/extras/array'
4
5
  require 'pagy/extras/bootstrap'
5
6
  require 'sassc-rails'
6
7
 
@@ -1,3 +1,3 @@
1
1
  module RushJob
2
- VERSION = '0.3.2'.freeze
2
+ VERSION = '0.5.0'.freeze
3
3
  end
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.3.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JavaKoala
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-04 00:00:00.000000000 Z
11
+ date: 2023-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -292,20 +292,34 @@ files:
292
292
  - app/assets/images/rush_job/arrow-up-dark.svg
293
293
  - app/assets/images/rush_job/arrow-up-light.svg
294
294
  - app/assets/javascript/rush_job/application.js
295
+ - app/assets/javascript/rush_job/controllers/rush_job_polling_controller.js
296
+ - app/assets/javascript/rush_job/controllers/rush_job_reload_jobs_table_controller.js
297
+ - app/assets/javascript/rush_job/controllers/rush_job_table_update_controller.js
295
298
  - app/assets/stylesheets/rush_job/application.scss
296
- - app/assets/stylesheets/rush_job/pages/_index.scss
299
+ - app/assets/stylesheets/rush_job/components/_pagination.scss
300
+ - app/assets/stylesheets/rush_job/components/_polling.scss
301
+ - app/assets/stylesheets/rush_job/pages/_rush_jobs_index.scss
297
302
  - app/assets/stylesheets/rush_job/themes/_dark.scss
298
303
  - app/assets/stylesheets/rush_job/themes/_light.scss
299
304
  - app/controllers/rush_job/application_controller.rb
305
+ - app/controllers/rush_job/dashboard_controller.rb
300
306
  - app/controllers/rush_job/rush_jobs_controller.rb
301
307
  - app/controllers/rush_job/themes_controller.rb
302
308
  - app/helpers/rush_job/application_helper.rb
309
+ - app/helpers/rush_job/dashboard_helper.rb
303
310
  - app/helpers/rush_job/rush_jobs_helper.rb
304
311
  - app/helpers/rush_job/sort_helper.rb
305
312
  - app/models/rush_job/application_record.rb
306
313
  - app/models/rush_job/rush_job.rb
314
+ - app/views/layouts/rush_job/_navbar.html.erb
307
315
  - app/views/layouts/rush_job/application.html.erb
316
+ - app/views/rush_job/dashboard/_dashboard_tables.html.erb
317
+ - app/views/rush_job/dashboard/index.html.erb
318
+ - app/views/rush_job/dashboard/index.js.erb
319
+ - app/views/rush_job/rush_jobs/_jobs_table.html.erb
308
320
  - app/views/rush_job/rush_jobs/index.html.erb
321
+ - app/views/rush_job/rush_jobs/index.js.erb
322
+ - app/views/rush_job/shared/_polling.html.erb
309
323
  - config/importmap.rb
310
324
  - config/locales/en.yml
311
325
  - config/routes.rb
@@ -1,35 +0,0 @@
1
- .header-container {
2
- background-color: #d3d3d3;
3
- border-radius: 10px;
4
- margin-top: 1em;
5
- margin-bottom: 1em;
6
- margin-left: 5%;
7
- margin-right: 5%;
8
- }
9
-
10
- .delayed_title {
11
- margin-top: 0.5rem;
12
- }
13
-
14
- .jobs-container {
15
- margin-left: 5%;
16
- margin-right: 5%;
17
- }
18
-
19
- .footer-container {
20
- margin-left: 5%;
21
- margin-right: 5%;
22
- float: right;
23
- }
24
-
25
- .page-link.disabled, .disabled > .page-link {
26
- color: rgb(68, 110, 155);
27
- }
28
-
29
- .page-item:first-child .page-link {
30
- color: rgb(68, 110, 155);
31
- }
32
-
33
- .page-item:last-child .page-link {
34
- color: rgb(68, 110, 155);
35
- }