fix: container logs are now followable in full-screen and sorted by timestamp

This commit is contained in:
Andras Bacsai
2023-11-06 13:53:05 +01:00
parent 143e4e0d23
commit 66287b43d0
2 changed files with 60 additions and 11 deletions

View File

@@ -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()