This commit is contained in:
Andras Bacsai
2023-09-21 21:30:13 +02:00
parent 6b75ff7de4
commit e1a1490911
10 changed files with 139 additions and 40 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Http\Livewire\Project\Service;
use App\Actions\Service\StartService;
use App\Actions\Service\StopService;
use App\Jobs\ContainerStatusJob;
use App\Models\Service;
use Illuminate\Support\Collection;
@@ -15,7 +16,7 @@ class Index extends Component
public array $parameters;
public array $query;
public Collection $services;
protected $listeners = ['serviceStatusUpdated'];
protected $rules = [
'services.*.fqdn' => 'nullable',
];
@@ -39,11 +40,14 @@ class Index extends Component
{
return view('livewire.project.service.index')->layout('layouts.app');
}
public function serviceStatusUpdated() {
ray('serviceStatusUpdated');
$this->check_status();
}
public function check_status()
{
dispatch_sync(new ContainerStatusJob($this->service->server));
$this->service->refresh();
}
public function submit()
{
@@ -76,4 +80,8 @@ class Index extends Component
$activity = StartService::run($this->service);
$this->emit('newMonitorActivity', $activity->id);
}
public function stop() {
StopService::run($this->service);
$this->service->refresh();
}
}