Fix: UI bug, do not write ssh key to disk in server dialog

This commit is contained in:
peaklabs-dev
2024-09-17 14:33:24 +02:00
parent 845d32c94c
commit bdc0fc87f0
2 changed files with 6 additions and 12 deletions

View File

@@ -18,18 +18,11 @@ class ShowPrivateKey extends Component
{ {
try { try {
$privateKey = PrivateKey::findOrFail($privateKeyId); $privateKey = PrivateKey::findOrFail($privateKeyId);
$this->server->update(['private_key_id' => $privateKeyId]); $this->server->update(['private_key_id' => $privateKey->id]);
$privateKey->storeInFileSystem(); $this->server->refresh();
$this->dispatch('success', 'Private key updated successfully.');
$this->dispatch('notify', [
'type' => 'success',
'message' => 'Private key updated and stored in the file system.',
]);
} catch (\Exception $e) { } catch (\Exception $e) {
$this->dispatch('notify', [ $this->dispatch('error', 'Failed to update private key: ' . $e->getMessage());
'type' => 'error',
'message' => 'Failed to update private key: ' . $e->getMessage(),
]);
} }
} }

View File

@@ -26,7 +26,8 @@
<h3 class="pb-4">Choose another Key</h3> <h3 class="pb-4">Choose another Key</h3>
<div class="grid grid-cols-3 gap-2"> <div class="grid grid-cols-3 gap-2">
@forelse ($privateKeys as $private_key) @forelse ($privateKeys as $private_key)
<div class="box group" wire:click='setPrivateKey({{ $private_key->id }})'> <div class="box group cursor-pointer"
wire:click='setPrivateKey({{ $private_key->id }})'>
<div class="flex flex-col "> <div class="flex flex-col ">
<div class="box-title">{{ $private_key->name }}</div> <div class="box-title">{{ $private_key->name }}</div>
<div class="box-description">{{ $private_key->description }}</div> <div class="box-description">{{ $private_key->description }}</div>