refactor(application): extract status and internal access components

Move internal hostname loading and breadcrumb status into dedicated
Livewire components with live refresh. Merge public/internal access
into one Access section, bind Enter to save on the unsaved bar, and
drop x-teleport wrappers from popup and global search.
This commit is contained in:
Andras Bacsai committed 2026-08-06 14:29:25 +02:00
1 parent a6ab360ac2
commit 0be13113d1
17 files changed
+259 -211

No files matched your search

@@ -55,10 +55,6 @@ class General extends Component
public ?string $customNetworkAliases = null;
public ?string $currentInternalHostname = null;
public bool $currentInternalHostnameLoaded = false;
public ?string $dockerfile = null;
public ?string $dockerfileLocation = null;
@@ -452,32 +448,6 @@ class General extends Component
}
}
public function loadCurrentInternalHostname(): void
{
if ($this->application->build_pack === 'dockercompose') {
$this->currentInternalHostnameLoaded = true;
return;
}
try {
$containers = getCurrentApplicationContainerStatus(
$this->application->destination->server,
$this->application->id,
0
);
$currentContainer = $containers->first(
fn ($container) => data_get($container, 'State') === 'running'
) ?? $containers->first();
$this->currentInternalHostname = data_get($currentContainer, 'Names');
} catch (\Throwable) {
$this->currentInternalHostname = null;
} finally {
$this->currentInternalHostnameLoaded = true;
}
}
public function setSiteType(): void
{
$this->isStatic = $this->siteType !== 'dynamic';
@@ -0,0 +1,41 @@
<?php
namespace App\Livewire\Project\Application;
use App\Models\Application;
use Illuminate\Contracts\View\View;
use Livewire\Component;
class InternalAccess extends Component
{
public Application $application;
public ?string $currentInternalHostname = null;
public bool $currentInternalHostnameLoaded = false;
public function loadCurrentInternalHostname(): void
{
try {
$containers = getCurrentApplicationContainerStatus(
$this->application->destination->server,
$this->application->id,
0
);
$currentContainer = $containers->first(
fn ($container) => data_get($container, 'State') === 'running'
) ?? $containers->first();
$this->currentInternalHostname = data_get($currentContainer, 'Names');
} catch (\Throwable) {
$this->currentInternalHostname = null;
} finally {
$this->currentInternalHostnameLoaded = true;
}
}
public function render(): View
{
return view('livewire.project.application.internal-access');
}
}
@@ -0,0 +1,31 @@
<?php
namespace App\Livewire\Project\Application;
use App\Models\Application;
use Illuminate\Contracts\View\View;
use Livewire\Component;
class Status extends Component
{
public Application $application;
public function getListeners(): array
{
$teamId = auth()->user()->currentTeam()->id;
return [
"echo-private:team.{$teamId},ServiceStatusChanged" => 'refreshStatus',
];
}
public function refreshStatus(): void
{
$this->application->refresh();
}
public function render(): View
{
return view('livewire.project.application.status');
}
}