mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-29 15:34:44 +02:00
Fix server reinstall action (#901)
* fix server reinstall action * use reinstall service
This commit is contained in:
parent
d088e79e5e
commit
7f3b1fd758
@ -2,11 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Filament\Server\Pages;
|
namespace App\Filament\Server\Pages;
|
||||||
|
|
||||||
use App\Enums\ServerState;
|
|
||||||
use App\Facades\Activity;
|
use App\Facades\Activity;
|
||||||
use App\Models\Permission;
|
use App\Models\Permission;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use App\Repositories\Daemon\DaemonServerRepository;
|
use App\Services\Servers\ReinstallServerService;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Filament\Forms\Components\Actions\Action;
|
use Filament\Forms\Components\Actions\Action;
|
||||||
@ -200,13 +199,11 @@ class Settings extends ServerFormPage
|
|||||||
->modalHeading('Are you sure you want to reinstall the server?')
|
->modalHeading('Are you sure you want to reinstall the server?')
|
||||||
->modalDescription('Some files may be deleted or modified during this process, please back up your data before continuing.')
|
->modalDescription('Some files may be deleted or modified during this process, please back up your data before continuing.')
|
||||||
->modalSubmitActionLabel('Yes, Reinstall')
|
->modalSubmitActionLabel('Yes, Reinstall')
|
||||||
->action(function (Server $server, DaemonServerRepository $serverRepository) {
|
->action(function (Server $server, ReinstallServerService $reinstallService) {
|
||||||
abort_unless(auth()->user()->can(Permission::ACTION_SETTINGS_REINSTALL, $server), 403);
|
abort_unless(auth()->user()->can(Permission::ACTION_SETTINGS_REINSTALL, $server), 403);
|
||||||
|
|
||||||
$server->fill(['status' => ServerState::Installing])->save();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$serverRepository->reinstall();
|
$reinstallService->handle($server);
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
report($exception);
|
report($exception);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user