show/hide debug logs

This commit is contained in:
Andras Bacsai 2023-07-04 12:38:22 +02:00
parent c1a0fbc66f
commit c97efda49b
2 changed files with 7 additions and 1 deletions

View File

@ -15,6 +15,7 @@ class DeploymentNavbar extends Component
protected $listeners = ['deploymentFinished']; protected $listeners = ['deploymentFinished'];
public ApplicationDeploymentQueue $application_deployment_queue; public ApplicationDeploymentQueue $application_deployment_queue;
public bool $is_debug_enabled = false;
public function deploymentFinished() public function deploymentFinished()
{ {
@ -25,6 +26,7 @@ public function show_debug()
$application = Application::find($this->application_deployment_queue->application_id); $application = Application::find($this->application_deployment_queue->application_id);
$application->settings->is_debug_enabled = !$application->settings->is_debug_enabled; $application->settings->is_debug_enabled = !$application->settings->is_debug_enabled;
$application->settings->save(); $application->settings->save();
$this->is_debug_enabled = $application->settings->is_debug_enabled;
$this->emit('refreshQueue'); $this->emit('refreshQueue');
} }
public function cancel() public function cancel()

View File

@ -1,6 +1,10 @@
<div class="flex items-center gap-2 pb-4"> <div class="flex items-center gap-2 pb-4">
<h2>Logs</h2> <h2>Logs</h2>
@if ($is_debug_enabled)
<x-forms.button wire:click.prevent="show_debug">Hide Debug Logs</x-forms.button>
@else
<x-forms.button wire:click.prevent="show_debug">Show Debug Logs</x-forms.button> <x-forms.button wire:click.prevent="show_debug">Show Debug Logs</x-forms.button>
@endif
@if (data_get($application_deployment_queue, 'status') === 'in_progress' || @if (data_get($application_deployment_queue, 'status') === 'in_progress' ||
data_get($application_deployment_queue, 'status') === 'queued') data_get($application_deployment_queue, 'status') === 'queued')
<x-forms.button wire:click.prevent="cancel">Cancel deployment</x-forms.button> <x-forms.button wire:click.prevent="cancel">Cancel deployment</x-forms.button>