diff --git a/app/Http/Controllers/Admin/Servers/ServerTransferController.php b/app/Http/Controllers/Admin/Servers/ServerTransferController.php index 096217418..4fc8aa100 100644 --- a/app/Http/Controllers/Admin/Servers/ServerTransferController.php +++ b/app/Http/Controllers/Admin/Servers/ServerTransferController.php @@ -79,6 +79,25 @@ class ServerTransferController extends Controller return redirect()->route('admin.servers.view.manage', $server->id); } + /** + * Cancels the specified server's transfer. + */ + public function cancel(Request $request, Server $server): RedirectResponse + { + if (!$transfer = $server->transfer) { + $this->alert->danger(trans('admin/server.alerts.transfer_does_not_exist'))->flash(); + + return redirect()->route('admin.servers.view.manage', $server->id); + } + + $transfer->successful = true; + $transfer->save(); + + $this->alert->success(trans('admin/server.alerts.transfer_cancelled'))->flash(); + + return redirect()->route('admin.servers.view.manage', $server->id); + } + /** * Assigns the specified allocations to the specified server. */ diff --git a/resources/lang/en/admin/server.php b/resources/lang/en/admin/server.php index 29cb72d18..dfbb0bf06 100644 --- a/resources/lang/en/admin/server.php +++ b/resources/lang/en/admin/server.php @@ -22,6 +22,8 @@ return [ 'node_required' => 'You must have at least one node configured before you can add a server to this panel.', 'transfer_nodes_required' => 'You must have at least two nodes configured before you can transfer servers.', 'transfer_started' => 'Server transfer has been started.', + 'transfer_cancelled' => 'Server transfer has been cancelled.', 'transfer_not_viable' => 'The node you selected does not have the required disk space or memory available to accommodate this server.', + 'transfer_does_not_exist' => 'There is no current transfers for this server.', ], ]; diff --git a/resources/views/admin/servers/view/manage.blade.php b/resources/views/admin/servers/view/manage.blade.php index e6177a43b..72e8a0e9e 100644 --- a/resources/views/admin/servers/view/manage.blade.php +++ b/resources/views/admin/servers/view/manage.blade.php @@ -129,7 +129,11 @@
@@ -190,6 +194,36 @@ + +