2023-03-28 20:13:08 +00:00
|
|
|
<?php
|
|
|
|
|
2023-12-07 18:06:32 +00:00
|
|
|
namespace App\Livewire\Project\Application;
|
2023-03-28 20:13:08 +00:00
|
|
|
|
2023-06-30 13:57:40 +00:00
|
|
|
use App\Models\ApplicationDeploymentQueue;
|
2023-03-28 20:13:08 +00:00
|
|
|
use Livewire\Component;
|
|
|
|
|
2023-05-24 12:26:50 +00:00
|
|
|
class DeploymentLogs extends Component
|
2023-03-28 20:13:08 +00:00
|
|
|
{
|
2023-06-30 13:57:40 +00:00
|
|
|
public ApplicationDeploymentQueue $application_deployment_queue;
|
2023-03-28 20:13:08 +00:00
|
|
|
public $isKeepAliveOn = true;
|
2023-06-30 13:57:40 +00:00
|
|
|
protected $listeners = ['refreshQueue'];
|
2023-08-08 09:51:36 +00:00
|
|
|
|
2023-06-30 13:57:40 +00:00
|
|
|
public function refreshQueue()
|
|
|
|
{
|
|
|
|
$this->application_deployment_queue->refresh();
|
|
|
|
}
|
2023-08-08 09:51:36 +00:00
|
|
|
|
2023-03-28 20:13:08 +00:00
|
|
|
public function polling()
|
|
|
|
{
|
2023-12-07 18:06:32 +00:00
|
|
|
$this->dispatch('deploymentFinished');
|
2023-06-30 13:57:40 +00:00
|
|
|
$this->application_deployment_queue->refresh();
|
|
|
|
if (data_get($this->application_deployment_queue, 'status') == 'finished' || data_get($this->application_deployment_queue, 'status') == 'failed') {
|
2023-03-28 20:13:08 +00:00
|
|
|
$this->isKeepAliveOn = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|