Skip to content

Commit

Permalink
Fix server reinstall action (#901)
Browse files Browse the repository at this point in the history
* fix server reinstall action

* use reinstall service
  • Loading branch information
Boy132 authored Jan 9, 2025
1 parent d088e79 commit 7f3b1fd
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions app/Filament/Server/Pages/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

namespace App\Filament\Server\Pages;

use App\Enums\ServerState;
use App\Facades\Activity;
use App\Models\Permission;
use App\Models\Server;
use App\Repositories\Daemon\DaemonServerRepository;
use App\Services\Servers\ReinstallServerService;
use Exception;
use Filament\Facades\Filament;
use Filament\Forms\Components\Actions\Action;
Expand Down Expand Up @@ -200,13 +199,11 @@ public function form(Form $form): Form
->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.')
->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);

$server->fill(['status' => ServerState::Installing])->save();

try {
$serverRepository->reinstall();
$reinstallService->handle($server);
} catch (Exception $exception) {
report($exception);

Expand Down

0 comments on commit 7f3b1fd

Please sign in to comment.