rush_job_mongoid 1.0.0
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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +60 -0
- data/Rakefile +5 -0
- data/app/assets/config/rush_job_mongoid_manifest.js +4 -0
- data/app/assets/images/rush_job_mongoid/funnel-fill.svg +3 -0
- data/app/assets/images/rush_job_mongoid/funnel.svg +3 -0
- data/app/assets/images/rush_job_mongoid/pencil-square-dark.svg +4 -0
- data/app/assets/images/rush_job_mongoid/pencil-square-light.svg +4 -0
- data/app/assets/javascript/rush_job_mongoid/application.js +13 -0
- data/app/assets/javascript/rush_job_mongoid/controllers/rush_job_mongoid_filters_controller.js +9 -0
- data/app/assets/javascript/rush_job_mongoid/controllers/rush_job_mongoid_polling_controller.js +50 -0
- data/app/assets/javascript/rush_job_mongoid/controllers/rush_job_mongoid_reload_jobs_table_controller.js +7 -0
- data/app/assets/javascript/rush_job_mongoid/controllers/rush_job_mongoid_table_update_controller.js +19 -0
- data/app/assets/stylesheets/rush_job_mongoid/application.scss +16 -0
- data/app/assets/stylesheets/rush_job_mongoid/components/_polling.scss +3 -0
- data/app/assets/stylesheets/rush_job_mongoid/layout/_container.scss +4 -0
- data/app/controllers/rush_job_mongoid/application_controller.rb +5 -0
- data/app/controllers/rush_job_mongoid/dashboard_controller.rb +28 -0
- data/app/controllers/rush_job_mongoid/rush_jobs_controller.rb +57 -0
- data/app/controllers/rush_job_mongoid/settings_controller.rb +18 -0
- data/app/helpers/rush_job_mongoid/application_helper.rb +6 -0
- data/app/helpers/rush_job_mongoid/filter_helper.rb +20 -0
- data/app/helpers/rush_job_mongoid/settings_helper.rb +19 -0
- data/app/models/rush_job_mongoid/rush_job.rb +83 -0
- data/app/presenters/rush_job_mongoid/pagination_presenter.rb +17 -0
- data/app/presenters/rush_job_mongoid/queue_groups_presenter.rb +25 -0
- data/app/services/rush_job_mongoid/locked_jobs.rb +15 -0
- data/app/services/rush_job_mongoid/settings.rb +19 -0
- data/app/views/layouts/rush_job_mongoid/_filter_modal.html.erb +58 -0
- data/app/views/layouts/rush_job_mongoid/_flash_messages.html.erb +5 -0
- data/app/views/layouts/rush_job_mongoid/_navbar.html.erb +72 -0
- data/app/views/layouts/rush_job_mongoid/application.html.erb +24 -0
- data/app/views/rush_job_mongoid/dashboard/_dashboard_tables.html.erb +34 -0
- data/app/views/rush_job_mongoid/dashboard/_queues_table.html.erb +39 -0
- data/app/views/rush_job_mongoid/dashboard/index.html.erb +7 -0
- data/app/views/rush_job_mongoid/dashboard/index.js.erb +3 -0
- data/app/views/rush_job_mongoid/rush_jobs/_jobs_table.html.erb +43 -0
- data/app/views/rush_job_mongoid/rush_jobs/edit.html.erb +51 -0
- data/app/views/rush_job_mongoid/rush_jobs/index.html.erb +7 -0
- data/app/views/rush_job_mongoid/rush_jobs/index.js.erb +3 -0
- data/app/views/rush_job_mongoid/shared/_pagination.html.erb +89 -0
- data/app/views/rush_job_mongoid/shared/_pagination_link.html.erb +3 -0
- data/app/views/rush_job_mongoid/shared/_polling.html.erb +32 -0
- data/config/importmap.rb +5 -0
- data/config/locales/en.yml +46 -0
- data/config/routes.rb +7 -0
- data/lib/rush_job_mongoid/engine.rb +23 -0
- data/lib/rush_job_mongoid/version.rb +3 -0
- data/lib/rush_job_mongoid.rb +6 -0
- data/lib/tasks/rush_job_mongoid_tasks.rake +4 -0
- data/vendor/stylesheets/rush_job_mongoid/bootstrap.css +12273 -0
- metadata +364 -0
| @@ -0,0 +1,72 @@ | |
| 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),
         | 
| 21 | 
            +
                            root_path(filter_param_query),
         | 
| 22 | 
            +
                            class: "nav-link#{' active' if current_page?(root_path)}" %>
         | 
| 23 | 
            +
                      </li>
         | 
| 24 | 
            +
                      <li class="nav-item">
         | 
| 25 | 
            +
                        <%= link_to t(:jobs),
         | 
| 26 | 
            +
                            rush_jobs_path(filter_param_query),
         | 
| 27 | 
            +
                            class: "nav-link#{' active' if current_page?(rush_jobs_path)}" %>
         | 
| 28 | 
            +
                      </li>
         | 
| 29 | 
            +
                      <li class="nav-item">
         | 
| 30 | 
            +
                        <a class="nav-link"
         | 
| 31 | 
            +
                           data-bs-toggle="modal"
         | 
| 32 | 
            +
                           data-bs-target="#rush-job-mongoid-filter-modal"
         | 
| 33 | 
            +
                           href="#">
         | 
| 34 | 
            +
                           <%= t(:filter) %>
         | 
| 35 | 
            +
                           <% if filter_param_query_empty? %>
         | 
| 36 | 
            +
                             <%= image_tag("rush_job_mongoid/funnel.svg", alt: 'funnel') %>
         | 
| 37 | 
            +
                           <% else %>
         | 
| 38 | 
            +
                             <%= image_tag("rush_job_mongoid/funnel-fill.svg", alt: 'funnel filled') %>
         | 
| 39 | 
            +
                           <% end %>
         | 
| 40 | 
            +
                        </a>
         | 
| 41 | 
            +
                      </li>
         | 
| 42 | 
            +
                      <li class="nav-item dropdown">
         | 
| 43 | 
            +
                        <a class="nav-link dropdown-toggle"
         | 
| 44 | 
            +
                           data-bs-toggle="dropdown"
         | 
| 45 | 
            +
                           href="#" role="button"
         | 
| 46 | 
            +
                           aria-haspopup="true"
         | 
| 47 | 
            +
                           aria-expanded="false">
         | 
| 48 | 
            +
                           Options
         | 
| 49 | 
            +
                        </a>
         | 
| 50 | 
            +
                        <div class="dropdown-menu"
         | 
| 51 | 
            +
                             data-bs-popper="static">
         | 
| 52 | 
            +
                          <%= button_to t("#{invert_theme}_mode"), settings_path, class: "nav-link", method: :patch, params: { setting: 'theme' } %>
         | 
| 53 | 
            +
                          <%= button_to t("#{editing_enabled? ? 'disable_editing' : 'enable_editing'}"),
         | 
| 54 | 
            +
                                        settings_path,
         | 
| 55 | 
            +
                                        class: "nav-link",
         | 
| 56 | 
            +
                                        method: :patch,
         | 
| 57 | 
            +
                                        params: { setting: 'editing' },
         | 
| 58 | 
            +
                                        data: { confirm: t("#{editing_enabled? ? 'disable_editing_confirmation' : 'enable_editing_confirmation'}") } %>
         | 
| 59 | 
            +
                          <%= button_to t("#{queue_groups_enabled? ? 'disable_queues' : 'enable_queues'}"),
         | 
| 60 | 
            +
                                        settings_path,
         | 
| 61 | 
            +
                                        class: "nav-link",
         | 
| 62 | 
            +
                                        method: :patch,
         | 
| 63 | 
            +
                                        params: { setting: 'queue_groups_presenter' } %>
         | 
| 64 | 
            +
                        </div>
         | 
| 65 | 
            +
                      </li>
         | 
| 66 | 
            +
                    </ul>
         | 
| 67 | 
            +
                  </div>
         | 
| 68 | 
            +
                </div>
         | 
| 69 | 
            +
              </nav>
         | 
| 70 | 
            +
            </div>
         | 
| 71 | 
            +
             | 
| 72 | 
            +
            <%= render 'layouts/rush_job_mongoid/filter_modal' %>
         | 
| @@ -0,0 +1,24 @@ | |
| 1 | 
            +
            <!DOCTYPE html>
         | 
| 2 | 
            +
            <html>
         | 
| 3 | 
            +
            <head>
         | 
| 4 | 
            +
              <title>Rush job mongoid</title>
         | 
| 5 | 
            +
              <%= csrf_meta_tags %>
         | 
| 6 | 
            +
              <%= csp_meta_tag %>
         | 
| 7 | 
            +
             | 
| 8 | 
            +
              <%= javascript_importmap_tags %>
         | 
| 9 | 
            +
              <%= javascript_import_module_tag "rush_job_mongoid/application" %>
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              <%= stylesheet_link_tag "rush_job_mongoid/application", media: "all" %>
         | 
| 12 | 
            +
            </head>
         | 
| 13 | 
            +
            <body data-bs-theme=<%= current_theme %>>
         | 
| 14 | 
            +
              <%= render 'layouts/rush_job_mongoid/navbar' %>
         | 
| 15 | 
            +
              <div id="rush-job-mongoid-flash-messages">
         | 
| 16 | 
            +
                <%= render 'layouts/rush_job_mongoid/flash_messages' %>
         | 
| 17 | 
            +
              </div>
         | 
| 18 | 
            +
             | 
| 19 | 
            +
              <div class="jobs-container">
         | 
| 20 | 
            +
                <%= yield %>
         | 
| 21 | 
            +
              </div>
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            </body>
         | 
| 24 | 
            +
            </html>
         | 
| @@ -0,0 +1,34 @@ | |
| 1 | 
            +
            <div id="rush-job-mongoid-dashboard-locked-jobs">
         | 
| 2 | 
            +
              <div class="d-flex justify-content-left">
         | 
| 3 | 
            +
                <div class="table-responsive">
         | 
| 4 | 
            +
                  <table class="table table-bordered table-striped">
         | 
| 5 | 
            +
                    <thead>
         | 
| 6 | 
            +
                      <tr>
         | 
| 7 | 
            +
                        <th><%= t :id %></th>
         | 
| 8 | 
            +
                        <th><%= t :locked_at %></th>
         | 
| 9 | 
            +
                        <th><%= t :locked_by %></th>
         | 
| 10 | 
            +
                        <th><%= t :job_class %></th>
         | 
| 11 | 
            +
                        <th><%= t :arguments %></th>
         | 
| 12 | 
            +
                      </tr>
         | 
| 13 | 
            +
                    </thead>
         | 
| 14 | 
            +
                    <tbody>
         | 
| 15 | 
            +
                      <% @locked_jobs.paginate(@locked_jobs_presenter.page).each do |job| %>
         | 
| 16 | 
            +
                        <tr>
         | 
| 17 | 
            +
                          <td><%= job.id %></td>
         | 
| 18 | 
            +
                          <td><%= job.locked_at %></td>
         | 
| 19 | 
            +
                          <td><%= job.locked_by %></td>
         | 
| 20 | 
            +
                          <td><%= job.job_class %></td>
         | 
| 21 | 
            +
                          <td><%= job.job_arguments %></td>
         | 
| 22 | 
            +
                        </tr>
         | 
| 23 | 
            +
                      <% end %>
         | 
| 24 | 
            +
                    </tbody>
         | 
| 25 | 
            +
                  </table>
         | 
| 26 | 
            +
                </div>
         | 
| 27 | 
            +
              </div>
         | 
| 28 | 
            +
             | 
| 29 | 
            +
              <%= render 'rush_job_mongoid/shared/pagination', controller: 'dashboard', pagination_param: 'locked_jobs_page', pages_count: @locked_jobs_presenter.pages(@locked_jobs.jobs.count, 10), page: @locked_jobs_presenter.page %>
         | 
| 30 | 
            +
            </div>
         | 
| 31 | 
            +
             | 
| 32 | 
            +
            <% if queue_groups_enabled? %>
         | 
| 33 | 
            +
              <%= render 'queues_table' %>
         | 
| 34 | 
            +
            <% end %>
         | 
| @@ -0,0 +1,39 @@ | |
| 1 | 
            +
            <h3 class="text-body"><%= t :queues %></h3>
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            <div id="rush-job-mongoid-dashboard-queues">
         | 
| 4 | 
            +
              <div class="d-flex justify-content-left">
         | 
| 5 | 
            +
                <div class="table-responsive">
         | 
| 6 | 
            +
                  <table class="table table-bordered table-striped">
         | 
| 7 | 
            +
                    <thead>
         | 
| 8 | 
            +
                      <tr>
         | 
| 9 | 
            +
                        <th><%= t :name %></th>
         | 
| 10 | 
            +
                        <th><%= t :priority %></th>
         | 
| 11 | 
            +
                        <th><%= t :count %></th>
         | 
| 12 | 
            +
                        <% if editing_enabled? %>
         | 
| 13 | 
            +
                          <th><%= t :clear %></th>
         | 
| 14 | 
            +
                        <% end %>
         | 
| 15 | 
            +
                      </tr>
         | 
| 16 | 
            +
                    </thead>
         | 
| 17 | 
            +
                    <tbody>
         | 
| 18 | 
            +
                      <% @queues_presenter.queue_groups.each do |group| %>
         | 
| 19 | 
            +
                        <tr>
         | 
| 20 | 
            +
                          <td><%= group[:queue] %></td>
         | 
| 21 | 
            +
                          <td><%= group[:priority] %></td>
         | 
| 22 | 
            +
                          <td><%= group[:count] %></td>
         | 
| 23 | 
            +
                          <% if editing_enabled? %>
         | 
| 24 | 
            +
                            <td><%= button_to t(:clear),
         | 
| 25 | 
            +
                                              dashboard_path,
         | 
| 26 | 
            +
                                              class: "btn btn-danger btn-sm",
         | 
| 27 | 
            +
                                              method: :delete,
         | 
| 28 | 
            +
                                              params: { queue: group[:queue], priority: group[:priority] },
         | 
| 29 | 
            +
                                              data: { confirm: t(:clear_queue_confirmation, queue: group[:queue]) } %></td>
         | 
| 30 | 
            +
                          <% end %>
         | 
| 31 | 
            +
                        </tr>
         | 
| 32 | 
            +
                      <% end %>
         | 
| 33 | 
            +
                    </tbody>
         | 
| 34 | 
            +
                  </table>
         | 
| 35 | 
            +
                </div>
         | 
| 36 | 
            +
              </div>
         | 
| 37 | 
            +
             | 
| 38 | 
            +
              <%= render 'rush_job_mongoid/shared/pagination', controller: 'dashboard', pagination_param: 'queue_groups_page', pages_count: @queues_presenter.pages_count, page: @queues_presenter.page %>
         | 
| 39 | 
            +
            </div>
         | 
| @@ -0,0 +1,3 @@ | |
| 1 | 
            +
            document.getElementById('rush-job-mongoid-flash-messages').innerHTML = "<%= j (render partial: 'layouts/rush_job_mongoid/flash_messages') %>"
         | 
| 2 | 
            +
            document.getElementById('rush-job-mongoid-jobs').innerHTML = "<%= j (render partial: 'dashboard_tables') %>"
         | 
| 3 | 
            +
            document.getElementById('rush-job-mongoid-jobs').classList.remove('table-refresh');
         | 
| @@ -0,0 +1,43 @@ | |
| 1 | 
            +
            <table class="table table-bordered table-striped">
         | 
| 2 | 
            +
              <thead>
         | 
| 3 | 
            +
                <tr>
         | 
| 4 | 
            +
                  <% if editing_enabled? %>
         | 
| 5 | 
            +
                    <th></th>
         | 
| 6 | 
            +
                  <% end %>
         | 
| 7 | 
            +
                  <th><%= t :priority %></th>
         | 
| 8 | 
            +
                  <th><%= t :attempts %></th>
         | 
| 9 | 
            +
                  <th><%= t :job_class %></th>
         | 
| 10 | 
            +
                  <th><%= t :arguments %></th>
         | 
| 11 | 
            +
                  <th><%= t :run_at %></th>
         | 
| 12 | 
            +
                  <th><%= t :locked_at %></th>
         | 
| 13 | 
            +
                  <th><%= t :locked_by %></th>
         | 
| 14 | 
            +
                  <th><%= t :failed_at %></th>
         | 
| 15 | 
            +
                  <th><%= t :last_error %></th>
         | 
| 16 | 
            +
                  <th><%= t :queue %></th>
         | 
| 17 | 
            +
                </tr>
         | 
| 18 | 
            +
              </thead>
         | 
| 19 | 
            +
              <tbody>
         | 
| 20 | 
            +
                <% @rush_jobs.each do |job| %>
         | 
| 21 | 
            +
                  <tr>
         | 
| 22 | 
            +
                    <% if editing_enabled? %>
         | 
| 23 | 
            +
                      <td><%= link_to image_tag("rush_job_mongoid/pencil-square-#{invert_theme}.svg", id: "rush-job-mongoid-pencil-square-#{job.id}", alt: 'pencil square'), edit_rush_job_path(job.id) %></td>
         | 
| 24 | 
            +
                    <% end %>
         | 
| 25 | 
            +
                    <td><%= job.priority %></td>
         | 
| 26 | 
            +
                    <td><%= job.attempts %></td>
         | 
| 27 | 
            +
                    <td><%= job.job_class %></td>
         | 
| 28 | 
            +
                    <td><%= job.job_arguments %></td>
         | 
| 29 | 
            +
                    <td><%= job.run_at %></td>
         | 
| 30 | 
            +
                    <td><%= job.locked_at %></td>
         | 
| 31 | 
            +
                    <td><%= job.locked_by %></td>
         | 
| 32 | 
            +
                    <td><%= job.failed_at %></td>
         | 
| 33 | 
            +
                    <td><%= job.last_error %></td>
         | 
| 34 | 
            +
                    <td><%= job.queue %></td>
         | 
| 35 | 
            +
                  </tr>
         | 
| 36 | 
            +
                <% end %>
         | 
| 37 | 
            +
              </tbody>
         | 
| 38 | 
            +
            </table>
         | 
| 39 | 
            +
             | 
| 40 | 
            +
            <%= render 'rush_job_mongoid/shared/pagination', controller: 'rush_jobs',
         | 
| 41 | 
            +
                                                             pagination_param: 'page',
         | 
| 42 | 
            +
                                                             pages_count: @pagination_presenter.pages(RushJobMongoid::RushJob.filter(filter_param_query).count, 20),
         | 
| 43 | 
            +
                                                             page: @pagination_presenter.page %>
         | 
| @@ -0,0 +1,51 @@ | |
| 1 | 
            +
            <h3 class="text-body">Edit Job <%= @job.id %></h3>
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            <%= link_to 'Back', :back, class: 'btn btn-primary btn-sm mb-3' %>
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            <%= form_with model: @job do |form| %>
         | 
| 6 | 
            +
              <div class="mb-3 w-25">
         | 
| 7 | 
            +
                <%= form.label :priority, t(:priority), class: 'form-label' %>
         | 
| 8 | 
            +
                <%= form.number_field :priority, class: 'form-control' %>
         | 
| 9 | 
            +
              </div>
         | 
| 10 | 
            +
              <div class="mb-3 w-25">
         | 
| 11 | 
            +
                <%= form.label :attempts, t(:attempts), class: 'form-label' %>
         | 
| 12 | 
            +
                <%= form.number_field :attempts, class: 'form-control' %>
         | 
| 13 | 
            +
              </div>
         | 
| 14 | 
            +
              <div class="mb-3 w-75">
         | 
| 15 | 
            +
                <%= form.label :handler, t(:handler), class: 'form-label' %>
         | 
| 16 | 
            +
                <%= form.text_area :handler, rows: 15, class: 'form-control' %>
         | 
| 17 | 
            +
              </div>
         | 
| 18 | 
            +
              <div class="mb-3 w-25">
         | 
| 19 | 
            +
                <%= form.label :run_at, t(:run_at), class: 'form-label' %>
         | 
| 20 | 
            +
                <%= form.datetime_local_field :run_at, class: 'form-control', step: 1 %>
         | 
| 21 | 
            +
              </div>
         | 
| 22 | 
            +
              <div class="mb-3 w-25">
         | 
| 23 | 
            +
                <%= form.label :locked_at, t(:locked_at), class: 'form-label' %>
         | 
| 24 | 
            +
                <%= form.datetime_local_field :locked_at, class: 'form-control', step: 1 %>
         | 
| 25 | 
            +
              </div>
         | 
| 26 | 
            +
              <div class="mb-3 w-25">
         | 
| 27 | 
            +
                <%= form.label :locked_by, t(:locked_by), class: 'form-label' %>
         | 
| 28 | 
            +
                <%= form.text_field :locked_by, class: 'form-control' %>
         | 
| 29 | 
            +
              </div>
         | 
| 30 | 
            +
              <div class="mb-3 w-25">
         | 
| 31 | 
            +
                <%= form.label :failed_at, t(:failed_at), class: 'form-label' %>
         | 
| 32 | 
            +
                <%= form.datetime_local_field :failed_at, class: 'form-control', step: 1 %>
         | 
| 33 | 
            +
              </div>
         | 
| 34 | 
            +
              <div class="mb-3 w-25">
         | 
| 35 | 
            +
                <%= form.label :last_error, t(:last_error), class: 'form-label' %>
         | 
| 36 | 
            +
                <%= form.text_field :last_error, class: 'form-control' %>
         | 
| 37 | 
            +
              </div>
         | 
| 38 | 
            +
              <div class="mb-3 w-25">
         | 
| 39 | 
            +
                <%= form.label :queue, t(:queue), class: 'form-label' %>
         | 
| 40 | 
            +
                <%= form.text_field :queue, class: 'form-control' %>
         | 
| 41 | 
            +
              </div>
         | 
| 42 | 
            +
              <%= form.submit t(:update), class: 'btn btn-primary' %>
         | 
| 43 | 
            +
            <% end %>
         | 
| 44 | 
            +
             | 
| 45 | 
            +
            <div class="mt-3">
         | 
| 46 | 
            +
            <%= button_to "Delete",
         | 
| 47 | 
            +
                rush_job_url(@job),
         | 
| 48 | 
            +
                class: "btn btn-danger",
         | 
| 49 | 
            +
                method: :delete,
         | 
| 50 | 
            +
                data: { confirm: t(:delete_job_confirmation, job_id: @job.id) } %>
         | 
| 51 | 
            +
            </div>
         | 
| @@ -0,0 +1,3 @@ | |
| 1 | 
            +
            document.getElementById('rush-job-mongoid-flash-messages').innerHTML = "<%= j (render partial: 'layouts/rush_job_mongoid/flash_messages') %>"
         | 
| 2 | 
            +
            document.getElementById('rush-job-mongoid-jobs').innerHTML = "<%= j (render partial: 'jobs_table') %>"
         | 
| 3 | 
            +
            document.getElementById('rush-job-mongoid-jobs').classList.remove('table-refresh');
         | 
| @@ -0,0 +1,89 @@ | |
| 1 | 
            +
            <% if pages_count > 1 %>
         | 
| 2 | 
            +
              <nav aria-label="page navigation">
         | 
| 3 | 
            +
                <ul class="pagination">
         | 
| 4 | 
            +
                  <%= render 'rush_job_mongoid/shared/pagination_link',
         | 
| 5 | 
            +
                      link_display: t(:previous),
         | 
| 6 | 
            +
                      controller: controller,
         | 
| 7 | 
            +
                      pagination_param: pagination_param,
         | 
| 8 | 
            +
                      page: page - 1,
         | 
| 9 | 
            +
                      link_class: page > 1 ? 'page-link' : 'page-link disabled' %>
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                  <% if pages_count < 5 %>
         | 
| 12 | 
            +
                    <% (1..pages_count).each do |page_n| %>
         | 
| 13 | 
            +
                      <%= render 'rush_job_mongoid/shared/pagination_link',
         | 
| 14 | 
            +
                          link_display: page_n,
         | 
| 15 | 
            +
                          controller: controller,
         | 
| 16 | 
            +
                          pagination_param: pagination_param,
         | 
| 17 | 
            +
                          page: page_n,
         | 
| 18 | 
            +
                          link_class: page == page_n ? 'page-link active' : 'page-link' %>
         | 
| 19 | 
            +
                    <% end %>
         | 
| 20 | 
            +
                  <% else %>
         | 
| 21 | 
            +
                    <% if page != 2 %>
         | 
| 22 | 
            +
                      <%= render 'rush_job_mongoid/shared/pagination_link',
         | 
| 23 | 
            +
                          link_display: '1',
         | 
| 24 | 
            +
                          controller: controller,
         | 
| 25 | 
            +
                          pagination_param: pagination_param,
         | 
| 26 | 
            +
                          page: 1,
         | 
| 27 | 
            +
                          link_class: page == 1 ? 'page-link active' : 'page-link' %>
         | 
| 28 | 
            +
                    <% end %>
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                    <% if page == 1 %>
         | 
| 31 | 
            +
                      <%= render 'rush_job_mongoid/shared/pagination_link',
         | 
| 32 | 
            +
                          link_display: '2',
         | 
| 33 | 
            +
                          controller: controller,
         | 
| 34 | 
            +
                          pagination_param: pagination_param,
         | 
| 35 | 
            +
                          page: 2,
         | 
| 36 | 
            +
                          link_class: 'page-link' %>
         | 
| 37 | 
            +
                    <% end %>
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                    <% if page > 2%>
         | 
| 40 | 
            +
                      <li class="page-item">
         | 
| 41 | 
            +
                        <%= link_to '...', '#', class: 'page-link' %>
         | 
| 42 | 
            +
                      </li>
         | 
| 43 | 
            +
                    <% end %>
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                    <% if page > 1 && page < pages_count %>
         | 
| 46 | 
            +
                      <% ((page - 1)..(page + 1)).each do |page_n| %>
         | 
| 47 | 
            +
                        <%= render 'rush_job_mongoid/shared/pagination_link',
         | 
| 48 | 
            +
                            link_display: page_n,
         | 
| 49 | 
            +
                            controller: controller,
         | 
| 50 | 
            +
                            pagination_param: pagination_param,
         | 
| 51 | 
            +
                            page: page_n,
         | 
| 52 | 
            +
                            link_class: page == page_n ? 'page-link active' : 'page-link' %>
         | 
| 53 | 
            +
                      <% end %>
         | 
| 54 | 
            +
                    <% end%>
         | 
| 55 | 
            +
             | 
| 56 | 
            +
                    <% if page < pages_count - 1%>
         | 
| 57 | 
            +
                      <li class="page-item">
         | 
| 58 | 
            +
                        <%= link_to '...', '#', class: 'page-link' %>
         | 
| 59 | 
            +
                      </li>
         | 
| 60 | 
            +
                    <% end %>
         | 
| 61 | 
            +
             | 
| 62 | 
            +
                    <% if page == pages_count %>
         | 
| 63 | 
            +
                      <%= render 'rush_job_mongoid/shared/pagination_link',
         | 
| 64 | 
            +
                          link_display: pages_count - 1,
         | 
| 65 | 
            +
                          controller: controller,
         | 
| 66 | 
            +
                          pagination_param: pagination_param,
         | 
| 67 | 
            +
                          page: pages_count - 1,
         | 
| 68 | 
            +
                          link_class: 'page-link' %>
         | 
| 69 | 
            +
                    <% end %>
         | 
| 70 | 
            +
             | 
| 71 | 
            +
                    <% if page != pages_count - 1 %>
         | 
| 72 | 
            +
                      <%= render 'rush_job_mongoid/shared/pagination_link',
         | 
| 73 | 
            +
                          link_display: pages_count,
         | 
| 74 | 
            +
                          controller: controller,
         | 
| 75 | 
            +
                          pagination_param: pagination_param,
         | 
| 76 | 
            +
                          page: pages_count,
         | 
| 77 | 
            +
                          link_class: page == pages_count ? 'page-link active' : 'page-link' %>
         | 
| 78 | 
            +
                    <% end %>
         | 
| 79 | 
            +
                  <% end %>
         | 
| 80 | 
            +
             | 
| 81 | 
            +
                  <%= render 'rush_job_mongoid/shared/pagination_link',
         | 
| 82 | 
            +
                      link_display: t(:next),
         | 
| 83 | 
            +
                      controller: controller,
         | 
| 84 | 
            +
                      pagination_param: pagination_param,
         | 
| 85 | 
            +
                      page: page + 1,
         | 
| 86 | 
            +
                      link_class: page < pages_count ? 'page-link' : 'page-link disabled' %>
         | 
| 87 | 
            +
                </ul>
         | 
| 88 | 
            +
              </nav>
         | 
| 89 | 
            +
            <% end %>
         | 
| @@ -0,0 +1,32 @@ | |
| 1 | 
            +
            <div data-controller="rush-job-mongoid-polling">
         | 
| 2 | 
            +
              <div class="row align-items-center">
         | 
| 3 | 
            +
                <div class="col-3">
         | 
| 4 | 
            +
                  <label for="rush-job-mongoid-polling-range"
         | 
| 5 | 
            +
                         class="polling-range-form-label-<%= invert_theme %>"
         | 
| 6 | 
            +
                         data-rush-job-mongoid-polling-target="pollingTimeLabel">
         | 
| 7 | 
            +
                    <%= t :polling_time %> 13 <%= t :polling_time_unit %>
         | 
| 8 | 
            +
                  </label>
         | 
| 9 | 
            +
                  <input id="rush-job-mongoid-polling-range"
         | 
| 10 | 
            +
                         type="range"
         | 
| 11 | 
            +
                         class="form-range"
         | 
| 12 | 
            +
                         min="0"
         | 
| 13 | 
            +
                         max="6"
         | 
| 14 | 
            +
                         data-rush-job-mongoid-polling-target="pollingTime"
         | 
| 15 | 
            +
                         data-action="input->rush-job-mongoid-polling#pollingChange">
         | 
| 16 | 
            +
                </div>
         | 
| 17 | 
            +
                <div class="col-3">
         | 
| 18 | 
            +
                  <div class="form-check form-switch">
         | 
| 19 | 
            +
                    <input id="rush-job-mongoid-polling"
         | 
| 20 | 
            +
                           class="form-check-input"
         | 
| 21 | 
            +
                           type="checkbox"
         | 
| 22 | 
            +
                           role="switch"
         | 
| 23 | 
            +
                           data-rush-job-mongoid-polling-target="pollingSlide"
         | 
| 24 | 
            +
                           data-action="input->rush-job-mongoid-polling#pollingToggle">
         | 
| 25 | 
            +
                    <label class="form-check-label-<%= invert_theme %>" for="rush-job-mongoid-polling"><%= t :enable_polling %></label>
         | 
| 26 | 
            +
                  </div>
         | 
| 27 | 
            +
                </div>
         | 
| 28 | 
            +
                <div class="col-3" data-controller="rush-job-mongoid-reload-jobs-table">
         | 
| 29 | 
            +
                  <button class="btn btn-primary" data-action="click->rush-job-mongoid-reload-jobs-table#reloadJobs"><%= t :reload %></button>
         | 
| 30 | 
            +
                </div>
         | 
| 31 | 
            +
              </div>
         | 
| 32 | 
            +
            </div>
         | 
    
        data/config/importmap.rb
    ADDED
    
    | @@ -0,0 +1,5 @@ | |
| 1 | 
            +
            pin 'rush_job_mongoid/application', preload: true
         | 
| 2 | 
            +
            pin 'bootstrap', to: 'https://ga.jspm.io/npm:bootstrap@5.3.1/dist/js/bootstrap.esm.js'
         | 
| 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'
         | 
| @@ -0,0 +1,46 @@ | |
| 1 | 
            +
            en:
         | 
| 2 | 
            +
              arguments: "Arguments"
         | 
| 3 | 
            +
              attempts: "Attempts"
         | 
| 4 | 
            +
              clear: "Clear"
         | 
| 5 | 
            +
              clear_queue_confirmation: "Are you sure you want to clear queue %{queue}?"
         | 
| 6 | 
            +
              cleared_queue: "Cleared queue %{queue}"
         | 
| 7 | 
            +
              close: "Close"
         | 
| 8 | 
            +
              count: "Count"
         | 
| 9 | 
            +
              dark_mode: "Dark Mode"
         | 
| 10 | 
            +
              dashboard: "Dashboard"
         | 
| 11 | 
            +
              delayed_title: "Delayed Jobs"
         | 
| 12 | 
            +
              deleted_job: "Deleted job %{job_id}"
         | 
| 13 | 
            +
              delete_job_confirmation: "Are you sure you want to delete job %{job_id} ?"
         | 
| 14 | 
            +
              disable_editing: "Disable Editing"
         | 
| 15 | 
            +
              disable_editing_confirmation: "Are you sure?"
         | 
| 16 | 
            +
              disable_queues: "Disable Queues"
         | 
| 17 | 
            +
              edit_warning: "Verify workers are stopped before editing. Minimal validations are applied."
         | 
| 18 | 
            +
              enable_editing: "Enable Editing"
         | 
| 19 | 
            +
              enable_editing_confirmation: "Are you sure? Verify workers are stopped before editing."
         | 
| 20 | 
            +
              enable_polling: "Enable polling"
         | 
| 21 | 
            +
              enable_queues: "Enable Queues"
         | 
| 22 | 
            +
              failed_at: "Failed at"
         | 
| 23 | 
            +
              filter: "Filter"
         | 
| 24 | 
            +
              filter_jobs: "Filter jobs"
         | 
| 25 | 
            +
              job_class: "Job class"
         | 
| 26 | 
            +
              jobs: "Jobs"
         | 
| 27 | 
            +
              id: "Id"
         | 
| 28 | 
            +
              last_error: "Last error"
         | 
| 29 | 
            +
              light_mode: "Light Mode"
         | 
| 30 | 
            +
              locked_at: "Locked at"
         | 
| 31 | 
            +
              locked_by: "Locked by"
         | 
| 32 | 
            +
              locked_jobs: "Locked Jobs"
         | 
| 33 | 
            +
              missing_document: "Unable to find document."
         | 
| 34 | 
            +
              name: "Name"
         | 
| 35 | 
            +
              next: "Next"
         | 
| 36 | 
            +
              polling_time: "Polling time:"
         | 
| 37 | 
            +
              polling_time_unit: "seconds"
         | 
| 38 | 
            +
              previous: "Previous"
         | 
| 39 | 
            +
              priority: "Priority"
         | 
| 40 | 
            +
              queue: "Queue"
         | 
| 41 | 
            +
              queues: "Queues"
         | 
| 42 | 
            +
              reload: "Reload"
         | 
| 43 | 
            +
              run_at: "Run at"
         | 
| 44 | 
            +
              unable_to_update: "Unable to edit job. %{errors}"
         | 
| 45 | 
            +
              update: "Update"
         | 
| 46 | 
            +
              updated_job: "Successfully updated job %{job_id}"
         | 
    
        data/config/routes.rb
    ADDED
    
    
| @@ -0,0 +1,23 @@ | |
| 1 | 
            +
            module RushJobMongoid
         | 
| 2 | 
            +
              require 'importmap-rails'
         | 
| 3 | 
            +
              require 'mongoid'
         | 
| 4 | 
            +
              require 'sassc-rails'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              class Engine < ::Rails::Engine
         | 
| 7 | 
            +
                isolate_namespace RushJobMongoid
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                initializer 'rush_job_mongoid.importmap', before: 'importmap' do |app|
         | 
| 10 | 
            +
                  app.config.importmap.paths << root.join('config/importmap.rb')
         | 
| 11 | 
            +
                  app.config.importmap.cache_sweepers << root.join('app/assets/javascript')
         | 
| 12 | 
            +
                end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                initializer 'rush_job_mongoid.assets.precompile' do |app|
         | 
| 15 | 
            +
                  app.config.assets.precompile += %w[
         | 
| 16 | 
            +
                    rush_job_mongoid/application.css
         | 
| 17 | 
            +
                    rush_job_mongoid/application.scss
         | 
| 18 | 
            +
                    rush_job_mongoid/application.js
         | 
| 19 | 
            +
                    rush_job_mongoid_manifest.js
         | 
| 20 | 
            +
                  ]
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
            end
         |