fix: select Traefik networks and stabilize dropdown positioning

This commit is contained in:
Andras Bacsai 2026-08-18 09:42:36 +02:00
parent 0d23b29775
commit ab5025f0a7
5 changed files with 21 additions and 9 deletions

View file

@ -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:

View file

@ -6,13 +6,16 @@
<div class="relative" x-data="{
open: false,
panelStyle: 'display: none;',
panelStyle: 'position: fixed; min-width: 0; visibility: hidden;',
toggle() {
this.open = !this.open;
if (this.open) {
this.$nextTick(() => this.updatePosition());
this.open = false;
return;
}
this.panelStyle = 'position: fixed; min-width: 0; visibility: hidden;';
this.open = true;
this.$nextTick(() => this.updatePosition());
},
updatePosition() {
const trigger = this.$refs.trigger.getBoundingClientRect();
@ -24,7 +27,7 @@
? trigger.bottom + 4
: Math.max(viewportPadding, trigger.top - panel.height - 4);
this.panelStyle = `position: fixed; left: ${left}px; top: ${top}px;`;
this.panelStyle = `position: fixed; left: ${left}px; top: ${top}px; min-width: 0;`;
}
}" @click.outside="open = false" @keydown.escape.window="open = false"
x-on:resize.window="if (open) updatePosition()" x-on:scroll.window="if (open) updatePosition()">

View file

@ -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 () {

View file

@ -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"')

View file

@ -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}");
});