mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-17 17:21:04 +00:00
feat(deployments): add log copying functionality to clipboard in dev
This commit is contained in:
@@ -50,6 +50,28 @@ class DeploymentNavbar extends Component
|
||||
}
|
||||
}
|
||||
|
||||
public function copyLogsToClipboard(): string
|
||||
{
|
||||
$logs = json_decode($this->application_deployment_queue->logs, associative: true, flags: JSON_THROW_ON_ERROR);
|
||||
|
||||
if (! $logs) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$markdown = "# Deployment Logs\n\n";
|
||||
$markdown .= "```\n";
|
||||
|
||||
foreach ($logs as $log) {
|
||||
if (isset($log['output'])) {
|
||||
$markdown .= $log['output']."\n";
|
||||
}
|
||||
}
|
||||
|
||||
$markdown .= "```\n";
|
||||
|
||||
return $markdown;
|
||||
}
|
||||
|
||||
public function cancel()
|
||||
{
|
||||
$deployment_uuid = $this->application_deployment_queue->deployment_uuid;
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
@else
|
||||
<x-forms.button wire:click.prevent="show_debug">Show Debug Logs</x-forms.button>
|
||||
@endif
|
||||
@if (isDev())
|
||||
<x-forms.button x-on:click="$wire.copyLogsToClipboard().then(text => navigator.clipboard.writeText(text))">Copy Logs</x-forms.button>
|
||||
@endif
|
||||
@if (data_get($application_deployment_queue, 'status') === 'queued')
|
||||
<x-forms.button wire:click.prevent="force_start">Force Start</x-forms.button>
|
||||
@endif
|
||||
|
||||
Reference in New Issue
Block a user