lasthourcloud/app/Http/Livewire/Server/Proxy/Status.php
Andras Bacsai 67078fdc71 wip: services
feat: able to map port<->domain
2023-09-22 14:47:25 +02:00

35 lines
815 B
PHP

<?php
namespace App\Http\Livewire\Server\Proxy;
use App\Jobs\ContainerStatusJob;
use App\Models\Server;
use Livewire\Component;
class Status extends Component
{
public Server $server;
protected $listeners = ['proxyStatusUpdated'];
public function proxyStatusUpdated()
{
$this->server->refresh();
}
public function getProxyStatus()
{
try {
if ($this->server->isFunctional()) {
dispatch_sync(new ContainerStatusJob($this->server));
$this->emit('proxyStatusUpdated');
}
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
public function getProxyStatusWithNoti()
{
$this->emit('success', 'Refreshed proxy status.');
$this->getProxyStatus();
}
}