mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-29 17:54:45 +02:00
Fix egg export (#380)
This commit is contained in:
parent
61f3e965ba
commit
7c829fb9cf
@ -202,11 +202,13 @@ class EditEgg extends EditRecord
|
||||
Actions\DeleteAction::make()
|
||||
->disabled(fn (Egg $egg): bool => $egg->servers()->count() > 0)
|
||||
->label(fn (Egg $egg): string => $egg->servers()->count() <= 0 ? 'Delete Egg' : 'Egg In Use'),
|
||||
Actions\ExportAction::make()
|
||||
Actions\Action::make('export')
|
||||
->icon('tabler-download')
|
||||
->label('Export Egg')
|
||||
->color('primary')
|
||||
->url(fn (EggExporterService $service, Egg $egg) => $service->handle($egg->id)),
|
||||
->action(fn (EggExporterService $service, Egg $egg) => response()->streamDownload(function () use ($service, $egg) {
|
||||
echo $service->handle($egg->id);
|
||||
}, 'egg-' . $egg->getKebabName() . '.json')),
|
||||
$this->getSaveFormAction()->formId('form'),
|
||||
];
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ namespace App\Filament\Resources\EggResource\Pages;
|
||||
|
||||
use App\Filament\Resources\EggResource;
|
||||
use App\Models\Egg;
|
||||
use App\Services\Eggs\Sharing\EggExporterService;
|
||||
use App\Services\Eggs\Sharing\EggImporterService;
|
||||
use Exception;
|
||||
use Filament\Actions;
|
||||
@ -43,12 +44,13 @@ class ListEggs extends ListRecords
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\ExportAction::make()
|
||||
Tables\Actions\Action::make('export')
|
||||
->icon('tabler-download')
|
||||
->label('Export')
|
||||
->color('primary')
|
||||
// TODO uses old admin panel export service
|
||||
->url(fn (Egg $egg): string => route('admin.eggs.export', ['egg' => $egg])),
|
||||
->action(fn (EggExporterService $service, Egg $egg) => response()->streamDownload(function () use ($service, $egg) {
|
||||
echo $service->handle($egg->id);
|
||||
}, 'egg-' . $egg->getKebabName() . '.json')),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
|
Loading…
x
Reference in New Issue
Block a user