2023-09-22 09:23:49 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
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 Livewire\Component;
|
|
|
|
|
|
|
|
class Navbar extends Component
|
|
|
|
{
|
|
|
|
public Service $service;
|
|
|
|
public array $parameters;
|
|
|
|
public array $query;
|
|
|
|
|
|
|
|
public function render()
|
|
|
|
{
|
|
|
|
return view('livewire.project.service.navbar');
|
|
|
|
}
|
2023-10-12 07:12:46 +00:00
|
|
|
|
|
|
|
public function checkStatus()
|
2023-09-22 09:23:49 +00:00
|
|
|
{
|
2023-10-12 07:12:46 +00:00
|
|
|
$this->emit('checkStatus');
|
2023-09-22 09:23:49 +00:00
|
|
|
}
|
|
|
|
public function deploy()
|
|
|
|
{
|
|
|
|
$this->service->parse();
|
|
|
|
$activity = StartService::run($this->service);
|
|
|
|
$this->emit('newMonitorActivity', $activity->id);
|
|
|
|
}
|
|
|
|
public function stop()
|
|
|
|
{
|
|
|
|
StopService::run($this->service);
|
|
|
|
$this->service->refresh();
|
2023-09-26 12:45:52 +00:00
|
|
|
$this->emit('success', 'Service stopped successfully.');
|
2023-10-17 08:17:03 +00:00
|
|
|
$this->checkStatus();
|
2023-09-22 09:23:49 +00:00
|
|
|
}
|
|
|
|
}
|