Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
fix: show all container ip's in list view (#2726)
Kyle Mendell5a373472e404
diff --git a/frontend/src/routes/(app)/containers/container-table.helpers.ts b/frontend/src/routes/(app)/containers/container-table.helpers.tsindex 58cfbb55a..f37e59cd4 100644--- a/frontend/src/routes/(app)/containers/container-table.helpers.ts+++ b/frontend/src/routes/(app)/containers/container-table.helpers.ts@@ -47,14 +47,21 @@ export function getStateBadgeVariant(state: string): StateBadgeVariant {return 'amber';}-export function getContainerIpAddress(container: ContainerSummaryDto): string | null {+export function getContainerIpAddresses(container: ContainerSummaryDto): string[] {const networks = container.networkSettings?.networks;- if (!networks) return null;- for (const networkName in networks) {- const network = networks[networkName];- if (network?.ipAddress) return network.ipAddress;+ if (!networks) return [];++ const seen = new Set<string>();+ const ipAddresses: string[] = [];+ for (const networkName of Object.keys(networks).sort((a, b) => a.localeCompare(b))) {+ const ipAddress = networks[networkName]?.ipAddress?.trim();+ if (!ipAddress || seen.has(ipAddress)) continue;++ seen.add(ipAddress);+ ipAddresses.push(ipAddress);}- return null;++ return ipAddresses;}export function getProjectName(container: ContainerSummaryDto): string {diff --git a/frontend/src/routes/(app)/containers/container-table.svelte b/frontend/src/routes/(app)/containers/container-table.svelteindex b28f0b4a2..271c0c59c 100644--- a/frontend/src/routes/(app)/containers/container-table.svelte+++ b/frontend/src/routes/(app)/containers/container-table.svelte@@ -34,7 +34,7 @@import {getActionStatusMessage,getContainerDisplayName,- getContainerIpAddress,+ getContainerIpAddresses,getProjectName,getStateBadgeVariant,parseImageRef,@@ -334,8 +334,28 @@<ContainerStatsSync {statsManager} envId={currentEnvId} targetIds={shouldConnect} />{#snippet IPAddressCell({ item }: { item: ContainerSummaryDto })}- {@const ip = getContainerIpAddress(item)}- <span class="font-mono text-sm">{ip ?? m.common_na()}</span>+ {@const ipAddresses = getContainerIpAddresses(item)}+ {#if ipAddresses.length > 0}+ <div class="space-y-0.5">+ {#each ipAddresses as ipAddress (ipAddress)}+ <div class="font-mono text-sm leading-tight">{ipAddress}</div>+ {/each}+ </div>+ {:else}+ <span class="font-mono text-sm">{m.common_na()}</span>+ {/if}+{/snippet}++{#snippet IPAddressesField(ipAddresses: string[])}+ {#if ipAddresses.length > 0}+ <span class="flex flex-col gap-0.5">+ {#each ipAddresses as ipAddress (ipAddress)}+ <span class="font-mono text-xs leading-tight">{ipAddress}</span>+ {/each}+ </span>+ {:else}+ <span class="font-mono text-xs">{m.common_na()}</span>+ {/if}{/snippet}{#snippet CPUCell({ item }: { item: ContainerSummaryDto })}@@ -500,10 +520,11 @@},{label: m.containers_ip_address(),- getValue: (item: ContainerSummaryDto) => getContainerIpAddress(item) ?? m.common_na(),+ getValue: (item: ContainerSummaryDto) => getContainerIpAddresses(item),icon: NetworksIcon,iconVariant: 'sky' as const,- type: 'mono' as const,+ type: 'component' as const,+ component: IPAddressesField,show: mobileFieldVisibility['ipAddress'] ?? false},{diff --git a/tests/spec/containers.spec.ts b/tests/spec/containers.spec.tsindex 62981049c..0571b3e3c 100644--- a/tests/spec/containers.spec.ts+++ b/tests/spec/containers.spec.ts@@ -11,12 +11,12 @@ async function navigateToContainers(page: Page) {let containersData: Paginated<ContainerSummary> = { data: [], pagination: { totalItems: 0 } };-test.beforeEach(async ({ page }) => {- await navigateToContainers(page);- containersData = await fetchContainersWithRetry(page);-});-test.describe('Containers Page', () => {+ test.beforeEach(async ({ page }) => {+ await navigateToContainers(page);+ containersData = await fetchContainersWithRetry(page);+ });+test('should display the containers page title and description', async ({ page }) => {await navigateToContainers(page);await expect(page.getByRole('heading', { name: 'Containers', level: 1 })).toBeVisible();@@ -150,3 +150,78 @@ test.describe('Containers Page', () => {await expect(dialog).toBeHidden();});});++test.describe('Containers Page network IP addresses', () => {+ test('should show every network IP address for a multi-network container', async ({+ page,+ context+ }) => {+ await page.addInitScript(() => {+ localStorage.removeItem('arcane-container-table');+ });++ await context.route('**/api/environments/*/containers**', async (route) => {+ if (route.request().method() !== 'GET') {+ await route.continue();+ return;+ }++ const url = new URL(route.request().url());+ if (!/^\/api\/environments\/[^/]+\/containers$/.test(url.pathname)) {+ await route.continue();+ return;+ }++ await route.fulfill({+ status: 200,+ contentType: 'application/json',+ body: JSON.stringify({+ success: true,+ data: [+ {+ id: 'wordpress-multi-network',+ names: ['/wordpress'],+ image: 'wordpress:latest',+ imageId: 'sha256:wordpress',+ command: 'apache2-foreground',+ created: 1_700_000_000,+ labels: {},+ state: 'running',+ status: 'Up 5 minutes',+ ports: [],+ hostConfig: { networkMode: 'default' },+ networkSettings: {+ networks: {+ proxy: { ipAddress: '172.20.0.10' },+ private: { ipAddress: '10.10.0.5' }+ }+ },+ mounts: []+ }+ ],+ counts: {+ runningContainers: 1,+ stoppedContainers: 0,+ totalContainers: 1+ },+ pagination: {+ totalPages: 1,+ totalItems: 1,+ currentPage: 1,+ itemsPerPage: 20,+ grandTotalItems: 1+ }+ })+ });+ });++ await navigateToContainers(page);++ const row = page.locator('tbody tr').filter({+ has: page.getByRole('link', { name: 'wordpress', exact: true })+ });++ await expect(row).toContainText('10.10.0.5');+ await expect(row).toContainText('172.20.0.10');+ });+});