Refactor getLogs method and update view template
This commit is contained in:
@@ -71,10 +71,12 @@ class GetLogs extends Component
|
|||||||
}
|
}
|
||||||
public function getLogs($refresh = false)
|
public function getLogs($refresh = false)
|
||||||
{
|
{
|
||||||
if (str($this->container)->contains('-pr-')) {
|
if ($this->resource?->getMorphClass() === 'App\Models\Application') {
|
||||||
$this->pull_request = "Pull Request: " . str($this->container)->afterLast('-pr-')->beforeLast('_')->value();
|
if (str($this->container)->contains('-pr-')) {
|
||||||
} else {
|
$this->pull_request = "Pull Request: " . str($this->container)->afterLast('-pr-')->beforeLast('_')->value();
|
||||||
$this->pull_request = 'branch';
|
} else {
|
||||||
|
$this->pull_request = 'branch';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!$refresh && ($this->resource?->getMorphClass() === 'App\Models\Service' || str($this->container)->contains('-pr-'))) return;
|
if (!$refresh && ($this->resource?->getMorphClass() === 'App\Models\Service' || str($this->container)->contains('-pr-'))) return;
|
||||||
if ($this->container) {
|
if ($this->container) {
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
<div x-init="$wire.getLogs" id="screen" x-data="{ fullscreen: false, alwaysScroll: false, intervalId: null }">
|
<div x-init="$wire.getLogs" id="screen" x-data="{ fullscreen: false, alwaysScroll: false, intervalId: null }">
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<h3>{{ $container }}</h3>
|
<h3>{{ $container }}</h3>
|
||||||
<div>({{ $pull_request }})</div>
|
@if ($pull_request)
|
||||||
|
<div>({{ $pull_request }})</div>
|
||||||
|
@endif
|
||||||
@if ($streamLogs)
|
@if ($streamLogs)
|
||||||
<span wire:poll.2000ms='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
|
@endif
|
||||||
|
|||||||
Reference in New Issue
Block a user