chore: Refactor terminal component and select form layout

This commit is contained in:
Andras Bacsai
2024-09-16 11:25:20 +02:00
parent f124a1e60d
commit e1a6c3e776
6 changed files with 20 additions and 13 deletions

View File

@@ -11,6 +11,7 @@ class Terminal extends Component
#[On('send-terminal-command')]
public function sendTerminalCommand($isContainer, $identifier, $serverUuid)
{
$server = Server::ownedByCurrentTeam()->whereUuid($serverUuid)->firstOrFail();
// if (auth()->user()) {
@@ -21,9 +22,7 @@ class Terminal extends Component
// }
if ($isContainer) {
ray($identifier);
$status = getContainerStatus($server, $identifier);
ray($status);
if ($status !== 'running') {
return handleError(new \Exception('Container is not running'), $this);
}

View File

@@ -7,7 +7,7 @@ use Livewire\Component;
class RunCommand extends Component
{
public $selected_uuid;
public $selected_uuid = 'default';
public $servers = [];
@@ -16,7 +16,6 @@ class RunCommand extends Component
public function mount($servers)
{
$this->servers = $servers;
$this->selected_uuid = $servers[0]->uuid;
$this->containers = $this->getAllActiveContainers();
}
@@ -83,6 +82,11 @@ class RunCommand extends Component
});
}
public function updatedSelectedUuid($value)
{
$this->connectToContainer();
}
#[On('connectToContainer')]
public function connectToContainer()
{