-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
2,042 additions
and
1 deletion.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
22 changes: 22 additions & 0 deletions
22
packages/actions/database/migrations/create_failed_import_rows_table.php
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,22 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class() extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
Schema::create('failed_import_rows', function (Blueprint $table) { | ||
$table->id(); | ||
$table->json('data'); | ||
$table->foreignId('import_id')->constrained()->cascadeOnDelete(); | ||
$table->text('validation_error')->nullable(); | ||
$table->timestamps(); | ||
}); | ||
} | ||
}; |
27 changes: 27 additions & 0 deletions
27
packages/actions/database/migrations/create_imports_table.php
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,27 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class() extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
Schema::create('imports', function (Blueprint $table) { | ||
$table->id(); | ||
$table->timestamp('completed_at')->nullable(); | ||
$table->string('file_name'); | ||
$table->string('file_path'); | ||
$table->string('importer'); | ||
$table->unsignedInteger('processed_rows')->default(0); | ||
$table->unsignedInteger('total_rows'); | ||
$table->unsignedInteger('successful_rows')->default(0); | ||
$table->foreignId('user_id')->constrained()->cascadeOnDelete(); | ||
$table->timestamps(); | ||
}); | ||
} | ||
}; |
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,77 @@ | ||
<?php | ||
|
||
return [ | ||
|
||
'label' => 'Import :label', | ||
|
||
'modal' => [ | ||
|
||
'heading' => 'Import :label', | ||
|
||
'form' => [ | ||
|
||
'file' => [ | ||
'label' => 'File', | ||
'placeholder' => 'Upload a .csv file', | ||
], | ||
|
||
'columns' => [ | ||
'label' => 'Columns', | ||
'placeholder' => 'Select a column', | ||
], | ||
|
||
], | ||
|
||
'actions' => [ | ||
|
||
'download_example' => [ | ||
'label' => 'Download an example .csv file.', | ||
], | ||
|
||
'import' => [ | ||
'label' => 'Start import', | ||
], | ||
|
||
], | ||
|
||
], | ||
|
||
'notifications' => [ | ||
|
||
'completed' => [ | ||
|
||
'title' => 'Import completed', | ||
|
||
'actions' => [ | ||
|
||
'download_failed_rows_csv' => [ | ||
'label' => 'Download information about the failed row|Download information about the failed rows', | ||
], | ||
|
||
], | ||
|
||
], | ||
|
||
'max_rows' => [ | ||
'title' => 'That file is too large to import', | ||
'body' => 'You may not import more than :count row at once.', | ||
], | ||
|
||
'started' => [ | ||
'title' => 'Import started', | ||
'body' => 'Your import has begun and 1 row will be processed in the background.|Your import has begun and :count rows will be processed in the background.', | ||
], | ||
|
||
], | ||
|
||
'example_csv' => [ | ||
'file_name' => ':importer-example', | ||
], | ||
|
||
'failure_csv' => [ | ||
'file_name' => 'import-:import_id-:csv_name-failed-rows', | ||
'error_header' => 'error', | ||
'system_error' => 'System error, please contact support.', | ||
], | ||
|
||
]; |
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,8 @@ | ||
<?php | ||
|
||
use Filament\Actions\Imports\Http\Controllers\DownloadImportFailureCsv; | ||
use Illuminate\Support\Facades\Route; | ||
|
||
Route::get('/filament/imports/{import}/failed-rows/download', DownloadImportFailureCsv::class) | ||
->name('filament.imports.failed-rows.download') | ||
->middleware(['web', 'auth']); |
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
12 changes: 12 additions & 0 deletions
12
packages/actions/src/Commands/Aliases/MakeImporterCommand.php
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,12 @@ | ||
<?php | ||
|
||
namespace Filament\Actions\Commands\Aliases; | ||
|
||
use Filament\Actions\Commands; | ||
|
||
class MakeImporterCommand extends Commands\MakeImporterCommand | ||
{ | ||
protected $hidden = true; | ||
|
||
protected $signature = 'filament:importer {name?} {--G|generate} {--F|force}'; | ||
} |
Oops, something went wrong.