coolify/app/Http/Livewire/PollActivity.php

32 lines
826 B
PHP
Raw Normal View History

<?php
namespace App\Http\Livewire;
use Livewire\Component;
2023-03-31 13:32:07 +02:00
use Spatie\Activitylog\Models\Activity;
class PollActivity extends Component
{
public $activity;
public $isKeepAliveOn = true;
2023-03-31 13:32:07 +02:00
public $deployment_uuid;
public function polling()
{
2023-03-31 13:32:07 +02:00
if ( is_null($this->activity) && isset($this->deployment_uuid)) {
$this->activity = Activity::where('properties->deployment_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;
}
}
public function render()
{
return view('livewire.poll-activity');
}
}