fix: terminal view loading in async

This commit is contained in:
Andras Bacsai
2024-11-12 09:52:22 +01:00
parent d7cde676d5
commit b58cc05b8a
2 changed files with 38 additions and 21 deletions

View File

@@ -14,13 +14,25 @@ class Index extends Component
public $containers = [];
public bool $isLoadingContainers = true;
public function mount()
{
if (! auth()->user()->isAdmin()) {
abort(403);
}
$this->servers = Server::isReachable()->get();
$this->containers = $this->getAllActiveContainers();
}
public function loadContainers()
{
try {
$this->containers = $this->getAllActiveContainers();
} catch (\Exception $e) {
return handleError($e, $this);
} finally {
$this->isLoadingContainers = false;
}
}
private function getAllActiveContainers()