sidekiq-cron 1.12.0 → 2.1.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.
@@ -1,21 +1,18 @@
1
- require 'sidekiq/cron/poller'
2
-
3
1
  # For Cron we need to add some methods to Launcher
4
- # so look at the code bellow.
2
+ # so look at the code below.
5
3
  #
6
4
  # We are creating new cron poller instance and
7
5
  # adding start and stop commands to launcher.
8
6
  module Sidekiq
9
7
  module Cron
10
8
  module Launcher
11
- DEFAULT_POLL_INTERVAL = 30
12
9
 
13
10
  # Add cron poller to launcher.
14
11
  attr_reader :cron_poller
15
12
 
16
13
  # Add cron poller and execute normal initialize of Sidekiq launcher.
17
14
  def initialize(config, **kwargs)
18
- config[:cron_poll_interval] = DEFAULT_POLL_INTERVAL if config[:cron_poll_interval].nil?
15
+ config[:cron_poll_interval] = Sidekiq::Cron.configuration.cron_poll_interval.to_i
19
16
 
20
17
  @cron_poller = Sidekiq::Cron::Poller.new(config) if config[:cron_poll_interval] > 0
21
18
  super
@@ -1,13 +1,22 @@
1
1
  de:
2
- Job: Job
2
+ AreYouSureDeleteCronJob: Sind Sie sicher, dass sie den Cronjob %{job} löschen wollen?
3
+ AreYouSureDeleteCronJobs: Sind Sie sicher, dass Sie ALLE Cron-Jobs löschen möchten?
4
+ AreYouSureEnqueueCronJob: Sind Sie sicher, dass Sie den %{job} Cron-Job einreihen möchten?
5
+ AreYouSureEnqueueCronJobs: Sind Sie sicher, dass Sie ALLE Cron-Jobs einreihen möchten?
3
6
  Cron: Cron
4
7
  CronJobs: Cronjobs
8
+ CronString: Cron
9
+ DeleteAll: Alle löschen
10
+ Description: Beschreibung
11
+ Disable: Deaktivieren
12
+ DisableAll: Alle deaktivieren
13
+ Enable: Aktivieren
14
+ EnableAll: Alle aktivieren
15
+ EnqueueAll: Alle einreihen
5
16
  EnqueueNow: In Warteschlange
6
- 'Cron string': Cron
7
- AreYouSureDeleteCronJob: Sind Sie sicher, dass sie den Cronjob %{job} löschen wollen?
17
+ Job: Job
18
+ LastEnqueued: Eingereiht
8
19
  NoCronJobsWereFound: Keine Cronjobs gefunden
9
- Enable: Aktivieren
10
- Disable: Deaktivieren
11
- 'Last enqueued': Eingereiht
20
+ NoHistoryWereFound: Keine Historie gefunden
12
21
  disabled: deaktiviert
13
22
  enabled: aktiviert
@@ -1,22 +1,22 @@
1
1
  en:
2
- Job: Job
2
+ AreYouSureDeleteCronJob: Are you sure you want to delete the %{job} cron job?
3
+ AreYouSureDeleteCronJobs: Are you sure you want to delete ALL cron jobs?
4
+ AreYouSureEnqueueCronJob: Are you sure you want to enqueue the %{job} cron job?
5
+ AreYouSureEnqueueCronJobs: Are you sure you want to enqueue ALL cron jobs?
3
6
  Cron: Cron
4
7
  CronJobs: Cron Jobs
5
- EnqueueNow: Enqueue Now
6
- EnableAll: Enable All
8
+ CronString: Cron
9
+ DeleteAll: Delete All
10
+ Description: Description
11
+ Disable: Disable
7
12
  DisableAll: Disable All
13
+ Enable: Enable
14
+ EnableAll: Enable All
8
15
  EnqueueAll: Enqueue All
9
- DeleteAll: Delete All
10
- 'Cron string': Cron
11
- AreYouSureEnqueueCronJobs: Are you sure you want to enqueue ALL cron jobs?
12
- AreYouSureEnqueueCronJob: Are you sure you want to enqueue the %{job} cron job?
13
- AreYouSureDeleteCronJobs: Are you sure you want to delete ALL cron jobs?
14
- AreYouSureDeleteCronJob: Are you sure you want to delete the %{job} cron job?
16
+ EnqueueNow: Enqueue Now
17
+ Job: Job
18
+ LastEnqueued: Last enqueued
15
19
  NoCronJobsWereFound: No cron jobs were found
16
- Enable: Enable
17
- Disable: Disable
18
- 'Last enqueued': Last enqueued
20
+ NoHistoryWereFound: No history were found
19
21
  disabled: disabled
20
22
  enabled: enabled
21
- NoHistoryWereFound: No history were found
22
- Description: Description
@@ -0,0 +1,22 @@
1
+ es:
2
+ AreYouSureDeleteCronJob: ¿Estás seguro de que quieres borrar el trabajo cron %{job}?
3
+ AreYouSureDeleteCronJobs: ¿Estás seguro de que quieres borrar TODOS los trabajos cron?
4
+ AreYouSureEnqueueCronJob: ¿Estás seguro de que quieres poner en cola el trabajo cron %{job}?
5
+ AreYouSureEnqueueCronJobs: ¿Estás seguro de que quieres poner en cola TODOS los trabajos cron?
6
+ Cron: Cron
7
+ CronJobs: Trabajos cron programados
8
+ CronString: Cron
9
+ DeleteAll: Borrar todo
10
+ Description: Descripción
11
+ Disable: Desactivar
12
+ DisableAll: Desactivar todos
13
+ Enable: Activar
14
+ EnableAll: Activar todos
15
+ EnqueueAll: Poner todos en cola
16
+ EnqueueNow: Poner en cola ahora
17
+ Job: Trabajo
18
+ LastEnqueued: Último trabajo en cola
19
+ NoCronJobsWereFound: No se encontraron trabajos
20
+ NoHistoryWereFound: No se encontró histórico de trabajos
21
+ disabled: activo
22
+ enabled: inactivo
@@ -0,0 +1,22 @@
1
+ id:
2
+ AreYouSureDeleteCronJob: Apakah Anda yakin ingin menghapus cron job %{job}?
3
+ AreYouSureDeleteCronJobs: Apakah Anda yakin ingin menghapus SEMUA cron job?
4
+ AreYouSureEnqueueCronJob: Apakah Anda yakin ingin menambahkan cron job %{job} ke antrian?
5
+ AreYouSureEnqueueCronJobs: Apakah Anda yakin ingin menambahkan SEMUA cron job ke antrian?
6
+ Cron: Cron
7
+ CronJobs: Cron Jobs
8
+ CronString: Cron
9
+ DeleteAll: Hapus Semua
10
+ Description: Deskripsi
11
+ Disable: Nonaktifkan
12
+ DisableAll: Nonaktifkan Semua
13
+ Enable: Aktifkan
14
+ EnableAll: Aktifkan Semua
15
+ EnqueueAll: Tambahkan Semua ke Antrian
16
+ EnqueueNow: Tambahkan ke Antrian Sekarang
17
+ Job: Job
18
+ LastEnqueued: Terakhir kali ditambahkan ke antrian
19
+ NoCronJobsWereFound: Tidak ada cron job
20
+ NoHistoryWereFound: Tidak ada riwayat
21
+ disabled: dinonaktifkan
22
+ enabled: diaktifkan
@@ -1,23 +1,22 @@
1
1
  it:
2
- Job: Job
2
+ AreYouSureDeleteCronJob: Vuoi cancellare il cron job '%{job}'?
3
+ AreYouSureDeleteCronJobs: Vuoi cancellare TUTTI i cron job?
4
+ AreYouSureEnqueueCronJob: Vuoi accodare il cron job '%{job}'?
5
+ AreYouSureEnqueueCronJobs: Vuoi accodare TUTTI i cron job?
3
6
  Cron: Cron
4
- CronJobs: Cron job
5
- EnqueueNow: Accoda
6
- EnableAll: Attiva tutto
7
+ CronJobs: Cron Jobs
8
+ CronString: Cron
9
+ DeleteAll: Cancella tutto
10
+ Description: Descrizione
11
+ Disable: Disattiva
7
12
  DisableAll: Disattiva tutto
13
+ Enable: Attiva
14
+ EnableAll: Attiva tutto
8
15
  EnqueueAll: Accoda tutto
9
- DeleteAll: Cancella tutto
10
- "Cron string": Cron
11
- AreYouSureEnqueueCronJobs: Vuoi accodare TUTTI i cron job?
12
- AreYouSureEnqueueCronJob: "Vuoi accodare il cron job '%{job}'?"
13
- AreYouSureDeleteCronJobs: Vuoi cancellare TUTTI i cron job?
14
- AreYouSureDeleteCronJob: "Vuoi cancellare il cron job '%{job}'?"
16
+ EnqueueNow: Accoda
17
+ Job: Job
18
+ LastEnqueued: Ultimo accodamento
15
19
  NoCronJobsWereFound: Nessun cron job trovato
16
- Enable: Attiva
17
- Disable: Disattiva
18
- "Last enqueued": Ultimo accodamento
20
+ NoHistoryWereFound: Nessun evento in cronologia
19
21
  disabled: disattivato
20
22
  enabled: attivato
21
- NoHistoryWereFound: Nessun evento in cronologia
22
- Description: Descrizione
23
- Message: Payload
@@ -1,18 +1,22 @@
1
1
  ja:
2
- Job: ジョブ
2
+ AreYouSureDeleteCronJob: "本当に%{job}のcronジョブを削除しますか?"
3
+ AreYouSureDeleteCronJobs: "本当にすべてのcronジョブを削除しますか?"
4
+ AreYouSureEnqueueCronJob: "%{job} の cronジョブをキューに入れてもよろしいですか?"
5
+ AreYouSureEnqueueCronJobs: "すべての cronジョブをキューに入れてもよろしいですか?"
3
6
  Cron: Cron
4
7
  CronJobs: Cronジョブ
5
- EnqueueNow: すぐにキューに入れる
6
- EnableAll: すべて有効にする
8
+ CronString: Cron
9
+ DeleteAll: すべて削除
10
+ Description: 説明
11
+ Disable: 無効にする
7
12
  DisableAll: すべて無効にする
13
+ Enable: 有効にする
14
+ EnableAll: すべて有効にする
8
15
  EnqueueAll: すべてキューに入れる
9
- DeleteAll: すべて削除
10
- 'Cron string': Cron
11
- AreYouSureDeleteCronJobs: 本当にすべてのcronジョブを削除しますか?
12
- AreYouSureDeleteCronJob: 本当に%{job}のcronジョブを削除しますか?
16
+ EnqueueNow: すぐにキューに入れる
17
+ Job: ジョブ
18
+ LastEnqueued: 最後のキュー
13
19
  NoCronJobsWereFound: Cronジョブが見つかりませんでした
14
- Enable: 有効にする
15
- Disable: 無効にする
16
- 'Last enqueued': 最後のキュー
20
+ NoHistoryWereFound: 履歴が見つかりませんでした
17
21
  disabled: 無効
18
22
  enabled: 有効
@@ -1,22 +1,22 @@
1
1
  pt:
2
- Job: Tarefa
2
+ AreYouSureDeleteCronJob: Tem certeza de que deseja excluir a tarefa %{job}?
3
+ AreYouSureDeleteCronJobs: Tem certeza de que deseja excluir TODOS as tarefas?
4
+ AreYouSureEnqueueCronJob: Tem certeza de que deseja enfileirar a tarefa %{job}?
5
+ AreYouSureEnqueueCronJobs: Tem certeza de que deseja enfileirar TODOS as tarefas?
3
6
  Cron: Cron
4
7
  CronJobs: Tarefas do Cron
5
- EnqueueNow: Enfileirar agora
6
- EnableAll: Habilitar todos
8
+ CronString: Cron
9
+ DeleteAll: Excluir todos
10
+ Description: Descrição
11
+ Disable: Desabilitar
7
12
  DisableAll: Desabilitar todos
13
+ Enable: Habilitar
14
+ EnableAll: Habilitar todos
8
15
  EnqueueAll: Enfileirar todos
9
- DeleteAll: Excluir todos
10
- 'Cron string': Cron
11
- AreYouSureEnqueueCronJobs: Tem certeza de que deseja enfileirar TODOS as tarefas?
12
- AreYouSureEnqueueCronJob: Tem certeza de que deseja enfileirar a tarefa %{job}?
13
- AreYouSureDeleteCronJobs: Tem certeza de que deseja excluir TODOS as tarefas?
14
- AreYouSureDeleteCronJob: Tem certeza de que deseja excluir a tarefa %{job}?
16
+ EnqueueNow: Enfileirar agora
17
+ Job: Tarefa
18
+ LastEnqueued: Último enfileirado
15
19
  NoCronJobsWereFound: Nenhuma tarefa foi encontrada
16
- Enable: Habilitar
17
- Disable: Desabilitar
18
- 'Last enqueued': Último enfileirado
20
+ NoHistoryWereFound: Nenhum histórico foi encontrado
19
21
  disabled: desabilitado
20
22
  enabled: habilitado
21
- NoHistoryWereFound: Nenhum histórico foi encontrado
22
- Description: Descrição
@@ -1,14 +1,22 @@
1
1
  ru:
2
- Job: Задача
2
+ AreYouSureDeleteCronJob: Вы действительно хотите удалить задачу «%{job}»?
3
+ AreYouSureDeleteCronJobs: Вы уверены, что хотите удалить ВСЕ cron-задачи?
4
+ AreYouSureEnqueueCronJob: Вы уверены, что хотите добавить в очередь cron-задачу %{job}?
5
+ AreYouSureEnqueueCronJobs: Вы уверены, что хотите добавить в очередь ВСЕ cron-задачи?
3
6
  Cron: Cron
4
7
  CronJobs: Периодические задачи
5
- Name: Название
6
- 'Cron string': Периодичность (синтаксис Cron)
8
+ CronString: Периодичность (синтаксис Cron)
9
+ DeleteAll: Удалить все
10
+ Description: Описание
11
+ Disable: Отключить
12
+ DisableAll: Отключить все
13
+ Enable: Включить
14
+ EnableAll: Включить все
15
+ EnqueueAll: Добавить все в очередь
7
16
  EnqueueNow: Запустить
8
- AreYouSureDeleteCronJob: Вы действительно хотите удалить задачу «%{job}»?
17
+ Job: Задача
18
+ LastEnqueued: Последний запуск
9
19
  NoCronJobsWereFound: Не найдено периодических задач
10
- Enable: Включить
11
- Disable: Отключить
12
- 'Last enqueued': Последний запуск
20
+ NoHistoryWereFound: История не найдена
13
21
  disabled: отключено
14
22
  enabled: включено
@@ -1,19 +1,22 @@
1
1
  zh-CN:
2
- Job: 任务
2
+ AreYouSureDeleteCronJob: 你确定删除定时任务(%{job})吗?
3
+ AreYouSureDeleteCronJobs: 你确定删除所有的定时任务吗?
4
+ AreYouSureEnqueueCronJob: 您确定要将 %{job} 的 定时任务 任务加入队列吗?
5
+ AreYouSureEnqueueCronJobs: 您确定要将所有 定时任务 任务加入队列吗?
3
6
  Cron: 定时任务
4
7
  CronJobs: 定时任务列表
5
- EnqueueNow: 立刻执行
6
- EnableAll: 启用所有
8
+ CronString: 定时策略
9
+ DeleteAll: 删除所有
10
+ Description: 描述
11
+ Disable: 禁用
7
12
  DisableAll: 禁用所有
13
+ Enable: 启用
14
+ EnableAll: 启用所有
8
15
  EnqueueAll: 执行所有
9
- DeleteAll: 删除所有
10
- 'Cron string': 定时策略
11
- AreYouSureDeleteCronJobs: 你确定删除所有的定时任务吗?
12
- AreYouSureDeleteCronJob: 你确定删除定时任务(%{job})吗?
16
+ EnqueueNow: 立刻执行
17
+ Job: 任务
18
+ LastEnqueued: 放入队列时间
13
19
  NoCronJobsWereFound: 没有定时任务
14
- Enable: 启用
15
- Disable: 禁用
16
- 'Last enqueued': 放入队列时间
20
+ NoHistoryWereFound: 未找到历史记录
17
21
  disabled: 已禁用
18
22
  enabled: 已启用
19
-
@@ -0,0 +1,48 @@
1
+ module Sidekiq
2
+ module Cron
3
+ class Namespace
4
+ def self.all
5
+ namespaces = Sidekiq::Cron.configuration.available_namespaces
6
+ return namespaces if namespaces
7
+
8
+ Sidekiq.redis do |conn|
9
+ namespaces = conn.keys('cron_jobs:*').collect do |key|
10
+ key.split(':').last
11
+ end
12
+ end
13
+
14
+ # Adds the default namespace if not present
15
+ has_default = namespaces.detect do |name|
16
+ name == Sidekiq::Cron.configuration.default_namespace
17
+ end
18
+
19
+ unless has_default
20
+ namespaces << Sidekiq::Cron.configuration.default_namespace
21
+ end
22
+
23
+ namespaces
24
+ end
25
+
26
+ def self.all_with_count
27
+ all.map do |namespace_name|
28
+ {
29
+ count: count(namespace_name),
30
+ name: namespace_name
31
+ }
32
+ end
33
+ end
34
+
35
+ def self.count(name = Sidekiq::Cron.configuration.default_namespace)
36
+ out = 0
37
+ Sidekiq.redis do |conn|
38
+ out = conn.scard("cron_jobs:#{name}")
39
+ end
40
+ out
41
+ end
42
+
43
+ def self.available_namespaces_provided?
44
+ !!Sidekiq::Cron.configuration.available_namespaces
45
+ end
46
+ end
47
+ end
48
+ end
@@ -1,25 +1,24 @@
1
- require 'sidekiq'
2
- require 'sidekiq/cron'
1
+ # frozen_string_literal: true
2
+
3
3
  require 'sidekiq/scheduled'
4
- require 'sidekiq/options'
5
4
 
6
5
  module Sidekiq
7
6
  module Cron
8
- # The Poller checks Redis every N seconds for sheduled cron jobs.
7
+ # The Poller checks Redis every N seconds for scheduled cron jobs.
9
8
  class Poller < Sidekiq::Scheduled::Poller
10
9
  def initialize(config = nil)
11
- if Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new('6.5.0')
12
- super
13
- else
14
- # Old version of Sidekiq does not accept a config argument.
15
- @config = config
16
- super()
17
- end
10
+ super
11
+ end
12
+
13
+ def start
14
+ Sidekiq::Cron::Job.migrate_old_jobs_if_needed!
15
+
16
+ super
18
17
  end
19
18
 
20
19
  def enqueue
21
20
  time = Time.now.utc
22
- Sidekiq::Cron::Job.all.each do |job|
21
+ Sidekiq::Cron::Job.all('*').each do |job|
23
22
  enqueue_job(job, time)
24
23
  end
25
24
  rescue => ex
@@ -33,7 +32,7 @@ module Sidekiq
33
32
  private
34
33
 
35
34
  def enqueue_job(job, time = Time.now.utc)
36
- job.test_and_enque_for_time! time if job && job.valid?
35
+ job.test_and_enqueue_for_time! time if job && job.valid?
37
36
  rescue => ex
38
37
  # Problem somewhere in one job.
39
38
  Sidekiq.logger.error "CRON JOB: #{ex.message}"
@@ -1,9 +1,5 @@
1
- require 'sidekiq'
2
- require 'sidekiq/cron/job'
3
- require 'sidekiq/options'
4
-
5
1
  Sidekiq.configure_server do |config|
6
- schedule_file = Sidekiq::Options[:cron_schedule_file] || 'config/schedule.yml'
2
+ schedule_file = Sidekiq::Cron.configuration.cron_schedule_file
7
3
 
8
4
  if File.exist?(schedule_file)
9
5
  config.on(:startup) do
@@ -1,8 +1,7 @@
1
- # https://github.com/rails/rails/blob/352865d0f835c24daa9a2e9863dcc9dde9e5371a/activesupport/lib/active_support/inflector/methods.rb#L270
2
-
3
1
  module Sidekiq
4
2
  module Cron
5
3
  module Support
4
+ # Inspired by Active Support Inflector
6
5
  def self.constantize(camel_cased_word)
7
6
  names = camel_cased_word.split("::".freeze)
8
7
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sidekiq
4
4
  module Cron
5
- VERSION = "1.12.0"
5
+ VERSION = "2.1.0"
6
6
  end
7
7
  end
@@ -1,90 +1,105 @@
1
1
  <header class='row'>
2
2
  <div class='col-sm-5 pull-left'>
3
- <h3><%= t('CronJobs') %></h3>
3
+ <h3>
4
+ <%= t('CronJobs') %>
5
+ <small><%= @current_namespace %></small>
6
+ </h3>
4
7
  </div>
5
- <div class='col-sm-7 pull-right' style="margin-top: 20px; margin-bottom: 10px;">
8
+ <div class='col-sm-7 pull-right h2'>
6
9
  <% if @cron_jobs.size > 0 %>
7
- <form action="<%= root_path %>cron/__all__/delete" method="post" class="pull-right">
8
- <%= csrf_tag if respond_to?(:csrf_tag) %>
10
+ <form action="<%= root_path %>cron/namespaces/<%= @current_namespace %>/all/delete" method="post" class="pull-right">
11
+ <%= csrf_tag %>
9
12
  <input class="btn btn-danger" type="submit" name="delete" value="<%= t('DeleteAll') %>" data-confirm="<%= t('AreYouSureDeleteCronJobs') %>" />
10
13
  </form>
11
- <form action="<%= root_path %>cron/__all__/disable" method="post" class="pull-right">
12
- <%= csrf_tag if respond_to?(:csrf_tag) %>
13
- <input class="btn btn-warn" type="submit" name="enque" value="<%= t('DisableAll') %>" />
14
+ <form action="<%= root_path %>cron/namespaces/<%= @current_namespace %>/all/disable" method="post" class="pull-right">
15
+ <%= csrf_tag %>
16
+ <input class="btn btn-warn" type="submit" name="enqueue" value="<%= t('DisableAll') %>" />
14
17
  </form>
15
- <form action="<%= root_path %>cron/__all__/enable" method="post" class="pull-right">
16
- <%= csrf_tag if respond_to?(:csrf_tag) %>
17
- <input class="btn btn-warn" type="submit" name="enque" value="<%= t('EnableAll') %>" />
18
+ <form action="<%= root_path %>cron/namespaces/<%= @current_namespace %>/all/enable" method="post" class="pull-right">
19
+ <%= csrf_tag %>
20
+ <input class="btn btn-warn" type="submit" name="enqueue" value="<%= t('EnableAll') %>" />
18
21
  </form>
19
- <form action="<%= root_path %>cron/__all__/enque" method="post" class="pull-right">
20
- <%= csrf_tag if respond_to?(:csrf_tag) %>
21
- <input class="btn btn-warn" type="submit" name="enque" value="<%= t('EnqueueAll') %>" data-confirm="<%= t('AreYouSureEnqueueCronJobs') %>" />
22
+ <form action="<%= root_path %>cron/namespaces/<%= @current_namespace %>/all/enqueue" method="post" class="pull-right">
23
+ <%= csrf_tag %>
24
+ <input class="btn btn-warn" type="submit" name="enqueue" value="<%= t('EnqueueAll') %>" data-confirm="<%= t('AreYouSureEnqueueCronJobs') %>" />
22
25
  </form>
23
26
  <% end %>
24
27
  </div>
25
28
  </header>
26
29
 
27
- <% if @cron_jobs.size > 0 %>
30
+ <!-- Namespaces -->
31
+ <div class='row'>
32
+ <div class="col-sm-12 summary_bar">
33
+ <ul class="list-unstyled summary row">
34
+ <% Sidekiq::Cron::Namespace.all_with_count.sort_by { |namespace| namespace[:name] }.each do |namespace| %>
35
+ <li class="col-sm-1">
36
+ <a href="<%= root_path %>cron/namespaces/<%= namespace[:name] %>">
37
+ <span class="count"><%= namespace[:count] %></span>
38
+ <span class="desc"><%= namespace[:name] %></span>
39
+ </a>
40
+ </li>
41
+ <% end %>
42
+ </ul>
43
+ </div>
44
+ </div>
45
+ <!-- Namespaces -->
28
46
 
47
+ <% if @cron_jobs.size > 0 %>
29
48
  <table class="table table-hover table-bordered table-striped table-white">
30
49
  <thead>
50
+ <tr>
31
51
  <th><%= t('Status') %></th>
32
- <th><%= t('Name') %></th>
33
- <th><%= t('Cron string') %></th>
34
- <th><%= t('Last enqueued') %></th>
35
- <th width="180"><%= t('Actions')%></th>
52
+ <th width="50%"><%= t('Name') %></th>
53
+ <th><%= t('CronString') %></th>
54
+ <th><%= t('LastEnqueued') %></th>
55
+ <th width="180"><%= t('Actions') %></th>
56
+ </tr>
36
57
  </thead>
37
58
 
38
59
  <tbody>
39
- <% @cron_jobs.sort{|a,b| a.sort_name <=> b.sort_name }.each_with_index do |job, index| %>
40
- <% style = "#{job.status == 'disabled' ? "background: #ecc; color: #585454;": ""}" %>
60
+ <% @cron_jobs.sort{ |a,b| a.sort_name <=> b.sort_name }.each do |job| %>
61
+ <% klass = (job.status == 'disabled') ? 'bg-danger text-muted' : '' %>
62
+ <% escaped_job_name = CGI.escape(job.name).gsub('+', '%20') %>
41
63
  <tr>
42
- <td style="<%= style %>"><%= t job.status %></td>
43
- <td style="<%= style %>">
44
- <a href="<%= root_path %>cron/<%= CGI.escape(job.name).gsub('+', '%20') %>">
45
- <b style="<%= style %>"><%= job.name %></b>
64
+ <td class="<%= klass %>"><%= t job.status %></td>
65
+ <td class="<%= klass %>">
66
+ <a href="<%= root_path %>cron/namespaces/<%= job.namespace %>/jobs/<%= escaped_job_name %>" title="<%= job.description %>">
67
+ <b class="<%= klass %>"><%= job.name %></b>
46
68
  </a>
47
- <hr style="margin:3px;border:0;">
48
- <small>
69
+ <br/>
49
70
  <% if job.message and job.message.to_s.size > 100 %>
50
- <% if Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new("6.3.0") %>
51
- <button data-toggle="job_<%= index %>" class="btn btn-warn btn-xs"><%= t('ShowAll')%></button>
52
- <div class="toggle" id="job_<%= index %>" style="display: inline;"><%= job.message[0..100] + "... " %></div>
53
- <div class="toggle" id="job_<%= index %>_full" style="display: none;"><%= job.message %></div>
54
- <% else %>
55
- <button data-toggle="collapse" data-target=".worker_<%= index %>" class="btn btn-warn btn-xs"><%= t('ShowAll')%></button>
56
- <div class="toggle worker_<%= index %>" style="display: inline;"><%= job.message[0..100] + "... " %></div>
57
- <div class="toggle worker_<%= index %>" style="display: none;"><%= job.message %></div>
58
- <% end %>
71
+ <details>
72
+ <summary class="btn btn-warn btn-xs">Show message</summary>
73
+ <p><small><%= job.message %></small></p>
74
+ </details>
59
75
  <% else %>
60
- <%= job.message %>
76
+ <small><%= job.message %></small>
61
77
  <% end %>
62
- </small>
63
78
  </td>
64
- <td style="<%= style %>"><b><%= job.cron.gsub(" ", "&nbsp;") %></b></td>
65
- <td style="<%= style %>"><%= job.last_enqueue_time ? relative_time(job.last_enqueue_time) : "-" %></td>
66
- <td style="<%= style %>">
79
+ <td class="<%= klass %>"><b><%= job.human_cron %><br/><small><%= job.cron.gsub(" ", "&nbsp;") %></small></b></td>
80
+ <td class="<%= klass %>"><%= job.last_enqueue_time ? relative_time(job.last_enqueue_time) : "-" %></td>
81
+ <td class="<%= klass %>">
67
82
  <% if job.status == 'enabled' %>
68
- <form action="<%= root_path %>cron/<%= CGI.escape(job.name).gsub('+', '%20') %>/enque" method="post">
69
- <%= csrf_tag if respond_to?(:csrf_tag) %>
70
- <input class='btn btn-warn btn-xs pull-left' type="submit" name="enque" value="<%= t('EnqueueNow') %>" data-confirm="<%= t('AreYouSureEnqueueCronJob', :job => job.name) %>"/>
83
+ <form action="<%= root_path %>cron/namespaces/<%= job.namespace %>/jobs/<%= escaped_job_name %>/enqueue" method="post">
84
+ <%= csrf_tag %>
85
+ <input class='btn btn-warn btn-xs pull-left' type="submit" name="enqueue" value="<%= t('EnqueueNow') %>" data-confirm="<%= t('AreYouSureEnqueueCronJob', :job => job.name) %>"/>
71
86
  </form>
72
- <form action="<%= root_path %>cron/<%= CGI.escape(job.name).gsub('+', '%20') %>/disable" method="post">
73
- <%= csrf_tag if respond_to?(:csrf_tag) %>
87
+ <form action="<%= root_path %>cron/namespaces/<%= job.namespace %>/jobs/<%= escaped_job_name %>/disable" method="post">
88
+ <%= csrf_tag %>
74
89
  <input class='btn btn-warn btn-xs pull-left' type="submit" name="disable" value="<%= t('Disable') %>"/>
75
90
  </form>
76
91
  <% else %>
77
- <form action="<%= root_path %>cron/<%= CGI.escape(job.name).gsub('+', '%20') %>/enque" method="post">
78
- <%= csrf_tag if respond_to?(:csrf_tag) %>
79
- <input class='btn btn-warn btn-xs pull-left' type="submit" name="enque" value="<%= t('EnqueueNow') %>"/>
92
+ <form action="<%= root_path %>cron/namespaces/<%= job.namespace %>/jobs/<%= escaped_job_name %>/enqueue" method="post">
93
+ <%= csrf_tag %>
94
+ <input class='btn btn-warn btn-xs pull-left' type="submit" name="enqueue" value="<%= t('EnqueueNow') %>" data-confirm="<%= t('AreYouSureEnqueueCronJob', :job => job.name) %>"/>
80
95
  </form>
81
- <form action="<%= root_path %>cron/<%= CGI.escape(job.name).gsub('+', '%20') %>/enable" method="post">
82
- <%= csrf_tag if respond_to?(:csrf_tag) %>
96
+ <form action="<%= root_path %>cron/namespaces/<%= job.namespace %>/jobs/<%= escaped_job_name %>/enable" method="post">
97
+ <%= csrf_tag %>
83
98
  <input class='btn btn-warn btn-xs pull-left' type="submit" name="enable" value="<%= t('Enable') %>"/>
84
99
  </form>
85
- <form action="<%= root_path %>cron/<%= CGI.escape(job.name).gsub('+', '%20') %>/delete" method="post">
86
- <%= csrf_tag if respond_to?(:csrf_tag) %>
87
- <input class='btn btn-xs btn-danger pull-left' type="submit" name="delete" value="<%= t('Delete') %>" data-confirm="<%= t('AreYouSureDeleteCronJob', :job => job.name) %>"/>
100
+ <form action="<%= root_path %>cron/namespaces/<%= job.namespace %>/jobs/<%= escaped_job_name %>/delete" method="post">
101
+ <%= csrf_tag %>
102
+ <input class='btn btn-xs btn-danger pull-left help-block' type="submit" name="delete" value="<%= t('Delete') %>" data-confirm="<%= t('AreYouSureDeleteCronJob', :job => job.name) %>"/>
88
103
  </form>
89
104
  <% end %>
90
105
  </td>