use computed property
This commit is contained in:
parent
63a07e7649
commit
b0039885eb
2 changed files with 8 additions and 13 deletions
|
|
@ -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 @@ public function mount()
|
|||
$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 @@ public function polling()
|
|||
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()
|
||||
public function getLogLinesProperty()
|
||||
{
|
||||
return view('livewire.project.application.deployment.show');
|
||||
}
|
||||
|
||||
private function buildLogLines()
|
||||
{
|
||||
$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 @@ private function buildLogLines()
|
|||
return $logLine;
|
||||
});
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project.application.deployment.show');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ class="flex flex-col-reverse w-full p-2 px-4 mt-4 overflow-y-auto bg-white dark:
|
|||
</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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue