fix: horizon job checker

This commit is contained in:
Andras Bacsai
2025-01-10 18:27:48 +01:00
parent a3648901ed
commit 02400added
9 changed files with 87 additions and 34 deletions

View File

@@ -14,6 +14,8 @@ class Show extends Component
public string $deployment_uuid;
public string $horizon_job_status;
public $isKeepAliveOn = true;
protected $listeners = ['refreshQueue'];
@@ -52,7 +54,9 @@ class Show extends Component
}
$this->application = $application;
$this->application_deployment_queue = $application_deployment_queue;
$this->horizon_job_status = $this->application_deployment_queue->getHorizonJobStatus();
$this->deployment_uuid = $deploymentUuid;
$this->isKeepAliveOn();
}
public function refreshQueue()
@@ -60,13 +64,21 @@ class Show extends Component
$this->application_deployment_queue->refresh();
}
private function isKeepAliveOn()
{
if (data_get($this->application_deployment_queue, 'status') === 'finished' || data_get($this->application_deployment_queue, 'status') === 'failed') {
$this->isKeepAliveOn = false;
} else {
$this->isKeepAliveOn = true;
}
}
public function polling()
{
$this->dispatch('deploymentFinished');
$this->application_deployment_queue->refresh();
if (data_get($this->application_deployment_queue, 'status') === 'finished' || data_get($this->application_deployment_queue, 'status') === 'failed') {
$this->isKeepAliveOn = false;
}
$this->horizon_job_status = $this->application_deployment_queue->getHorizonJobStatus();
$this->isKeepAliveOn();
}
public function getLogLinesProperty()

View File

@@ -84,7 +84,6 @@ class DeploymentNavbar extends Component
$this->application_deployment_queue->update([
'current_process_id' => null,
'status' => ApplicationDeploymentStatus::CANCELLED_BY_USER->value,
'horizon_job_status' => ApplicationDeploymentStatus::CANCELLED_BY_USER->value,
]);
next_after_cancel($server);
}