lasthourcloud/app/Http/Livewire/Project/Application/PollDeployment.php
Joao Patricio 85af1b4ffb Merge branch 'patricio-wip-11' into patricio-wip-11-merger
# Conflicts:
#	app/Http/Livewire/DeployApplication.php
#	app/Jobs/ContainerStatusJob.php
#	bootstrap/helpers.php
2023-05-03 06:29:05 +01:00

31 lines
892 B
PHP

<?php
namespace App\Http\Livewire\Project\Application;
use App\Enums\ActivityTypes;
use Livewire\Component;
use Spatie\Activitylog\Models\Activity;
class PollDeployment extends Component
{
public $activity;
public $isKeepAliveOn = true;
public $deployment_uuid;
public function polling()
{
if ( is_null($this->activity) && isset($this->deployment_uuid)) {
$this->activity = Activity::query()
->where('properties->type', '=', ActivityTypes::DEPLOYMENT->value)
->where('properties->type_uuid', '=', $this->deployment_uuid)
->first();
} else {
$this->activity?->refresh();
}
if (data_get($this->activity, 'properties.status') == 'finished' || data_get($this->activity, 'properties.status') == 'failed' ) {
$this->isKeepAliveOn = false;
}
}
}