fix: proxy logs
This commit is contained in:
parent
57a39f12bb
commit
e9920f05f5
@ -70,27 +70,27 @@ class GetLogs extends Component
|
|||||||
}
|
}
|
||||||
public function getLogs($refresh = false)
|
public function getLogs($refresh = false)
|
||||||
{
|
{
|
||||||
if (!$refresh && $this->resource->getMorphClass() === 'App\Models\Service') return;
|
if (!$refresh && $this->resource?->getMorphClass() === 'App\Models\Service') return;
|
||||||
if ($this->container) {
|
if ($this->container) {
|
||||||
if ($this->showTimeStamps) {
|
if ($this->showTimeStamps) {
|
||||||
$sshCommand = generateSshCommand($this->server, "docker logs -n {$this->numberOfLines} -t {$this->container}");
|
$sshCommand = generateSshCommand($this->server, "docker logs -n {$this->numberOfLines} -t {$this->container}");
|
||||||
} else {
|
} else {
|
||||||
$sshCommand = generateSshCommand($this->server, "docker logs -n {$this->numberOfLines} {$this->container}");
|
$sshCommand = generateSshCommand($this->server, "docker logs -n {$this->numberOfLines} {$this->container}");
|
||||||
|
}
|
||||||
|
if ($refresh) {
|
||||||
|
$this->outputs = '';
|
||||||
|
}
|
||||||
|
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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($refresh) {
|
|
||||||
$this->outputs = '';
|
|
||||||
}
|
|
||||||
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()
|
public function render()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user