diff --git a/app/Http/Livewire/Project/Shared/GetLogs.php b/app/Http/Livewire/Project/Shared/GetLogs.php index e82f20497..b693793cf 100644 --- a/app/Http/Livewire/Project/Shared/GetLogs.php +++ b/app/Http/Livewire/Project/Shared/GetLogs.php @@ -33,11 +33,16 @@ class GetLogs extends Component if ($refresh) { $this->outputs = ''; } - $command = Process::run($sshCommand); - $output = $command->output(); - $error = $command->errorOutput(); - $this->doSomethingWithThisChunkOfOutput($output); - $this->doSomethingWithThisChunkOfOutput($error); + Process::run($sshCommand, function (string $type, string $output) { + $this->doSomethingWithThisChunkOfOutput($output); + }); + if ($this->showTimeStamps) { + $this->outputs = str($this->outputs)->split('/\n/')->sort(function ($a, $b) { + $a = explode(' ', $a); + $b = explode(' ', $b); + return $a[0] <=> $b[0]; + })->join("\n"); + } } } public function render() diff --git a/resources/views/livewire/project/shared/get-logs.blade.php b/resources/views/livewire/project/shared/get-logs.blade.php index 16b2853cf..8913dd546 100644 --- a/resources/views/livewire/project/shared/get-logs.blade.php +++ b/resources/views/livewire/project/shared/get-logs.blade.php @@ -13,17 +13,28 @@ Refresh -
+
-
+