Refactor getLogs method and update view template

This commit is contained in:
Andras Bacsai committed 2024-02-27 09:08:15 +01:00
1 parent c71e1e107e
commit 5275ae8e9c
2 files changed
+9 -5

No files matched your search

+6 -4
View File
@@ -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) {