Refactor for CoolifyTask.

This commit is contained in:
Joao Patricio
2023-05-03 06:15:45 +01:00
parent c3f13b54c1
commit e7763f3b73
17 changed files with 75 additions and 63 deletions

View File

@@ -48,13 +48,13 @@ class DeployApplication extends Component
public function stop()
{
runRemoteCommandSync($this->destination->server, ["docker stop -t 0 {$this->application->uuid} >/dev/null 2>&1"]);
instantRemoteProcess($this->destination->server, ["docker stop -t 0 {$this->application->uuid} >/dev/null 2>&1"]);
$this->application->status = 'stopped';
$this->application->save();
}
public function kill()
{
runRemoteCommandSync($this->destination->server, ["docker rm -f {$this->application->uuid}"]);
instantRemoteProcess($this->destination->server, ["docker rm -f {$this->application->uuid}"]);
if ($this->application->status != 'exited') {
$this->application->status = 'exited';
$this->application->save();

View File

@@ -2,6 +2,7 @@
namespace App\Http\Livewire;
use App\Enums\ActivityTypes;
use Livewire\Component;
use Spatie\Activitylog\Models\Activity;
@@ -14,7 +15,9 @@ class PollActivity extends Component
public function polling()
{
if ( is_null($this->activity) && isset($this->deployment_uuid)) {
$this->activity = Activity::where('properties->deployment_uuid', '=', $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();