sidekiq-tasks 0.1.5 → 0.1.6
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 +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/sidekiq/tasks/strategies/rules/enable_with_comment.rb +12 -0
- data/lib/sidekiq/tasks/version.rb +1 -1
- data/lib/sidekiq/tasks/web.rb +12 -3
- data/web/locales/en.yml +1 -0
- data/web/locales/fr.yml +1 -0
- data/web/views/task.erb +8 -2
- data/web/views/tasks.erb +36 -26
- 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: '012139adfe0354b0f2521146f617c043aa6f940d3841827a5a8b1d68a729a4d5'
         | 
| 4 | 
            +
              data.tar.gz: f4d1b0aa4b214a99a92fbad2b26ba39f610b1ded9d7e81524f272e93da281a05
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 0ca5fcf42d4c2ec26ea1f67791d428418e610b24746a2599e1805b4440d3af747a21d523ebe19f01d81062f718454791ce5bfeab64073414b680a444557859c0
         | 
| 7 | 
            +
              data.tar.gz: bb66768aa135be0b6e82dff713a5425be34a3a3a4945e017006766f6072572d26c7b1197da1fbdbd983b2daf36bb7c194634db2e6eae166e653e0a8c44bbe6a0
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,5 +1,13 @@ | |
| 1 1 | 
             
            ## Changelog
         | 
| 2 2 |  | 
| 3 | 
            +
            ### [0.1.6] - 2025-05-11
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            - Enable CI workflows on all branches. (#4)
         | 
| 6 | 
            +
            - Add description to task list. (#2)
         | 
| 7 | 
            +
            - Detect magic comment before multiline desc. (#3)
         | 
| 8 | 
            +
            - Fix style tag rendering and plugin registration for Sidekiq Web UI 7.3+ and 8.0+. (#1)
         | 
| 9 | 
            +
            - Enable horizontal scroll on tasks table for mobile. (#5)
         | 
| 10 | 
            +
             | 
| 3 11 | 
             
            ### [0.1.5] - 2025-05-04
         | 
| 4 12 |  | 
| 5 13 | 
             
            - Add duration, status and error reports to history.
         | 
| @@ -12,6 +12,7 @@ module Sidekiq | |
| 12 12 | 
             
                        return false if lines.nil?
         | 
| 13 13 |  | 
| 14 14 | 
             
                        return true if task_has_magic_comment?(lines, line_number)
         | 
| 15 | 
            +
                        return true if desc_has_magic_comment?(task.full_comment, lines, line_number)
         | 
| 15 16 |  | 
| 16 17 | 
             
                        namespace_line_index = find_namespace_line_index(lines, task)
         | 
| 17 18 | 
             
                        return false unless namespace_line_index
         | 
| @@ -33,6 +34,17 @@ module Sidekiq | |
| 33 34 | 
             
                        raise ArgumentError, "File '#{file}' not found"
         | 
| 34 35 | 
             
                      end
         | 
| 35 36 |  | 
| 37 | 
            +
                      def desc_has_magic_comment?(desc, lines, task_line)
         | 
| 38 | 
            +
                        return false unless desc&.include?("\n")
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                        desc_line_index = lines[0...task_line].rindex { |line| line.strip.start_with?("desc") }
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                        return false unless desc_line_index
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                        comment_line = lines[desc_line_index - 1]&.strip
         | 
| 45 | 
            +
                        !!(comment_line =~ magic_comment_regex)
         | 
| 46 | 
            +
                      end
         | 
| 47 | 
            +
             | 
| 36 48 | 
             
                      def task_has_magic_comment?(lines, task_line)
         | 
| 37 49 | 
             
                        context_range = (task_line - 3..task_line).to_a.select { |i| i >= 0 }
         | 
| 38 50 | 
             
                        context_range.reverse.any? do |i|
         | 
    
        data/lib/sidekiq/tasks/web.rb
    CHANGED
    
    | @@ -12,17 +12,26 @@ module Sidekiq | |
| 12 12 | 
             
              end
         | 
| 13 13 | 
             
            end
         | 
| 14 14 |  | 
| 15 | 
            -
            if Sidekiq::Tasks::Web:: | 
| 15 | 
            +
            if Sidekiq::Tasks::Web::SIDEKIQ_GTE_8_0_0
         | 
| 16 16 | 
             
              Sidekiq::Web.configure do |config|
         | 
| 17 17 | 
             
                config.register(
         | 
| 18 18 | 
             
                  Sidekiq::Tasks::Web::Extension,
         | 
| 19 19 | 
             
                  name: "tasks",
         | 
| 20 | 
            -
                  tab:  | 
| 21 | 
            -
                  index:  | 
| 20 | 
            +
                  tab: "Tasks",
         | 
| 21 | 
            +
                  index: "tasks",
         | 
| 22 22 | 
             
                  root_dir: Sidekiq::Tasks::Web::ROOT,
         | 
| 23 23 | 
             
                  asset_paths: ["js", "css"]
         | 
| 24 24 | 
             
                )
         | 
| 25 25 | 
             
              end
         | 
| 26 | 
            +
            elsif Sidekiq::Tasks::Web::SIDEKIQ_GTE_7_3_0
         | 
| 27 | 
            +
              Sidekiq::Web.register(
         | 
| 28 | 
            +
                Sidekiq::Tasks::Web::Extension,
         | 
| 29 | 
            +
                name: "tasks",
         | 
| 30 | 
            +
                tab: "Tasks",
         | 
| 31 | 
            +
                index: "tasks",
         | 
| 32 | 
            +
                root_dir: Sidekiq::Tasks::Web::ROOT,
         | 
| 33 | 
            +
                asset_paths: ["js", "css"]
         | 
| 34 | 
            +
              )
         | 
| 26 35 | 
             
            else
         | 
| 27 36 | 
             
              Sidekiq::Web.tabs["Tasks"] = "tasks"
         | 
| 28 37 | 
             
              Sidekiq::Web.register(Sidekiq::Tasks::Web::Extension)
         | 
    
        data/web/locales/en.yml
    CHANGED
    
    
    
        data/web/locales/fr.yml
    CHANGED
    
    
    
        data/web/views/task.erb
    CHANGED
    
    | @@ -1,7 +1,13 @@ | |
| 1 | 
            -
            <% if Sidekiq::Tasks::Web:: | 
| 1 | 
            +
            <% if Sidekiq::Tasks::Web::SIDEKIQ_GTE_8_0_0 %>
         | 
| 2 2 | 
             
              <% style_tag "tasks/css/ext.css" %>
         | 
| 3 | 
            +
            <% elsif Sidekiq::Tasks::Web::SIDEKIQ_GTE_7_3_0 %>
         | 
| 4 | 
            +
              <% add_to_head do %>
         | 
| 5 | 
            +
                <%= style_tag "tasks/css/ext.css" %>
         | 
| 6 | 
            +
              <% end %>
         | 
| 3 7 | 
             
            <% else %>
         | 
| 4 | 
            -
               | 
| 8 | 
            +
              <% add_to_head do %>
         | 
| 9 | 
            +
                <link href="<%= root_path %>tasks/css/ext.css" media="screen" rel="stylesheet" type="text/css"/>
         | 
| 10 | 
            +
              <% end %>
         | 
| 5 11 | 
             
            <% end %>
         | 
| 6 12 |  | 
| 7 13 | 
             
            <header class="st-header">
         | 
    
        data/web/views/tasks.erb
    CHANGED
    
    | @@ -1,7 +1,13 @@ | |
| 1 | 
            -
            <% if Sidekiq::Tasks::Web:: | 
| 1 | 
            +
            <% if Sidekiq::Tasks::Web::SIDEKIQ_GTE_8_0_0 %>
         | 
| 2 2 | 
             
              <% style_tag "tasks/css/ext.css" %>
         | 
| 3 | 
            +
            <% elsif Sidekiq::Tasks::Web::SIDEKIQ_GTE_7_3_0 %>
         | 
| 4 | 
            +
              <% add_to_head do %>
         | 
| 5 | 
            +
                <%= style_tag "tasks/css/ext.css" %>
         | 
| 6 | 
            +
              <% end %>
         | 
| 3 7 | 
             
            <% else %>
         | 
| 4 | 
            -
               | 
| 8 | 
            +
              <% add_to_head do %>
         | 
| 9 | 
            +
                <link href="<%= root_path %>tasks/css/ext.css" media="screen" rel="stylesheet" type="text/css"/>
         | 
| 10 | 
            +
              <% end %>
         | 
| 5 11 | 
             
            <% end %>
         | 
| 6 12 |  | 
| 7 13 | 
             
            <header class="st-header">
         | 
| @@ -22,30 +28,34 @@ | |
| 22 28 | 
             
              </form>
         | 
| 23 29 | 
             
            </header>
         | 
| 24 30 |  | 
| 25 | 
            -
             | 
| 26 | 
            -
               | 
| 27 | 
            -
             | 
| 28 | 
            -
               | 
| 29 | 
            -
                < | 
| 30 | 
            -
                  < | 
| 31 | 
            -
                    <th><%= t("name") %></th>
         | 
| 32 | 
            -
                    <th><%= t("last_enqueued") %></th>
         | 
| 33 | 
            -
                  </tr>
         | 
| 34 | 
            -
                </thead>
         | 
| 35 | 
            -
                <tbody>
         | 
| 36 | 
            -
                  <% @search.tasks.each do |task| %>
         | 
| 31 | 
            +
            <div class="st-table-container">
         | 
| 32 | 
            +
              <% if @search.tasks.empty? %>
         | 
| 33 | 
            +
                <%= t("no_tasks") %>
         | 
| 34 | 
            +
              <% else %>
         | 
| 35 | 
            +
                <table class="st-table">
         | 
| 36 | 
            +
                  <thead>
         | 
| 37 37 | 
             
                    <tr>
         | 
| 38 | 
            -
                      < | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 41 | 
            -
                        </a>
         | 
| 42 | 
            -
                      </td>
         | 
| 43 | 
            -
             | 
| 44 | 
            -
                      <td><%= task.last_enqueue_at ? relative_time(task.last_enqueue_at) : "-" %></td>
         | 
| 38 | 
            +
                      <th><%= t("name") %></th>
         | 
| 39 | 
            +
                      <th><%= t("description") %></th>
         | 
| 40 | 
            +
                      <th><%= t("last_enqueued") %></th>
         | 
| 45 41 | 
             
                    </tr>
         | 
| 46 | 
            -
                   | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 42 | 
            +
                  </thead>
         | 
| 43 | 
            +
                  <tbody>
         | 
| 44 | 
            +
                    <% @search.tasks.each do |task| %>
         | 
| 45 | 
            +
                      <tr>
         | 
| 46 | 
            +
                        <td>
         | 
| 47 | 
            +
                          <a href="<%= task_url(root_path, task) %>" class="st-text-primary">
         | 
| 48 | 
            +
                            <b><%= task.name %></b>
         | 
| 49 | 
            +
                          </a>
         | 
| 50 | 
            +
                        </td>
         | 
| 49 51 |  | 
| 50 | 
            -
             | 
| 51 | 
            -
             | 
| 52 | 
            +
                        <td><%= task.desc %></td>
         | 
| 53 | 
            +
                        <td><%= task.last_enqueue_at ? relative_time(task.last_enqueue_at) : "-" %></td>
         | 
| 54 | 
            +
                      </tr>
         | 
| 55 | 
            +
                    <% end %>
         | 
| 56 | 
            +
                  </tbody>
         | 
| 57 | 
            +
                </table>
         | 
| 58 | 
            +
             | 
| 59 | 
            +
                <%= erb(read_view(:_pagination), locals: {search: @search}) %>
         | 
| 60 | 
            +
              <% end %>
         | 
| 61 | 
            +
            </div>
         | 
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: sidekiq-tasks
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.6
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Victor
         | 
| 8 8 | 
             
            bindir: exe
         | 
| 9 9 | 
             
            cert_chain: []
         | 
| 10 | 
            -
            date: 2025-05- | 
| 10 | 
            +
            date: 2025-05-11 00:00:00.000000000 Z
         | 
| 11 11 | 
             
            dependencies:
         | 
| 12 12 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 13 13 | 
             
              name: rake
         |