logs ot fixes in executeNow.
errors handled properly, etc.
This commit is contained in:
29
app/Http/Livewire/ApplicationForm.php
Normal file
29
app/Http/Livewire/ApplicationForm.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
use App\Models\Application;
|
||||
use Livewire\Component;
|
||||
|
||||
class ApplicationForm extends Component
|
||||
{
|
||||
protected Application $application;
|
||||
public string $applicationId;
|
||||
public string $name;
|
||||
public string|null $fqdn;
|
||||
public string $git_repository;
|
||||
public string $git_branch;
|
||||
public string|null $git_commit_sha;
|
||||
|
||||
public function mount() {
|
||||
$this->application = Application::find($this->applicationId);
|
||||
$this->fill([
|
||||
'name' => $this->application->name,
|
||||
'fqdn' => $this->application->fqdn,
|
||||
'git_repository' => $this->application->git_repository,
|
||||
'git_branch' => $this->application->git_branch,
|
||||
'git_commit_sha' => $this->application->git_commit_sha,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,7 +9,7 @@ use Visus\Cuid2\Cuid2;
|
||||
|
||||
class DeployApplication extends Component
|
||||
{
|
||||
public string $application_uuid;
|
||||
public string $applicationId;
|
||||
public $activity;
|
||||
public $status;
|
||||
public Application $application;
|
||||
@@ -19,10 +19,9 @@ class DeployApplication extends Component
|
||||
protected array $command = [];
|
||||
protected $source;
|
||||
|
||||
public function mount($application_uuid)
|
||||
public function mount($applicationId)
|
||||
{
|
||||
$this->application_uuid = $application_uuid;
|
||||
$this->application = Application::where('uuid', $this->application_uuid)->first();
|
||||
$this->application = Application::find($applicationId)->first();
|
||||
$this->destination = $this->application->destination->getMorphClass()::where('id', $this->application->destination->id)->first();
|
||||
}
|
||||
|
||||
@@ -39,7 +38,7 @@ class DeployApplication extends Component
|
||||
|
||||
dispatch(new DeployApplicationJob(
|
||||
deployment_uuid: $this->deployment_uuid,
|
||||
application_uuid: $this->application_uuid,
|
||||
application_uuid: $this->application->uuid,
|
||||
));
|
||||
|
||||
$currentUrl = url()->previous();
|
||||
@@ -49,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"]);
|
||||
runRemoteCommandSync($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}"]);
|
||||
runRemoteCommandSync($this->destination->server, ["docker rm -f {$this->application->uuid}"]);
|
||||
if ($this->application->status != 'exited') {
|
||||
$this->application->status = 'exited';
|
||||
$this->application->save();
|
||||
|
||||
Reference in New Issue
Block a user