sidekiq-cron 1.12.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +39 -2
- data/Gemfile +3 -0
- data/README.md +197 -35
- data/lib/sidekiq/cron/job.rb +252 -160
- data/lib/sidekiq/cron/launcher.rb +2 -5
- data/lib/sidekiq/cron/locales/de.yml +15 -6
- data/lib/sidekiq/cron/locales/en.yml +14 -14
- data/lib/sidekiq/cron/locales/id.yml +22 -0
- data/lib/sidekiq/cron/locales/it.yml +15 -16
- data/lib/sidekiq/cron/locales/ja.yml +14 -10
- data/lib/sidekiq/cron/locales/pt.yml +14 -14
- data/lib/sidekiq/cron/locales/ru.yml +15 -7
- data/lib/sidekiq/cron/locales/zh-CN.yml +14 -11
- data/lib/sidekiq/cron/namespace.rb +43 -0
- data/lib/sidekiq/cron/poller.rb +12 -13
- data/lib/sidekiq/cron/schedule_loader.rb +1 -5
- data/lib/sidekiq/cron/support.rb +1 -2
- data/lib/sidekiq/cron/version.rb +1 -1
- data/lib/sidekiq/cron/views/cron.erb +68 -53
- data/lib/sidekiq/cron/views/cron_show.erb +16 -12
- data/lib/sidekiq/cron/web.rb +12 -2
- data/lib/sidekiq/cron/web_extension.rb +77 -30
- data/lib/sidekiq/cron.rb +61 -5
- data/lib/sidekiq/options.rb +3 -5
- data/lib/sidekiq-cron.rb +6 -0
- data/sidekiq-cron.gemspec +3 -2
- metadata +31 -9
@@ -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
|
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] =
|
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
|
-
|
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
|
-
|
7
|
-
|
17
|
+
Job: Job
|
18
|
+
LastEnqueued: Eingereiht
|
8
19
|
NoCronJobsWereFound: Keine Cronjobs gefunden
|
9
|
-
|
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
|
-
|
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
|
-
|
6
|
-
|
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
|
-
|
10
|
-
|
11
|
-
|
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
|
-
|
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
|
+
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
|
-
|
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
|
5
|
-
|
6
|
-
|
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
|
-
|
10
|
-
|
11
|
-
|
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
|
-
|
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
|
-
|
2
|
+
AreYouSureDeleteCronJob: "本当に%{job}のcronジョブを削除しますか?"
|
3
|
+
AreYouSureDeleteCronJobs: "本当にすべてのcronジョブを削除しますか?"
|
4
|
+
AreYouSureEnqueueCronJob: "%{job} の クロン ジョブをキューに入れてもよろしいですか?"
|
5
|
+
AreYouSureEnqueueCronJobs: "すべての クロン ジョブをキューに入れてもよろしいですか?"
|
3
6
|
Cron: Cron
|
4
7
|
CronJobs: Cronジョブ
|
5
|
-
|
6
|
-
|
8
|
+
CronString: Cron
|
9
|
+
DeleteAll: すべて削除
|
10
|
+
Description: 説明
|
11
|
+
Disable: 無効にする
|
7
12
|
DisableAll: すべて無効にする
|
13
|
+
Enable: 有効にする
|
14
|
+
EnableAll: すべて有効にする
|
8
15
|
EnqueueAll: すべてキューに入れる
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
AreYouSureDeleteCronJob: 本当に%{job}のcronジョブを削除しますか?
|
16
|
+
EnqueueNow: すぐにキューに入れる
|
17
|
+
Job: ジョブ
|
18
|
+
LastEnqueued: 最後のキュー
|
13
19
|
NoCronJobsWereFound: Cronジョブが見つかりませんでした
|
14
|
-
|
15
|
-
Disable: 無効にする
|
16
|
-
'Last enqueued': 最後のキュー
|
20
|
+
NoHistoryWereFound: 履歴が見つかりませんでした
|
17
21
|
disabled: 無効
|
18
22
|
enabled: 有効
|
@@ -1,22 +1,22 @@
|
|
1
1
|
pt:
|
2
|
-
|
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
|
-
|
6
|
-
|
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
|
-
|
10
|
-
|
11
|
-
|
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
|
-
|
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
|
-
|
2
|
+
AreYouSureDeleteCronJob: Вы действительно хотите удалить задачу «%{job}»?
|
3
|
+
AreYouSureDeleteCronJobs: Вы уверены, что хотите удалить ВСЕ cron-задачи?
|
4
|
+
AreYouSureEnqueueCronJob: Вы уверены, что хотите добавить в очередь cron-задачу %{job}?
|
5
|
+
AreYouSureEnqueueCronJobs: Вы уверены, что хотите добавить в очередь ВСЕ cron-задачи?
|
3
6
|
Cron: Cron
|
4
7
|
CronJobs: Периодические задачи
|
5
|
-
|
6
|
-
|
8
|
+
CronString: Периодичность (синтаксис Cron)
|
9
|
+
DeleteAll: Удалить все
|
10
|
+
Description: Описание
|
11
|
+
Disable: Отключить
|
12
|
+
DisableAll: Отключить все
|
13
|
+
Enable: Включить
|
14
|
+
EnableAll: Включить все
|
15
|
+
EnqueueAll: Добавить все в очередь
|
7
16
|
EnqueueNow: Запустить
|
8
|
-
|
17
|
+
Job: Задача
|
18
|
+
LastEnqueued: Последний запуск
|
9
19
|
NoCronJobsWereFound: Не найдено периодических задач
|
10
|
-
|
11
|
-
Disable: Отключить
|
12
|
-
'Last enqueued': Последний запуск
|
20
|
+
NoHistoryWereFound: История не найдена
|
13
21
|
disabled: отключено
|
14
22
|
enabled: включено
|
@@ -1,19 +1,22 @@
|
|
1
1
|
zh-CN:
|
2
|
-
|
2
|
+
AreYouSureDeleteCronJob: 你确定删除定时任务(%{job})吗?
|
3
|
+
AreYouSureDeleteCronJobs: 你确定删除所有的定时任务吗?
|
4
|
+
AreYouSureEnqueueCronJob: 您确定要将 %{job} 的 定时任务 任务加入队列吗?
|
5
|
+
AreYouSureEnqueueCronJobs: 您确定要将所有 定时任务 任务加入队列吗?
|
3
6
|
Cron: 定时任务
|
4
7
|
CronJobs: 定时任务列表
|
5
|
-
|
6
|
-
|
8
|
+
CronString: 定时策略
|
9
|
+
DeleteAll: 删除所有
|
10
|
+
Description: 描述
|
11
|
+
Disable: 禁用
|
7
12
|
DisableAll: 禁用所有
|
13
|
+
Enable: 启用
|
14
|
+
EnableAll: 启用所有
|
8
15
|
EnqueueAll: 执行所有
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
AreYouSureDeleteCronJob: 你确定删除定时任务(%{job})吗?
|
16
|
+
EnqueueNow: 立刻执行
|
17
|
+
Job: 任务
|
18
|
+
LastEnqueued: 放入队列时间
|
13
19
|
NoCronJobsWereFound: 没有定时任务
|
14
|
-
|
15
|
-
Disable: 禁用
|
16
|
-
'Last enqueued': 放入队列时间
|
20
|
+
NoHistoryWereFound: 未找到历史记录
|
17
21
|
disabled: 已禁用
|
18
22
|
enabled: 已启用
|
19
|
-
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Sidekiq
|
2
|
+
module Cron
|
3
|
+
class Namespace
|
4
|
+
def self.all
|
5
|
+
namespaces = nil
|
6
|
+
|
7
|
+
Sidekiq.redis do |conn|
|
8
|
+
namespaces = conn.keys('cron_jobs:*').collect do |key|
|
9
|
+
key.split(':').last
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# Adds the default namespace if not present
|
14
|
+
has_default = namespaces.detect do |name|
|
15
|
+
name == Sidekiq::Cron.configuration.default_namespace
|
16
|
+
end
|
17
|
+
|
18
|
+
unless has_default
|
19
|
+
namespaces << Sidekiq::Cron.configuration.default_namespace
|
20
|
+
end
|
21
|
+
|
22
|
+
namespaces
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.all_with_count
|
26
|
+
all.map do |namespace_name|
|
27
|
+
{
|
28
|
+
count: count(namespace_name),
|
29
|
+
name: namespace_name
|
30
|
+
}
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.count(name = Sidekiq::Cron.configuration.default_namespace)
|
35
|
+
out = 0
|
36
|
+
Sidekiq.redis do |conn|
|
37
|
+
out = conn.scard("cron_jobs:#{name}")
|
38
|
+
end
|
39
|
+
out
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/sidekiq/cron/poller.rb
CHANGED
@@ -1,25 +1,24 @@
|
|
1
|
-
|
2
|
-
|
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
|
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
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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.
|
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::
|
2
|
+
schedule_file = Sidekiq::Cron.configuration.cron_schedule_file
|
7
3
|
|
8
4
|
if File.exist?(schedule_file)
|
9
5
|
config.on(:startup) do
|
data/lib/sidekiq/cron/support.rb
CHANGED
@@ -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
|
|
data/lib/sidekiq/cron/version.rb
CHANGED
@@ -1,90 +1,105 @@
|
|
1
1
|
<header class='row'>
|
2
2
|
<div class='col-sm-5 pull-left'>
|
3
|
-
<h3
|
3
|
+
<h3>
|
4
|
+
<%= t('CronJobs') %>
|
5
|
+
<small><%= @current_namespace %></small>
|
6
|
+
</h3>
|
4
7
|
</div>
|
5
|
-
<div class='col-sm-7 pull-right'
|
8
|
+
<div class='col-sm-7 pull-right h2'>
|
6
9
|
<% if @cron_jobs.size > 0 %>
|
7
|
-
<form action="<%= root_path %>cron/
|
8
|
-
<%= 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/
|
12
|
-
<%= csrf_tag
|
13
|
-
<input class="btn btn-warn" type="submit" name="
|
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/
|
16
|
-
<%= csrf_tag
|
17
|
-
<input class="btn btn-warn" type="submit" name="
|
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/
|
20
|
-
<%= csrf_tag
|
21
|
-
<input class="btn btn-warn" type="submit" name="
|
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
|
-
|
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('
|
34
|
-
<th><%= t('
|
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 }.
|
40
|
-
<%
|
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
|
43
|
-
<td
|
44
|
-
<a href="<%= root_path %>cron/<%=
|
45
|
-
<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
|
-
<
|
48
|
-
<small>
|
69
|
+
<br/>
|
49
70
|
<% if job.message and job.message.to_s.size > 100 %>
|
50
|
-
|
51
|
-
<
|
52
|
-
<
|
53
|
-
|
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
|
-
|
76
|
+
<small><%= job.message %></small>
|
61
77
|
<% end %>
|
62
|
-
</small>
|
63
78
|
</td>
|
64
|
-
<td
|
65
|
-
<td
|
66
|
-
<td
|
79
|
+
<td class="<%= klass %>"><b><%= job.human_cron %><br/><small><%= job.cron.gsub(" ", " ") %></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/<%=
|
69
|
-
<%= csrf_tag
|
70
|
-
<input class='btn btn-warn btn-xs pull-left' type="submit" 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/<%=
|
73
|
-
<%= 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/<%=
|
78
|
-
<%= csrf_tag
|
79
|
-
<input class='btn btn-warn btn-xs pull-left' type="submit" name="
|
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/<%=
|
82
|
-
<%= 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/<%=
|
86
|
-
<%= 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>
|
@@ -5,25 +5,25 @@
|
|
5
5
|
<small><%= @job.name %></small>
|
6
6
|
</h3>
|
7
7
|
</div>
|
8
|
-
<div class="span col-sm-7 pull-right
|
9
|
-
<% cron_job_path = "#{root_path}cron/#{CGI.escape(@job.name).gsub('+', '%20')}" %>
|
10
|
-
<form action="<%= cron_job_path %>/
|
11
|
-
<%= csrf_tag
|
12
|
-
<input class="btn btn-warn pull-left" name="
|
8
|
+
<div class="span col-sm-7 pull-right h2">
|
9
|
+
<% cron_job_path = "#{root_path}cron/namespaces/#{@current_namespace}/jobs/#{CGI.escape(@job.name).gsub('+', '%20')}" %>
|
10
|
+
<form action="<%= cron_job_path %>/enqueue?redirect=<%= cron_job_path %>" class="pull-right" method="post">
|
11
|
+
<%= csrf_tag %>
|
12
|
+
<input class="btn btn-warn pull-left" name="enqueue" type="submit" value="<%= t('EnqueueNow') %>" data-confirm="<%= t('AreYouSureEnqueueCronJob', :job => @job.name) %>" />
|
13
13
|
</form>
|
14
14
|
<% if @job.status == 'enabled' %>
|
15
|
-
<form action="<%= cron_job_path %>/disable?redirect=<%= cron_job_path %>" method="post">
|
16
|
-
<%= csrf_tag
|
15
|
+
<form action="<%= cron_job_path %>/disable?redirect=<%= cron_job_path %>" class="pull-right" method="post">
|
16
|
+
<%= csrf_tag %>
|
17
17
|
<input class="btn btn-warn pull-left" name="disable" type="submit" value="<%= t('Disable') %>" />
|
18
18
|
</form>
|
19
19
|
<% else %>
|
20
|
-
<form action="<%= cron_job_path %>/enable?redirect=<%= cron_job_path %>" method="post">
|
21
|
-
<%= csrf_tag
|
20
|
+
<form action="<%= cron_job_path %>/enable?redirect=<%= cron_job_path %>" class="pull-right" method="post">
|
21
|
+
<%= csrf_tag %>
|
22
22
|
<input class="btn btn-warn pull-left" name="enable" type="submit" value="<%= t('Enable') %>" />
|
23
23
|
</form>
|
24
|
-
<form action="<%= cron_job_path %>/delete" method="post">
|
25
|
-
<%= csrf_tag
|
26
|
-
<input class="btn btn-danger" data-confirm="<%= t('AreYouSureDeleteCronJob', :job => @job.name) %>" name="delete" type="submit" value="<%= t('Delete') %>" />
|
24
|
+
<form action="<%= cron_job_path %>/delete" class="pull-right" method="post">
|
25
|
+
<%= csrf_tag %>
|
26
|
+
<input class="btn btn-danger pull-left" data-confirm="<%= t('AreYouSureDeleteCronJob', :job => @job.name) %>" name="delete" type="submit" value="<%= t('Delete') %>" />
|
27
27
|
</form>
|
28
28
|
<% end %>
|
29
29
|
</div>
|
@@ -39,6 +39,10 @@
|
|
39
39
|
<th><%= t 'Name' %></th>
|
40
40
|
<td><%= @job.name %></td>
|
41
41
|
</tr>
|
42
|
+
<tr>
|
43
|
+
<th><%= t 'Namespace' %></th>
|
44
|
+
<td><%= @job.namespace %></td>
|
45
|
+
</tr>
|
42
46
|
<tr>
|
43
47
|
<th><%= t 'Description' %></th>
|
44
48
|
<td><%= @job.description %></td>
|