fix: only show last 1000 lines
This commit is contained in:
parent
97027875bf
commit
3adc0bdd6e
@ -13,7 +13,7 @@ class GetLogs extends Component
|
||||
public Server $server;
|
||||
public ?string $container = null;
|
||||
public ?bool $streamLogs = false;
|
||||
|
||||
public int $numberOfLines = 1000;
|
||||
public function doSomethingWithThisChunkOfOutput($output)
|
||||
{
|
||||
$this->outputs .= $output;
|
||||
@ -24,7 +24,7 @@ public function instantSave()
|
||||
public function getLogs($refresh = false)
|
||||
{
|
||||
if ($this->container) {
|
||||
$sshCommand = generateSshCommand($this->server, "docker logs -t {$this->container}");
|
||||
$sshCommand = generateSshCommand($this->server, "docker logs -n {$this->numberOfLines} -t {$this->container}");
|
||||
if ($refresh) {
|
||||
$this->outputs = '';
|
||||
}
|
||||
|
@ -2,9 +2,14 @@
|
||||
<div class="flex gap-2">
|
||||
<h2>Logs</h2>
|
||||
@if ($streamLogs)
|
||||
<span wire:poll.1000ms='getLogs(true)' class="loading loading-xs text-warning loading-spinner"></span>
|
||||
<span wire:poll.2000ms='getLogs(true)' class="loading loading-xs text-warning loading-spinner"></span>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<form wire:submit.prevent='getLogs(true)' class="flex items-end gap-2">
|
||||
<x-forms.input label="Only Show Number of Lines" placeholder="1000" required id="numberOfLines"></x-forms.input>
|
||||
<x-forms.button type="submit">Set</x-forms.button>
|
||||
</form>
|
||||
<div class="w-32">
|
||||
<x-forms.checkbox instantSave label="Stream Logs" id="streamLogs"></x-forms.checkbox>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user