-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a "Discard all" button to queue show page, if there are enqueued…
… jobs
- Loading branch information
1 parent
217f344
commit 4230a96
Showing
4 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
app/controllers/mission_control/jobs/queues/discards_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,9 @@ | ||
class MissionControl::Jobs::Queues::DiscardsController < MissionControl::Jobs::ApplicationController | ||
include MissionControl::Jobs::QueueScoped | ||
|
||
def create | ||
@queue.clear | ||
|
||
redirect_to application_queues_url(@application) | ||
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
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,20 @@ | ||
require_relative "../application_system_test_case" | ||
|
||
class DiscardQueueJobsTest < ApplicationSystemTestCase | ||
setup do | ||
DummyJob.queue_as :queue_1 | ||
10.times { |index| DummyJob.perform_later("dummy-arg-#{index}") } | ||
|
||
visit queues_path | ||
end | ||
|
||
test "discard all jobs" do | ||
click_on "queue_1" | ||
|
||
assert_equal 10, job_row_elements.length | ||
|
||
accept_confirm do | ||
click_on "Discard all" | ||
end | ||
end | ||
end |