Fix egg export/import

This commit is contained in:
notCharles 2025-08-06 17:08:58 -04:00
parent 2f22b5807e
commit 1212b3bd34
2 changed files with 4 additions and 6 deletions

View File

@ -38,19 +38,17 @@ class ExportEggAction extends Action
$this->modalFooterActionsAlignment(Alignment::Center);
$this->modalFooterActions([
$this->modalFooterActions([ //TODO: Close modal after clicking ->close() does not allow action to preform before closing modal
Action::make('json')
->label(trans('admin/egg.export.as') . ' .json')
->action(fn (EggExporterService $service, Egg $egg) => response()->streamDownload(function () use ($service, $egg) {
echo $service->handle($egg->id, EggFormat::JSON);
}, 'egg-' . $egg->getKebabName() . '.json'))
->close(),
}, 'egg-' . $egg->getKebabName() . '.json')),
Action::make('yaml')
->label(trans('admin/egg.export.as') . ' .yaml')
->action(fn (EggExporterService $service, Egg $egg) => response()->streamDownload(function () use ($service, $egg) {
echo $service->handle($egg->id, EggFormat::YAML);
}, 'egg-' . $egg->getKebabName() . '.yaml'))
->close(),
}, 'egg-' . $egg->getKebabName() . '.yaml')),
]);
}
}

View File

@ -161,7 +161,7 @@ class ImportEggAction extends Action
->deletable(fn (array $state) => count($state) > 1)
->schema([
TextInput::make('url')
->default(fn (Egg $egg) => $egg->update_url)
->default(fn (?Egg $egg) => $egg->update_url ?? '')
->live()
->label(trans('admin/egg.import.url'))
->placeholder('https://github.com/pelican-eggs/generic/blob/main/nodejs/egg-node-js-generic.json')