Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

Refactor getLogs method and update view template

Andras Bacsai5275ae8e9c5c
diff --git a/app/Livewire/Project/Shared/GetLogs.php b/app/Livewire/Project/Shared/GetLogs.php
index 1dc37aa0b7..5a2053fc47 100644
--- a/app/Livewire/Project/Shared/GetLogs.php
+++ b/app/Livewire/Project/Shared/GetLogs.php
@@ -71,10 +71,12 @@ class GetLogs extends Component
}
public function getLogs($refresh = false)
{
- if (str($this->container)->contains('-pr-')) {
- $this->pull_request = "Pull Request: " . str($this->container)->afterLast('-pr-')->beforeLast('_')->value();
- } else {
- $this->pull_request = 'branch';
+ if ($this->resource?->getMorphClass() === 'App\Models\Application') {
+ if (str($this->container)->contains('-pr-')) {
+ $this->pull_request = "Pull Request: " . str($this->container)->afterLast('-pr-')->beforeLast('_')->value();
+ } else {
+ $this->pull_request = 'branch';
+ }
}
if (!$refresh && ($this->resource?->getMorphClass() === 'App\Models\Service' || str($this->container)->contains('-pr-'))) return;
if ($this->container) {
diff --git a/resources/views/livewire/project/shared/get-logs.blade.php b/resources/views/livewire/project/shared/get-logs.blade.php
index cc12c19333..0cbd317b43 100644
--- a/resources/views/livewire/project/shared/get-logs.blade.php
+++ b/resources/views/livewire/project/shared/get-logs.blade.php
@@ -2,7 +2,9 @@
<div x-init="$wire.getLogs" id="screen" x-data="{ fullscreen: false, alwaysScroll: false, intervalId: null }">
<div class="flex items-center gap-2">
<h3>{{ $container }}</h3>
- <div>({{ $pull_request }})</div>
+ @if ($pull_request)
+ <div>({{ $pull_request }})</div>
+ @endif
@if ($streamLogs)
<span wire:poll.2000ms='getLogs(true)' class="loading loading-xs text-warning loading-spinner"></span>
@endif