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.

use computed property

mahanskyb0039885eb12
diff --git a/app/Livewire/Project/Application/Deployment/Show.php b/app/Livewire/Project/Application/Deployment/Show.php
index 4b29045946..f2968f6d92 100644
--- a/app/Livewire/Project/Application/Deployment/Show.php
+++ b/app/Livewire/Project/Application/Deployment/Show.php
@@ -13,8 +13,6 @@ class Show extends Component
public ApplicationDeploymentQueue $application_deployment_queue;
- public Collection $logLines;
-
public string $deployment_uuid;
public $isKeepAliveOn = true;
@@ -56,13 +54,11 @@ class Show extends Component
$this->application = $application;
$this->application_deployment_queue = $application_deployment_queue;
$this->deployment_uuid = $deploymentUuid;
- $this->buildLogLines();
}
public function refreshQueue()
{
$this->application_deployment_queue->refresh();
- $this->buildLogLines();
}
public function polling()
@@ -72,17 +68,11 @@ class Show extends Component
if (data_get($this->application_deployment_queue, 'status') == 'finished' || data_get($this->application_deployment_queue, 'status') == 'failed') {
$this->isKeepAliveOn = false;
}
- $this->buildLogLines();
- }
-
- public function render()
- {
- return view('livewire.project.application.deployment.show');
}
- private function buildLogLines()
+ public function getLogLinesProperty()
{
- $this->logLines = decode_remote_command_output($this->application_deployment_queue)->map(function ($logLine) {
+ return decode_remote_command_output($this->application_deployment_queue)->map(function ($logLine) {
$logLine['line'] = e($logLine['line']);
$logLine['line'] = preg_replace(
'/(https?:\/\/[^\s]+)/',
@@ -93,4 +83,9 @@ class Show extends Component
return $logLine;
});
}
+
+ public function render()
+ {
+ return view('livewire.project.application.deployment.show');
+ }
}
diff --git a/resources/views/livewire/project/application/deployment/show.blade.php b/resources/views/livewire/project/application/deployment/show.blade.php
index bc8ab3f34f..5ba0be0a28 100644
--- a/resources/views/livewire/project/application/deployment/show.blade.php
+++ b/resources/views/livewire/project/application/deployment/show.blade.php
@@ -93,7 +93,7 @@
</div>
<div id="logs" class="flex flex-col font-mono">
- @forelse ($logLines as $line)
+ @forelse ($this->logLines as $line)
<div
@class([
'mt-2' => $line['command'] ?? false,