Skip to content

Modern Docker Management, Designed for Everyone

chore: update helpers from merge

Kyle Mendelldfda2ce95eed
diff --git a/frontend/src/lib/utils/docker.ts b/frontend/src/lib/utils/docker.ts
index 17249145a..661493e3e 100644
--- a/frontend/src/lib/utils/docker.ts
+++ b/frontend/src/lib/utils/docker.ts
@@ -1,6 +1,6 @@
import { PersistedState } from 'runed';
import { m } from '$lib/paraglide/messages';
-import type { ContainerStats } from '$lib/types/docker';
+import type { ContainerStats, ContainerSummaryDto } from '$lib/types/docker';
import type { Environment, EnvironmentStatus } from '$lib/types/environment';
import type { SearchPaginationSortRequest } from '$lib/types/shared';
import type { ProjectUpdateInfo } from '$lib/types/swarm';
@@ -43,6 +43,23 @@ export function calculateMemoryUsage(stats: ContainerStats | null): number {
return Math.max(usage - inactiveFile, 0);
}
+export function getContainerIpAddresses(container: ContainerSummaryDto): string[] {
+ const networks = container.networkSettings?.networks;
+ 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 ipAddresses;
+}
+
// --- Swarm service mode helpers ---
export type SwarmServiceModeBadgeVariant = 'green' | 'blue' | 'amber' | 'purple' | 'gray';
diff --git a/frontend/src/routes/(app)/containers/container-table.helpers.ts b/frontend/src/routes/(app)/containers/container-table.helpers.ts
index d651a2838..e550c4c2e 100644
--- a/frontend/src/routes/(app)/containers/container-table.helpers.ts
+++ b/frontend/src/routes/(app)/containers/container-table.helpers.ts
@@ -47,23 +47,6 @@ export function getStateBadgeVariant(state: string): StateBadgeVariant {
return 'amber';
}
-export function getContainerIpAddresses(container: ContainerSummaryDto): string[] {
- const networks = container.networkSettings?.networks;
- 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 ipAddresses;
-}
-
export function getProjectName(container: ContainerSummaryDto): string {
const projectLabel = container.labels?.['com.docker.compose.project'];
return projectLabel || 'No Project';
diff --git a/frontend/src/routes/(app)/containers/container-table.svelte b/frontend/src/routes/(app)/containers/container-table.svelte
index 9e7a17a9f..5abd82330 100644
--- a/frontend/src/routes/(app)/containers/container-table.svelte
+++ b/frontend/src/routes/(app)/containers/container-table.svelte
@@ -28,12 +28,11 @@
import { environmentStore } from '$lib/stores/environment.store.svelte';
import { hasPermission } from '$lib/utils/auth';
import IconImage from '$lib/components/icon-image.svelte';
- import { getArcaneIconUrlFromLabels } from '$lib/utils/docker';
+ import { getArcaneIconUrlFromLabels, getContainerIpAddresses } from '$lib/utils/docker';
import { createContainerActions } from './container-table.actions';
import {
getActionStatusMessage,
getContainerDisplayName,
- getContainerIpAddresses,
getProjectName,
getStateBadgeVariant,
parseImageRef,