mirror of
https://github.com/ershisan99/coolify.git
synced 2025-12-16 12:33:03 +00:00
Fix: Use new function names and logic everywhere
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Livewire\Server;
|
||||
|
||||
use App\Models\Server;
|
||||
use Livewire\Component;
|
||||
use App\Models\PrivateKey;
|
||||
|
||||
class ShowPrivateKey extends Component
|
||||
{
|
||||
@@ -13,25 +14,22 @@ class ShowPrivateKey extends Component
|
||||
|
||||
public $parameters;
|
||||
|
||||
public function setPrivateKey($newPrivateKeyId)
|
||||
public function setPrivateKey($privateKeyId)
|
||||
{
|
||||
try {
|
||||
$oldPrivateKeyId = $this->server->private_key_id;
|
||||
refresh_server_connection($this->server->privateKey);
|
||||
$this->server->update([
|
||||
'private_key_id' => $newPrivateKeyId,
|
||||
$privateKey = PrivateKey::findOrFail($privateKeyId);
|
||||
$this->server->update(['private_key_id' => $privateKeyId]);
|
||||
$privateKey->storeInFileSystem();
|
||||
|
||||
$this->dispatch('notify', [
|
||||
'type' => 'success',
|
||||
'message' => 'Private key updated and stored in the file system.',
|
||||
]);
|
||||
$this->server->refresh();
|
||||
refresh_server_connection($this->server->privateKey);
|
||||
$this->checkConnection();
|
||||
} catch (\Throwable $e) {
|
||||
$this->server->update([
|
||||
'private_key_id' => $oldPrivateKeyId,
|
||||
} catch (\Exception $e) {
|
||||
$this->dispatch('notify', [
|
||||
'type' => 'error',
|
||||
'message' => 'Failed to update private key: ' . $e->getMessage(),
|
||||
]);
|
||||
$this->server->refresh();
|
||||
refresh_server_connection($this->server->privateKey);
|
||||
|
||||
return handleError($e, $this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user