diff --git a/app/Livewire/Project/Shared/GetLogs.php b/app/Livewire/Project/Shared/GetLogs.php index c0ced26ef..8fda35a4a 100644 --- a/app/Livewire/Project/Shared/GetLogs.php +++ b/app/Livewire/Project/Shared/GetLogs.php @@ -67,11 +67,6 @@ public function mount() } } - public function doSomethingWithThisChunkOfOutput($output) - { - $this->outputs .= removeAnsiColors($output); - } - public function instantSave() { if (! is_null($this->resource)) { @@ -162,20 +157,24 @@ public function getLogs($refresh = false) $sshCommand = SshMultiplexingHelper::generateSshCommand($this->server, $command); } } - if ($refresh) { - $this->outputs = ''; - } - Process::run($sshCommand, function (string $type, string $output) { - $this->doSomethingWithThisChunkOfOutput($output); + // Collect new logs into temporary variable first to prevent flickering + // (avoids clearing output before new data is ready) + $newOutputs = ''; + Process::run($sshCommand, function (string $type, string $output) use (&$newOutputs) { + $newOutputs .= removeAnsiColors($output); }); + if ($this->showTimeStamps) { - $this->outputs = str($this->outputs)->split('/\n/')->sort(function ($a, $b) { + $newOutputs = str($newOutputs)->split('/\n/')->sort(function ($a, $b) { $a = explode(' ', $a); $b = explode(' ', $b); return $a[0] <=> $b[0]; })->join("\n"); } + + // Only update outputs after new data is ready (atomic update prevents flicker) + $this->outputs = $newOutputs; } } diff --git a/resources/css/utilities.css b/resources/css/utilities.css index abb177835..7978b2d19 100644 --- a/resources/css/utilities.css +++ b/resources/css/utilities.css @@ -292,3 +292,31 @@ @utility dz-button { @utility xterm { @apply p-2; } + +/* Log line optimization - uses content-visibility for lazy rendering of off-screen log lines */ +@utility log-line { + content-visibility: auto; + contain-intrinsic-size: auto 1.5em; +} + +/* Search highlight styling for logs */ +@utility log-highlight { + @apply bg-warning/40 dark:bg-warning/30; +} + +/* Log level color classes */ +@utility log-error { + @apply bg-red-500/10 dark:bg-red-500/15; +} + +@utility log-warning { + @apply bg-yellow-500/10 dark:bg-yellow-500/15; +} + +@utility log-debug { + @apply bg-purple-500/10 dark:bg-purple-500/15; +} + +@utility log-info { + @apply bg-blue-500/10 dark:bg-blue-500/15; +} diff --git a/resources/views/livewire/project/application/deployment/show.blade.php b/resources/views/livewire/project/application/deployment/show.blade.php index 7379dbbe8..6aaf3e257 100644 --- a/resources/views/livewire/project/application/deployment/show.blade.php +++ b/resources/views/livewire/project/application/deployment/show.blade.php @@ -8,26 +8,44 @@
@@ -212,7 +240,7 @@ class="text-xs text-gray-500 dark:text-gray-400 whitespace-nowrap"> -