Skip to content

Commit

Permalink
Allow to cancel queued job - closes #606, #611
Browse files Browse the repository at this point in the history
  • Loading branch information
freescout-help-desk committed May 16, 2020
1 parent 84b3df8 commit bc60281
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/Http/Controllers/SystemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ public function status(Request $request)
public function action(Request $request)
{
switch ($request->action) {
case 'cancel_job':
\App\Job::where('id', $request->job_id)->delete();
\Session::flash('flash_success_floating', __('Done'));
break;

case 'delete_failed_jobs':
\App\FailedJob::where('queue', $request->failed_queue)->delete();
\Session::flash('flash_success_floating', __('Failed jobs deleted'));
Expand Down
11 changes: 10 additions & 1 deletion resources/views/system/status.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,16 @@
<table class="table">
<tbody>
<tr>
<th colspan="2">{{ $loop->index+1 }}. {{ json_decode($job->payload, true)['displayName'] }}</th>
<th>{{ $loop->index+1 }}. {{ json_decode($job->payload, true)['displayName'] }}</th>
<th>
<form action="{{ route('system.action') }}" method="POST" class="text-right">
{{ csrf_field() }}

<input type="hidden" name="job_id" value="{{ $job->id }}" />

<button type="submit" name="action" value="cancel_job" class="btn btn-default btn-xs margin-left-10">{{ __('Cancel') }}</button>
</form>
</th>
</tr>
<tr>
<td>{{ __('Queue') }}</td>
Expand Down

0 comments on commit bc60281

Please sign in to comment.