From bdc0fc87f0e5ad877b064ee55b2c86b3e671a3be Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Tue, 17 Sep 2024 14:33:24 +0200 Subject: [PATCH] Fix: UI bug, do not write ssh key to disk in server dialog --- app/Livewire/Server/ShowPrivateKey.php | 15 ++++----------- .../livewire/server/show-private-key.blade.php | 3 ++- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/app/Livewire/Server/ShowPrivateKey.php b/app/Livewire/Server/ShowPrivateKey.php index d5e20702d..8e9b59157 100644 --- a/app/Livewire/Server/ShowPrivateKey.php +++ b/app/Livewire/Server/ShowPrivateKey.php @@ -18,18 +18,11 @@ class ShowPrivateKey extends Component { try { $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->update(['private_key_id' => $privateKey->id]); + $this->server->refresh(); + $this->dispatch('success', 'Private key updated successfully.'); } catch (\Exception $e) { - $this->dispatch('notify', [ - 'type' => 'error', - 'message' => 'Failed to update private key: ' . $e->getMessage(), - ]); + $this->dispatch('error', 'Failed to update private key: ' . $e->getMessage()); } } diff --git a/resources/views/livewire/server/show-private-key.blade.php b/resources/views/livewire/server/show-private-key.blade.php index 62b1c4614..86bf2568e 100644 --- a/resources/views/livewire/server/show-private-key.blade.php +++ b/resources/views/livewire/server/show-private-key.blade.php @@ -26,7 +26,8 @@

Choose another Key

@forelse ($privateKeys as $private_key) -
+
{{ $private_key->name }}
{{ $private_key->description }}