From 0be13113d1639e9d23ba87a39fca896a9bf61fa3 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Thu, 6 Aug 2026 14:29:25 +0200 Subject: [PATCH] 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. --- app/Livewire/Project/Application/General.php | 30 ----- .../Project/Application/InternalAccess.php | 41 ++++++ app/Livewire/Project/Application/Status.php | 31 +++++ .../configuration-sidebar.blade.php | 3 +- .../views/components/popup-small.blade.php | 2 - .../views/components/top-breadcrumb.blade.php | 17 +-- .../views/components/unsaved-bar.blade.php | 19 ++- .../views/livewire/global-search.blade.php | 121 +++--------------- .../project/application/general.blade.php | 61 ++------- .../application/internal-access.blade.php | 41 ++++++ .../project/application/status.blade.php | 17 +++ .../ApplicationHeadingActiveTabTest.php | 16 +++ .../ApplicationInternalAccessSectionTest.php | 18 ++- .../Feature/GlobalSearchLoadingStateTest.php | 13 ++ .../Livewire/ConfigurationCheckerTest.php | 18 ++- tests/Feature/SentinelUnsavedBarFlashTest.php | 11 ++ tests/Feature/StatusBadgeComponentsTest.php | 11 +- 17 files changed, 259 insertions(+), 211 deletions(-) create mode 100644 app/Livewire/Project/Application/InternalAccess.php create mode 100644 app/Livewire/Project/Application/Status.php create mode 100644 resources/views/livewire/project/application/internal-access.blade.php create mode 100644 resources/views/livewire/project/application/status.blade.php diff --git a/app/Livewire/Project/Application/General.php b/app/Livewire/Project/Application/General.php index 0e1a4c47e..34283cd47 100644 --- a/app/Livewire/Project/Application/General.php +++ b/app/Livewire/Project/Application/General.php @@ -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'; diff --git a/app/Livewire/Project/Application/InternalAccess.php b/app/Livewire/Project/Application/InternalAccess.php new file mode 100644 index 000000000..827cafd25 --- /dev/null +++ b/app/Livewire/Project/Application/InternalAccess.php @@ -0,0 +1,41 @@ +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'); + } +} diff --git a/app/Livewire/Project/Application/Status.php b/app/Livewire/Project/Application/Status.php new file mode 100644 index 000000000..ec17b8679 --- /dev/null +++ b/app/Livewire/Project/Application/Status.php @@ -0,0 +1,31 @@ +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'); + } +} diff --git a/resources/views/components/application/configuration-sidebar.blade.php b/resources/views/components/application/configuration-sidebar.blade.php index b480a69ea..fe70c8cdb 100644 --- a/resources/views/components/application/configuration-sidebar.blade.php +++ b/resources/views/components/application/configuration-sidebar.blade.php @@ -175,8 +175,7 @@ $pageSections = [ 'project.application.configuration' => array_values(array_filter([ ['id' => 'application-details-section', 'label' => 'Application details'], - ['id' => 'public-access-section', 'label' => 'Public access'], - $isComposeApp ? null : ['id' => 'internal-access-section', 'label' => 'Internal access'], + ['id' => 'access-section', 'label' => 'Access'], ['id' => 'build-pipeline-section', 'label' => 'Build pipeline'], $isComposeApp ? null : ['id' => 'container-image-section', 'label' => 'Container image'], $isComposeApp ? null : ['id' => 'networking-section', 'label' => 'Networking'], diff --git a/resources/views/components/popup-small.blade.php b/resources/views/components/popup-small.blade.php index 78e6e468e..3dc031eab 100644 --- a/resources/views/components/popup-small.blade.php +++ b/resources/views/components/popup-small.blade.php @@ -6,7 +6,6 @@ 'compactStoragePrefix' => null, ]) -