Merge branch 'v4-next' into patricio-deploy-proxy

This commit is contained in:
Andras Bacsai
2023-05-03 20:53:51 +02:00
45 changed files with 431 additions and 248 deletions

View File

@@ -15,7 +15,7 @@ class ByIp extends Component
public $new_private_key_value;
public string $name;
public string $description;
public string|null $description = null;
public string $ip;
public string $user = 'root';
public int $port = 22;
@@ -29,20 +29,6 @@ class ByIp extends Component
{
$this->private_key_id = $private_key_id;
}
public function addPrivateKey()
{
$this->new_private_key_value = trim($this->new_private_key_value);
if (!str_ends_with($this->new_private_key_value, "\n")) {
$this->new_private_key_value .= "\n";
}
PrivateKey::create([
'name' => $this->new_private_key_name,
'description' => $this->new_private_key_description,
'private_key' => $this->new_private_key_value,
'team_id' => session('currentTeam')->id
]);
session('currentTeam')->privateKeys = $this->private_keys = PrivateKey::where('team_id', session('currentTeam')->id)->get();
}
public function submit()
{
if (!$this->private_key_id) {

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Http\Livewire\Server;
use App\Models\PrivateKey as ModelsPrivateKey;
use App\Models\Server;
use Illuminate\Support\Facades\Route;
use Livewire\Component;
class PrivateKey extends Component
{
public $private_keys;
public $parameters;
public function setPrivateKey($private_key_id)
{
Server::where('uuid', $this->parameters['server_uuid'])->update([
'private_key_id' => $private_key_id
]);
return redirect()->route('server.show', $this->parameters['server_uuid']);
}
public function mount()
{
$this->parameters = Route::current()->parameters();
$this->private_keys = ModelsPrivateKey::where('team_id', session('currentTeam')->id)->get();
}
}