mirror of
https://github.com/pelican-dev/panel.git
synced 2025-12-08 18:30:15 +01:00
don't try to bulk update if egg doesn't even have a url (#1887)
This commit is contained in:
parent
108dad09fb
commit
20cb7850ef
@ -49,9 +49,15 @@ class UpdateEggBulkAction extends BulkAction
|
|||||||
|
|
||||||
$success = 0;
|
$success = 0;
|
||||||
$failed = 0;
|
$failed = 0;
|
||||||
|
$skipped = 0;
|
||||||
|
|
||||||
/** @var Egg $egg */
|
/** @var Egg $egg */
|
||||||
foreach ($records as $egg) {
|
foreach ($records as $egg) {
|
||||||
|
if ($egg->update_url === null) {
|
||||||
|
$skipped++;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
$eggImporterService->fromUrl($egg->update_url, $egg);
|
$eggImporterService->fromUrl($egg->update_url, $egg);
|
||||||
|
|
||||||
@ -67,7 +73,12 @@ class UpdateEggBulkAction extends BulkAction
|
|||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title(trans_choice('admin/egg.updated', 2, ['count' => $success, 'total' => $records->count()]))
|
->title(trans_choice('admin/egg.updated', 2, ['count' => $success, 'total' => $records->count()]))
|
||||||
->body($failed > 0 ? trans('admin/egg.updated_failed', ['count' => $failed]) : null)
|
->body(
|
||||||
|
collect([
|
||||||
|
$failed > 0 ? trans('admin/egg.updated_failed', ['count' => $failed]) : null,
|
||||||
|
$skipped > 0 ? trans('admin/egg.updated_skipped', ['count' => $skipped]) : null,
|
||||||
|
])->filter()->join(' ')
|
||||||
|
)
|
||||||
->status($failed > 0 ? 'warning' : 'success')
|
->status($failed > 0 ? 'warning' : 'success')
|
||||||
->persistent()
|
->persistent()
|
||||||
->send();
|
->send();
|
||||||
|
|||||||
@ -101,6 +101,7 @@ return [
|
|||||||
'update' => 'Update|Update selected',
|
'update' => 'Update|Update selected',
|
||||||
'updated' => 'Egg updated|:count/:total Eggs updated',
|
'updated' => 'Egg updated|:count/:total Eggs updated',
|
||||||
'updated_failed' => ':count failed',
|
'updated_failed' => ':count failed',
|
||||||
|
'updated_skipped' => ':count skipped',
|
||||||
'update_question' => 'Are you sure you want to update this egg?|Are you sure you want to update the selected eggs?',
|
'update_question' => 'Are you sure you want to update this egg?|Are you sure you want to update the selected eggs?',
|
||||||
'update_description' => 'If you made any changes to the egg they will be overwritten!|If you made any changes to the eggs they will be overwritten!',
|
'update_description' => 'If you made any changes to the egg they will be overwritten!|If you made any changes to the eggs they will be overwritten!',
|
||||||
'no_updates' => 'No updates for the selected eggs available',
|
'no_updates' => 'No updates for the selected eggs available',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user