2023-03-28 20:13:08 +00:00
|
|
|
<?php
|
|
|
|
|
2023-04-25 09:01:56 +00:00
|
|
|
namespace App\Http\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'];
|
|
|
|
public function refreshQueue()
|
|
|
|
{
|
|
|
|
$this->application_deployment_queue->refresh();
|
|
|
|
}
|
2023-03-28 20:13:08 +00:00
|
|
|
public function polling()
|
|
|
|
{
|
2023-05-31 12:42:37 +00:00
|
|
|
$this->emit('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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|