-
-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dashboard for cron-style jobs (#367)
* Add dashboard for cron-style jobs * Rename nav item * Apply review changes
- Loading branch information
Showing
5 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
engine/app/controllers/good_job/cron_schedules_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
module GoodJob | ||
class CronSchedulesController < GoodJob::BaseController | ||
def index | ||
configuration = GoodJob::Configuration.new({}) | ||
@cron_schedules = configuration.cron | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<% if @cron_schedules.present? %> | ||
<div class="card my-3"> | ||
<div class="table-responsive"> | ||
<table class="table card-table table-bordered table-hover table-sm mb-0"> | ||
<thead> | ||
<th>Cron Job Name</th> | ||
<th>Configuration</th> | ||
<th>Class</th> | ||
<th>Description</th> | ||
<th>Next execution</th> | ||
</thead> | ||
<tbody> | ||
<% @cron_schedules.each do |job_key, job| %> | ||
<tr> | ||
<td class="font-monospace"><%= job_key %></td> | ||
<td class="font-monospace"><%= job[:cron] %></td> | ||
<td class="font-monospace"><%= job[:class] %></td> | ||
<td><%= job[:description] %></td> | ||
<td><%= Fugit.parse_cron(job[:cron]).next_time.to_local_time %></td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
<% else %> | ||
<em>No cron jobs present.</em> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
require 'rails_helper' | ||
|
||
describe 'Cron Schedules', type: :system, js: true do | ||
it 'renders successfully' do | ||
visit '/good_job/cron_schedules' | ||
expect(page).to have_content 'ExampleJob' | ||
end | ||
end |