File tree Expand file tree Collapse file tree 2 files changed +18
-10
lines changed Expand file tree Collapse file tree 2 files changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -14,11 +14,14 @@ class ExportButtonComponent extends Component
14
14
15
15
public $ exporting = false ;
16
16
public $ exportFinished = false ;
17
+ public $ exportFailed = false ;
17
18
public $ batchJobId = null ;
18
19
19
20
public function export ($ batchJobId )
20
21
{
21
22
$ this ->batchJobId = $ batchJobId ;
23
+ $ this ->exportFinished = false ;
24
+ $ this ->exportFailed = false ;
22
25
$ this ->exporting = true ;
23
26
}
24
27
@@ -34,6 +37,7 @@ public function getExportBatchProperty()
34
37
public function updateExportProgress ()
35
38
{
36
39
$ this ->exportFinished = $ this ->exportBatch ->finished ();
40
+ $ this ->exportFailed = $ this ->exportBatch ->hasFailures ();
37
41
38
42
if ($ this ->exportFinished ) {
39
43
$ this ->exporting = false ;
Original file line number Diff line number Diff line change 1
1
<div class =" d-flex align-items-center" x-data >
2
- <form class =" mr-2"
3
- x-on:submit.prevent ="
2
+ <form class =" mr-2"
3
+ x-on:submit.prevent ="
4
4
$refs.exportBtn.disabled = true;
5
5
var url = window._buildUrl(LaravelDataTables['{{ $tableId } } '], 'exportQueue');
6
6
$.get(url + '&exportType={{ $type } } ').then(function(exportId) {
7
7
$wire.export(exportId)
8
8
});
9
9
"
10
- >
11
- <button type =" submit"
12
- x-ref =" exportBtn"
13
- :disabled =" $wire.exporting"
14
- class =" btn btn-primary"
15
- >Export</button >
16
- </form >
10
+ >
11
+ <button type =" submit"
12
+ x-ref =" exportBtn"
13
+ :disabled =" $wire.exporting"
14
+ class =" btn btn-primary"
15
+ >Export</button >
16
+ </form >
17
17
18
18
@if ($exporting && ! $exportFinished )
19
19
<div class =" d-inline" wire:poll =" updateExportProgress" >Exporting...please wait.</div >
20
20
@endif
21
21
22
- @if ($exportFinished )
22
+ @if ($exportFinished && ! $exportFailed )
23
23
<span >Done. Download file <a href =" #" class =" text-primary" wire:click.prevent =" downloadExport" >here</a ></span >
24
24
@endif
25
+
26
+ @if ($exportFailed )
27
+ <span >Export failed, please try again later.</span >
28
+ @endif
25
29
</div >
You can’t perform that action at this time.
0 commit comments