Skip to content

Commit

Permalink
Susulan tombol queue (#470)
Browse files Browse the repository at this point in the history
* Buat component sweetalert

* Jalankan sweetalert

* Hapus yang tidak digunakan

Co-authored-by: vickyrolanda <[email protected]>
  • Loading branch information
yogiperdana and vickyrolanda authored Aug 25, 2022
1 parent d157de0 commit 8fa5c7a
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 22 deletions.
17 changes: 13 additions & 4 deletions app/Http/Controllers/LogViewerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,18 @@ public function linkStorage()

public function queueListen()
{
Artisan::call('queue:work', ['--stop-when-empty' => null]); // this will do the command line job
sleep(2);

return back()->with('tab', 'ekstensi')->with('success', 'Berhasil menjalankan php artisan queue:listen');
try {
Artisan::call('queue:work', ['--stop-when-empty' => null]); // this will do the command line job

return response()->json([
'status' => true,
'message' => 'success',
]);
} catch (\Exception $e) {
return response()->json([
'status' => true,
'message' => $e->getMessage(),
]);
}
}
}
Binary file removed public/img/loading.gif
Binary file not shown.
2 changes: 2 additions & 0 deletions public/js/sweetalert2/sweetalert2.all.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/js/sweetalert2/sweetalert2.min.css

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions resources/views/partials/asset_sweetalert.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@push('css')
<!-- Sweetalert CSS-->
<link rel="stylesheet" href="{{ asset('js/sweetalert2/sweetalert2.min.css') }}">
@endpush

@push('scripts')
<!-- Sweetalert JS -->
<script src="{{ asset('js/sweetalert2/sweetalert2.all.min.js') }}"></script>
@endpush
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,7 @@
</div>
</div>

<div class="modal fade" id='loading' tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header btn-warning">
<h4 class="modal-title">Proses Queue Work</h4>
</div>
<div class="modal-body">
Harap tunggu sampai proses selesai. Proses ini bisa memakan waktu beberapa menit tergantung data yang dikirmkan.
<div class='text-center'>
<img src="{{ '../img/loading.gif' }}">
</div>
</div>
</div>
</div>
</div>
@include('partials.asset_sweetalert')

@push('scripts')
<script>
Expand All @@ -64,11 +50,16 @@
$(document)
.ajaxStart(function () {
$('#loading').modal('show');
Swal.showLoading()
})
.ajaxStop(function () {
$('#loading').modal('hide');
alert('Berhasil menjalankan queue');
Swal.fire({
position: 'center',
icon: 'success',
title: 'Perintah berhasil dijalankan',
showConfirmButton: false,
timer: 1500
})
});
</script>
@endpush

0 comments on commit 8fa5c7a

Please sign in to comment.