fix: debug log button
This commit is contained in:
parent
4fc3ada42e
commit
d757134ced
@ -5,6 +5,7 @@ namespace App\Http\Livewire\Project\Application;
|
|||||||
use App\Enums\ApplicationDeploymentStatus;
|
use App\Enums\ApplicationDeploymentStatus;
|
||||||
use App\Models\Application;
|
use App\Models\Application;
|
||||||
use App\Models\ApplicationDeploymentQueue;
|
use App\Models\ApplicationDeploymentQueue;
|
||||||
|
use App\Models\Server;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use Illuminate\Support\Facades\Process;
|
use Illuminate\Support\Facades\Process;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
@ -15,29 +16,34 @@ class DeploymentNavbar extends Component
|
|||||||
protected $listeners = ['deploymentFinished'];
|
protected $listeners = ['deploymentFinished'];
|
||||||
|
|
||||||
public ApplicationDeploymentQueue $application_deployment_queue;
|
public ApplicationDeploymentQueue $application_deployment_queue;
|
||||||
|
private Application $application;
|
||||||
|
private Server $server;
|
||||||
public bool $is_debug_enabled = false;
|
public bool $is_debug_enabled = false;
|
||||||
|
|
||||||
|
public function mount()
|
||||||
|
{
|
||||||
|
$this->application = Application::find($this->application_deployment_queue->application_id);
|
||||||
|
$this->server = $this->application->destination->server;
|
||||||
|
$this->is_debug_enabled = $this->application->settings->is_debug_enabled;
|
||||||
|
}
|
||||||
public function deploymentFinished()
|
public function deploymentFinished()
|
||||||
{
|
{
|
||||||
$this->application_deployment_queue->refresh();
|
$this->application_deployment_queue->refresh();
|
||||||
}
|
}
|
||||||
public function show_debug()
|
public function show_debug()
|
||||||
{
|
{
|
||||||
$application = Application::find($this->application_deployment_queue->application_id);
|
$this->application->settings->is_debug_enabled = !$this->application->settings->is_debug_enabled;
|
||||||
$application->settings->is_debug_enabled = !$application->settings->is_debug_enabled;
|
$this->application->settings->save();
|
||||||
$application->settings->save();
|
$this->is_debug_enabled = $this->application->settings->is_debug_enabled;
|
||||||
$this->is_debug_enabled = $application->settings->is_debug_enabled;
|
|
||||||
$this->emit('refreshQueue');
|
$this->emit('refreshQueue');
|
||||||
}
|
}
|
||||||
public function cancel()
|
public function cancel()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$kill_command = "kill -9 {$this->application_deployment_queue->current_process_id}";
|
$kill_command = "kill -9 {$this->application_deployment_queue->current_process_id}";
|
||||||
$application = Application::find($this->application_deployment_queue->application_id);
|
|
||||||
$server = $application->destination->server;
|
|
||||||
if ($this->application_deployment_queue->current_process_id) {
|
if ($this->application_deployment_queue->current_process_id) {
|
||||||
$process = Process::run("ps -p {$this->application_deployment_queue->current_process_id} -o command --no-headers");
|
$process = Process::run("ps -p {$this->application_deployment_queue->current_process_id} -o command --no-headers");
|
||||||
if (Str::of($process->output())->contains([$server->ip, 'EOF-COOLIFY-SSH'])) {
|
if (Str::of($process->output())->contains([$this->server->ip, 'EOF-COOLIFY-SSH'])) {
|
||||||
Process::run($kill_command);
|
Process::run($kill_command);
|
||||||
}
|
}
|
||||||
$previous_logs = json_decode($this->application_deployment_queue->logs, associative: true, flags: JSON_THROW_ON_ERROR);
|
$previous_logs = json_decode($this->application_deployment_queue->logs, associative: true, flags: JSON_THROW_ON_ERROR);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user