mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
Merge branch '4.x' of https://github.com/filamentphp/filament into 4.x
This commit is contained in:
@@ -156,13 +156,16 @@ trait CanExportRecords
|
||||
$maxRows = $action->getMaxRows() ?? $totalRows;
|
||||
|
||||
if ($maxRows < $totalRows) {
|
||||
Notification::make()
|
||||
->title(__('filament-actions::export.notifications.max_rows.title'))
|
||||
->body(trans_choice('filament-actions::export.notifications.max_rows.body', $maxRows, [
|
||||
'count' => Number::format($maxRows),
|
||||
]))
|
||||
->danger()
|
||||
->send();
|
||||
$action->failureNotification(
|
||||
Notification::make()
|
||||
->title(__('filament-actions::export.notifications.max_rows.title'))
|
||||
->body(trans_choice('filament-actions::export.notifications.max_rows.body', $maxRows, [
|
||||
'count' => Number::format($maxRows),
|
||||
]))
|
||||
->danger(),
|
||||
);
|
||||
|
||||
$action->failure();
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -270,17 +273,23 @@ trait CanExportRecords
|
||||
->dispatch();
|
||||
|
||||
if (
|
||||
(filled($jobConnection) && ($jobConnection !== 'sync')) ||
|
||||
(blank($jobConnection) && (config('queue.default') !== 'sync'))
|
||||
($jobConnection === 'sync')
|
||||
|| (blank($jobConnection) && (config('queue.default') === 'sync'))
|
||||
) {
|
||||
$action->successNotification(null);
|
||||
$action->successNotificationTitle(null);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$action->successNotification(
|
||||
Notification::make()
|
||||
->title($action->getSuccessNotificationTitle())
|
||||
->body(trans_choice('filament-actions::export.notifications.started.body', $export->total_rows, [
|
||||
'count' => Number::format($export->total_rows),
|
||||
]))
|
||||
->success()
|
||||
->send();
|
||||
}
|
||||
->success(),
|
||||
);
|
||||
});
|
||||
|
||||
$this->defaultColor('gray');
|
||||
|
||||
@@ -202,13 +202,16 @@ class ImportAction extends Action
|
||||
$maxRows = $action->getMaxRows() ?? $totalRows;
|
||||
|
||||
if ($maxRows < $totalRows) {
|
||||
Notification::make()
|
||||
->title(__('filament-actions::import.notifications.max_rows.title'))
|
||||
->body(trans_choice('filament-actions::import.notifications.max_rows.body', $maxRows, [
|
||||
'count' => Number::format($maxRows),
|
||||
]))
|
||||
->danger()
|
||||
->send();
|
||||
$action->failureNotification(
|
||||
Notification::make()
|
||||
->title(__('filament-actions::import.notifications.max_rows.title'))
|
||||
->body(trans_choice('filament-actions::import.notifications.max_rows.body', $maxRows, [
|
||||
'count' => Number::format($maxRows),
|
||||
]))
|
||||
->danger(),
|
||||
);
|
||||
|
||||
$action->failure();
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -311,7 +314,7 @@ class ImportAction extends Action
|
||||
)
|
||||
->when(
|
||||
($jobConnection === 'sync') ||
|
||||
(blank($jobConnection) && (config('queue.default') === 'sync')),
|
||||
(blank($jobConnection) && (config('queue.default') === 'sync')),
|
||||
fn (Notification $notification) => $notification
|
||||
->persistent()
|
||||
->send(),
|
||||
@@ -321,17 +324,23 @@ class ImportAction extends Action
|
||||
->dispatch();
|
||||
|
||||
if (
|
||||
(filled($jobConnection) && ($jobConnection !== 'sync')) ||
|
||||
(blank($jobConnection) && (config('queue.default') !== 'sync'))
|
||||
($jobConnection === 'sync')
|
||||
|| (blank($jobConnection) && (config('queue.default') === 'sync'))
|
||||
) {
|
||||
$action->successNotification(null);
|
||||
$action->successNotificationTitle(null);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$action->successNotification(
|
||||
Notification::make()
|
||||
->title($action->getSuccessNotificationTitle())
|
||||
->body(trans_choice('filament-actions::import.notifications.started.body', $import->total_rows, [
|
||||
'count' => Number::format($import->total_rows),
|
||||
]))
|
||||
->success()
|
||||
->send();
|
||||
}
|
||||
->success(),
|
||||
);
|
||||
});
|
||||
|
||||
$this->registerModalActions([
|
||||
|
||||
Reference in New Issue
Block a user