-
-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganize Cron dashboard screen; add jobs drill-drown and enqueue no…
…w action (#436) - Creates more space by putting job properties within a collapsible element. - Moves `ActiveJobJob` class out of the engine and into `lib`
- Loading branch information
1 parent
5df2c05
commit a0da08a
Showing
31 changed files
with
346 additions
and
151 deletions.
There are no files selected for viewing
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
19 changes: 19 additions & 0 deletions
19
engine/app/controllers/good_job/cron_entries_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,19 @@ | ||
# frozen_string_literal: true | ||
module GoodJob | ||
class CronEntriesController < GoodJob::BaseController | ||
def index | ||
@cron_entries = CronEntry.all | ||
end | ||
|
||
def show | ||
@cron_entry = CronEntry.find(params[:id]) | ||
@jobs_filter = JobsFilter.new(params, @cron_entry.jobs) | ||
end | ||
|
||
def enqueue | ||
@cron_entry = CronEntry.find(params[:id]) | ||
@cron_entry.enqueue(Time.current) | ||
redirect_back(fallback_location: cron_entries_path, notice: "Cron entry has been enqueued.") | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -12,7 +12,7 @@ def states | |
|
||
private | ||
|
||
def base_query | ||
def default_base_query | ||
GoodJob::Execution.all | ||
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ def states | |
|
||
private | ||
|
||
def base_query | ||
def default_base_query | ||
GoodJob::ActiveJobJob.all | ||
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,51 @@ | ||
<% if @cron_entries.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>Key</th> | ||
<th>Schedule</th> | ||
<th> | ||
Properties | ||
<%= tag.button "Toggle", type: "button", class: "btn btn-sm btn-outline-primary", role: "button", | ||
data: { bs_toggle: "collapse", bs_target: ".cron-entry-properties" }, | ||
aria: { expanded: false, controls: @cron_entries.map { |cron_entry| "##{dom_id(cron_entry, 'properties')}" }.join(" ") } | ||
%> | ||
</th> | ||
<th>Description</th> | ||
<th>Next scheduled</th> | ||
<th>Last run</th> | ||
<th>Actions</th> | ||
</thead> | ||
<tbody> | ||
<% @cron_entries.each do |cron_entry| %> | ||
<tr id="<%= dom_id(cron_entry) %>"> | ||
<td class="font-monospace"><%= cron_entry.key %></td> | ||
<td class="font-monospace"><%= cron_entry.cron %></td> | ||
<td> | ||
<%= tag.button("Preview", type: "button", class: "btn btn-sm btn-outline-primary", role: "button", | ||
data: { bs_toggle: "collapse", bs_target: "##{dom_id(cron_entry, 'properties')}" }, | ||
aria: { expanded: false, controls: dom_id(cron_entry, 'properties') }) %> | ||
<%= tag.pre(JSON.pretty_generate(cron_entry.display_properties), id: dom_id(cron_entry, 'properties'), class: "collapse cron-entry-properties") %> | ||
</td> | ||
<td><%= cron_entry.description %></td> | ||
<td><%= cron_entry.next_at %></td> | ||
<td> | ||
<% if cron_entry.last_job.present? %> | ||
<%= link_to cron_entry.last_at, cron_entry_path(cron_entry), title: "Job #{cron_entry.last_job.id}" %> | ||
<% end %> | ||
</td> | ||
<td> | ||
<%= button_to enqueue_cron_entry_path(cron_entry.id), method: :post, class: "btn btn-sm btn-outline-primary", form_class: "d-inline-block", aria: { label: "Run cron entry now" }, title: "Run cron entry now", data: { confirm: "Confirm run cron entry now" } do %> | ||
<%= render "good_job/shared/icons/play" %> | ||
<% end %> | ||
</td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
<% else %> | ||
<em>No cron schedules 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<h1 class="mb-3">Cron Entry Key: <code><%= @cron_entry.id %></code></h1> | ||
|
||
<%= render 'good_job/shared/filter', filter: @jobs_filter %> | ||
<%= render 'good_job/jobs/table', jobs: @jobs_filter.records %> |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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
File renamed without changes.
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<h1>ActiveJob ID: <code><%= @executions.first.id %></code></h1> | ||
<h1 class="mb-3">ActiveJob ID: <code><%= @executions.first.id %></code></h1> | ||
|
||
<%= render 'good_job/shared/executions_table', executions: @executions %> | ||
<%= render 'good_job/executions/table', executions: @executions %> |
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,4 @@ | ||
<!-- https://icons.getbootstrap.com/icons/play/ --> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-play" viewBox="0 0 16 16"> | ||
<path d="M10.804 8 5 4.633v6.734L10.804 8zm.792-.696a.802.802 0 0 1 0 1.392l-6.363 3.692C4.713 12.69 4 12.345 4 11.692V4.308c0-.653.713-.998 1.233-.696l6.363 3.692z" /> | ||
</svg> |
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
File renamed without changes.
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
Oops, something went wrong.