feat: pull latest images for services

This commit is contained in:
Andras Bacsai
2023-12-14 14:50:38 +01:00
parent a0abde8652
commit 75d1ec4f42
5 changed files with 61 additions and 1 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Livewire\Project\Service;
use App\Actions\Shared\PullImage;
use App\Actions\Service\StartService;
use App\Actions\Service\StopService;
use App\Events\ServiceStatusChanged;
@@ -69,4 +70,18 @@ class Navbar extends Component
}
ServiceStatusChanged::dispatch();
}
public function restart()
{
$this->checkDeployments();
if ($this->isDeploymentProgress) {
$this->dispatch('error', 'There is a deployment in progress.');
return;
}
PullImage::run($this->service);
$this->dispatch('image-pulled');
StopService::run($this->service);
$this->service->parse();
$activity = StartService::run($this->service);
$this->dispatch('newMonitorActivity', $activity->id);
}
}