From ab5025f0a77879a620213ac759ff1231a90f9aa0 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Tue, 18 Aug 2026 09:42:36 +0200 Subject: [PATCH] fix: select Traefik networks and stabilize dropdown positioning --- bootstrap/helpers/parsers.php | 6 ++++++ resources/views/components/table/dropdown.blade.php | 13 ++++++++----- .../ApplicationParserDockerComposeDomainsTest.php | 4 ++-- tests/Feature/StandardTableComponentsTest.php | 3 +++ .../TraefikServiceDockerNetworkLabelTest.php | 4 ++-- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/bootstrap/helpers/parsers.php b/bootstrap/helpers/parsers.php index 7dd1c163c..b47e57047 100644 --- a/bootstrap/helpers/parsers.php +++ b/bootstrap/helpers/parsers.php @@ -1359,6 +1359,9 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int $redirectDirection = in_array($composeRedirect, ['www', 'non-www', 'both'], true) ? $composeRedirect : 'both'; + if (! $use_network_mode && (! $shouldGenerateLabelsExactly || $server->proxyType() === ProxyTypes::TRAEFIK->value)) { + $serviceLabels = addTraefikDockerNetworkLabel($serviceLabels, $baseNetwork->first()); + } if ($shouldGenerateLabelsExactly) { switch ($server->proxyType()) { case ProxyTypes::TRAEFIK->value: @@ -2633,6 +2636,9 @@ function serviceParser(Service $resource): Collection $redirectDirection = in_array(data_get($originalResource, 'redirect'), ['www', 'non-www', 'both'], true) ? data_get($originalResource, 'redirect') : 'both'; + if (! $use_network_mode && (! $shouldGenerateLabelsExactly || $server->proxyType() === ProxyTypes::TRAEFIK->value)) { + $serviceLabels = addTraefikDockerNetworkLabel($serviceLabels, $baseNetwork->first()); + } if ($shouldGenerateLabelsExactly) { switch ($server->proxyType()) { case ProxyTypes::TRAEFIK->value: diff --git a/resources/views/components/table/dropdown.blade.php b/resources/views/components/table/dropdown.blade.php index 6a0472191..b290128f9 100644 --- a/resources/views/components/table/dropdown.blade.php +++ b/resources/views/components/table/dropdown.blade.php @@ -6,13 +6,16 @@
diff --git a/tests/Feature/ApplicationParserDockerComposeDomainsTest.php b/tests/Feature/ApplicationParserDockerComposeDomainsTest.php index 1b3e61be0..ebcb51fe1 100644 --- a/tests/Feature/ApplicationParserDockerComposeDomainsTest.php +++ b/tests/Feature/ApplicationParserDockerComposeDomainsTest.php @@ -399,7 +399,7 @@ expect(json_decode($plainApplication->docker_compose_domains, true))->toBeNull(); }); -test('applicationParser does not force the private resource network for Traefik routed compose services', function () { +test('applicationParser selects the resource network for Traefik routed compose services', function () { $application = Application::factory()->create([ 'environment_id' => $this->environment->id, 'destination_id' => $this->destination->id, @@ -422,7 +422,7 @@ $parsedCompose = applicationParser($application); $labels = collect(data_get($parsedCompose, 'services.frontend.labels')); - expect($labels->values()->all())->not->toContain("traefik.docker.network={$application->uuid}"); + expect($labels->values()->all())->toContain("traefik.docker.network={$application->uuid}"); }); test('applicationParser preserves a user-selected Traefik network', function () { diff --git a/tests/Feature/StandardTableComponentsTest.php b/tests/Feature/StandardTableComponentsTest.php index 28f07a9a2..9741268bc 100644 --- a/tests/Feature/StandardTableComponentsTest.php +++ b/tests/Feature/StandardTableComponentsTest.php @@ -24,7 +24,10 @@ ->toContain('wire:model.live="search"') ->not->toContain('x-teleport="body"') ->not->toContain('floatingDropdown(') + ->toContain("panelStyle: 'position: fixed; min-width: 0; visibility: hidden;'") + ->toContain("this.panelStyle = 'position: fixed; min-width: 0; visibility: hidden;'") ->toContain('position: fixed') + ->toContain('min-width: 0') ->toContain('getBoundingClientRect()') ->toContain('x-show="open"') ->toContain('aria-multiselectable="true"') diff --git a/tests/Feature/TraefikServiceDockerNetworkLabelTest.php b/tests/Feature/TraefikServiceDockerNetworkLabelTest.php index f1d7087a2..c098a2e93 100644 --- a/tests/Feature/TraefikServiceDockerNetworkLabelTest.php +++ b/tests/Feature/TraefikServiceDockerNetworkLabelTest.php @@ -12,7 +12,7 @@ uses(RefreshDatabase::class); -it('does not force the private service network for Traefik routed compose services', function () { +it('selects the private service network for Traefik routed compose services', function () { Bus::fake(); $team = Team::factory()->create(); @@ -45,5 +45,5 @@ $parsedCompose = serviceParser($service); $labels = collect(data_get($parsedCompose, 'services.app.labels')); - expect($labels->values()->all())->not->toContain("traefik.docker.network={$service->uuid}"); + expect($labels->values()->all())->toContain("traefik.docker.network={$service->uuid}"); });