From bdd4a2456777719207f50544ae290695ff4ff3a3 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 15 May 2023 14:54:03 +0200 Subject: [PATCH] fixes --- app/Http/Livewire/PrivateKey/Create.php | 7 +--- app/Http/Livewire/Server/New/ByIp.php | 1 - bootstrap/helpers.php | 2 +- .../views/components/magic-bar.blade.php | 37 ++++++++++--------- .../views/livewire/server/form.blade.php | 1 - .../views/livewire/server/new/by-ip.blade.php | 15 +++----- resources/views/server/new.blade.php | 8 +++- routes/web.php | 4 +- 8 files changed, 38 insertions(+), 37 deletions(-) diff --git a/app/Http/Livewire/PrivateKey/Create.php b/app/Http/Livewire/PrivateKey/Create.php index 5ae62c8f7..9dfd6b40c 100644 --- a/app/Http/Livewire/PrivateKey/Create.php +++ b/app/Http/Livewire/PrivateKey/Create.php @@ -9,7 +9,7 @@ class Create extends Component { public string $name; - public string|null $description; + public string|null $description = null; public string $value; public string $currentRoute; @@ -29,9 +29,6 @@ public function createPrivateKey() 'private_key' => $this->value, 'team_id' => session('currentTeam')->id ]); - session('currentTeam')->privateKeys = PrivateKey::where('team_id', session('currentTeam')->id)->get(); - if ($this->currentRoute !== 'server/new') { - redirect()->route('private-key.show', $new_private_key->uuid); - } + redirect()->route('server.new'); } } diff --git a/app/Http/Livewire/Server/New/ByIp.php b/app/Http/Livewire/Server/New/ByIp.php index 4f079c7ba..de2223d6a 100644 --- a/app/Http/Livewire/Server/New/ByIp.php +++ b/app/Http/Livewire/Server/New/ByIp.php @@ -29,7 +29,6 @@ class ByIp extends Component public function mount() { $this->name = generateRandomName(); - $this->private_keys = PrivateKey::where('team_id', session('currentTeam')->id)->get(); } public function setPrivateKey(string $private_key_id) { diff --git a/bootstrap/helpers.php b/bootstrap/helpers.php index 085604cd5..1040bac8c 100644 --- a/bootstrap/helpers.php +++ b/bootstrap/helpers.php @@ -33,7 +33,7 @@ function generalErrorHandler(\Throwable $e, $that = null, $isJson = false) } } catch (\Throwable $error) { if ($that) { - $that->emit('error', $error); + $that->emit('error', $error->getMessage()); } elseif ($isJson) { return response()->json([ 'code' => $error->getCode(), diff --git a/resources/views/components/magic-bar.blade.php b/resources/views/components/magic-bar.blade.php index e1a78095a..12fa02648 100644 --- a/resources/views/components/magic-bar.blade.php +++ b/resources/views/components/magic-bar.blade.php @@ -13,7 +13,9 @@