Skip to content

Modern Docker Management, Designed for Everyone

feat: network inspection page (#76)

Kyle Mendell89451f915bfa
diff --git a/src/lib/components/badges/name-cell.svelte b/src/lib/components/badges/name-cell.svelte
new file mode 100644
index 000000000..26aeda6e9
--- /dev/null
+++ b/src/lib/components/badges/name-cell.svelte
@@ -0,0 +1,20 @@
+<script lang="ts">
+ interface Props {
+ name: string;
+ link?: string;
+ }
+
+ let { name, link }: Props = $props();
+</script>
+
+<div class="flex items-center gap-2">
+ {#if link}
+ <span class="truncate">
+ <a class="font-medium hover:underline" href={link}>
+ {name}
+ </a>
+ </span>
+ {:else}
+ <span class="truncate">{name}</span>
+ {/if}
+</div>
diff --git a/src/lib/components/badges/unused-text-badge.svelte b/src/lib/components/badges/unused-text-badge.svelte
index 7c414ff67..049f70670 100644
--- a/src/lib/components/badges/unused-text-badge.svelte
+++ b/src/lib/components/badges/unused-text-badge.svelte
@@ -1,5 +1,6 @@
<script lang="ts">
import StatusBadge from './status-badge.svelte';
+ import NameCell from './name-cell.svelte';
interface Props {
name: string;
@@ -11,15 +12,7 @@
</script>
<div class="flex items-center gap-2">
- {#if link}
- <span class="truncate">
- <a class="font-medium hover:underline" href={link}>
- {name}
- </a>
- </span>
- {:else}
- <span class="truncate">{name}</span>
- {/if}
+ <NameCell {name} {link} />
{#if !inUse}
<StatusBadge text="Unused" variant="amber" />
{/if}
diff --git a/src/lib/services/docker/network-service.ts b/src/lib/services/docker/network-service.ts
index afbba9388..ef31ec16f 100644
--- a/src/lib/services/docker/network-service.ts
+++ b/src/lib/services/docker/network-service.ts
@@ -1,6 +1,7 @@
import { getDockerClient, dockerHost } from '$lib/services/docker/core';
import type { ServiceNetwork } from '$lib/types/docker/network.type';
import type { NetworkInspectInfo, NetworkCreateOptions } from 'dockerode';
+import { NotFoundError, ConflictError, DockerApiError } from '$lib/types/errors'; // #file:/Users/kylemendell/dev/ofkm/arcane/src/lib/types/errors.ts
/* The line `const DEFAULT_NETWORK_NAMES = new Set(['host', 'bridge', 'none', 'ingress']);` is creating
a Set named `DEFAULT_NETWORK_NAMES` that contains the default network names managed by Docker. These
@@ -38,17 +39,47 @@ export async function listNetworks(): Promise<ServiceNetwork[]> {
}
}
+/**
+ * Retrieves detailed information about a specific Docker network by its ID.
+ * @param {string} networkId - The ID or name of the network to inspect.
+ * @returns {Promise<NetworkInspectInfo>} A promise that resolves with the detailed network information.
+ * @throws {NotFoundError} If the network with the specified ID does not exist.
+ * @throws {DockerApiError} For other errors during the Docker API interaction.
+ */
+export async function getNetwork(networkId: string): Promise<NetworkInspectInfo> {
+ try {
+ const docker = getDockerClient();
+ const network = docker.getNetwork(networkId);
+ const inspectInfo = await network.inspect();
+ console.log(`Docker Service: Inspected network "${networkId}" successfully.`);
+ return inspectInfo;
+ } catch (error: any) {
+ console.error(`Docker Service: Error inspecting network "${networkId}":`, error);
+ if (error.statusCode === 404) {
+ throw new NotFoundError(`Network "${networkId}" not found.`);
+ }
+ // Docker might return 500 for built-in networks if trying to inspect by name sometimes
+ if (error.statusCode === 500 && (networkId === 'bridge' || networkId === 'host' || networkId === 'none')) {
+ throw new NotFoundError(`Cannot inspect built-in network "${networkId}" by name, use ID if available.`);
+ }
+ throw new DockerApiError(`Failed to inspect network "${networkId}": ${error.message || 'Unknown Docker error'}`, error.statusCode);
+ }
+}
+
/**
* The function `removeNetwork` removes a Docker network, handling default networks and error cases.
* @param {string} networkId - The `networkId` parameter in the `removeNetwork` function is a string
* that represents the ID of the Docker network that you want to remove. This function checks if the
* specified network is one of the default networks managed by Docker (`host`, `bridge`, `none`,
* `ingress`). If
+ * @throws {NotFoundError} If the network does not exist.
+ * @throws {ConflictError} If the network is in use (e.g., by containers).
+ * @throws {DockerApiError} For other Docker API errors.
*/
export async function removeNetwork(networkId: string): Promise<void> {
try {
if (DEFAULT_NETWORK_NAMES.has(networkId)) {
- throw new Error(`Network "${networkId}" is managed by Docker and cannot be removed.`);
+ throw new ConflictError(`Network "${networkId}" is managed by Docker and cannot be removed.`);
}
const docker = getDockerClient();
const network = docker.getNetwork(networkId);
@@ -57,13 +88,17 @@ export async function removeNetwork(networkId: string): Promise<void> {
} catch (error: any) {
console.error(`Docker Service: Error removing network "${networkId}":`, error);
if (error.statusCode === 404) {
- throw new Error(`Network "${networkId}" not found.`);
+ throw new NotFoundError(`Network "${networkId}" not found.`);
}
- if (error.statusCode === 409) {
- // 409 Conflict usually means it's in use or predefined
- throw new Error(`Network "${networkId}" cannot be removed (possibly in use or predefined).`);
+ if (error.statusCode === 409 || (error.reason && error.reason.includes('active endpoints'))) {
+ // 409 or specific reason indicates it's likely in use
+ throw new ConflictError(`Network "${networkId}" has active endpoints (containers connected). Disconnect containers before removal.`);
+ }
+ // Handle removal of predefined networks (usually forbidden)
+ if (error.statusCode === 403 || (error.reason && error.reason.includes('predefined network'))) {
+ throw new ConflictError(`Cannot remove predefined network "${networkId}".`);
}
- throw new Error(`Failed to remove network "${networkId}" using host "${dockerHost}". ${error.message || error.reason || ''}`);
+ throw new DockerApiError(`Failed to remove network "${networkId}": ${error.message || error.reason || 'Unknown Docker error'}`, error.statusCode);
}
}
diff --git a/src/routes/networks/[networkId]/+page.server.ts b/src/routes/networks/[networkId]/+page.server.ts
new file mode 100644
index 000000000..3eebe49c4
--- /dev/null
+++ b/src/routes/networks/[networkId]/+page.server.ts
@@ -0,0 +1,46 @@
+import type { PageServerLoad, Actions } from './$types';
+import { getNetwork, removeNetwork } from '$lib/services/docker/network-service'; // #file:/Users/kylemendell/dev/ofkm/arcane/src/lib/services/docker/network-service.ts
+import { error, fail, redirect } from '@sveltejs/kit';
+import { NotFoundError, ConflictError, DockerApiError } from '$lib/types/errors'; // #file:/Users/kylemendell/dev/ofkm/arcane/src/lib/types/errors.ts
+
+export const load: PageServerLoad = async ({ params }) => {
+ const networkId = params.networkId;
+
+ try {
+ const network = await getNetwork(networkId);
+
+ // Note: NetworkInspectInfo contains container info directly in network.Containers
+ return {
+ network
+ };
+ } catch (err: any) {
+ console.error(`Failed to load network ${networkId}:`, err);
+ if (err instanceof NotFoundError) {
+ error(404, { message: err.message });
+ } else {
+ error(err.status || 500, {
+ message: err.message || `Failed to load network details for "${networkId}".`
+ });
+ }
+ }
+};
+
+// Add action for removing the network from its details page
+export const actions: Actions = {
+ remove: async ({ params }) => {
+ const networkId = params.networkId;
+ try {
+ await removeNetwork(networkId);
+ // Redirect back to the main networks list after successful removal
+ redirect(303, '/networks');
+ } catch (err: any) {
+ console.error(`Failed to remove network ${networkId}:`, err);
+ // Handle specific errors from removeNetwork
+ if (err instanceof NotFoundError || err instanceof ConflictError || err instanceof DockerApiError) {
+ return fail(err.status || 500, { error: err.message });
+ }
+ // Fallback for unexpected errors
+ return fail(500, { error: err.message || 'An unexpected error occurred during removal.' });
+ }
+ }
+};
diff --git a/src/routes/networks/[networkId]/+page.svelte b/src/routes/networks/[networkId]/+page.svelte
new file mode 100644
index 000000000..e8564d584
--- /dev/null
+++ b/src/routes/networks/[networkId]/+page.svelte
@@ -0,0 +1,349 @@
+<script lang="ts">
+ import type { PageData, ActionData } from './$types';
+ import * as Card from '$lib/components/ui/card/index.js';
+ import { Button } from '$lib/components/ui/button/index.js';
+ import { ArrowLeft, AlertCircle, RefreshCw, HardDrive, Clock, Tag, Layers, Hash, Trash2, Loader2, Network, Globe, Settings, ListTree, Container } from '@lucide/svelte';
+ import * as Breadcrumb from '$lib/components/ui/breadcrumb/index.js';
+ import { enhance } from '$app/forms';
+ import { invalidateAll } from '$app/navigation';
+ import * as Alert from '$lib/components/ui/alert/index.js';
+ import { Separator } from '$lib/components/ui/separator/index.js';
+ import { Badge } from '$lib/components/ui/badge/index.js';
+ import { formatDate } from '$lib/utils'; // #file:/Users/kylemendell/dev/ofkm/arcane/src/lib/utils.ts
+ import ConfirmDialog from '$lib/components/confirm-dialog.svelte'; // #file:/Users/kylemendell/dev/ofkm/arcane/src/lib/components/confirm-dialog.svelte
+ import type { NetworkInspectInfo } from 'dockerode';
+
+ let { data, form }: { data: PageData; form: ActionData } = $props();
+ let { network }: { network: NetworkInspectInfo | null | undefined } = $derived(data);
+
+ let isRefreshing = $state(false);
+ let isRemoving = $state(false);
+ let showRemoveConfirm = $state(false);
+
+ const shortId = $derived(network?.Id?.substring(0, 12) || 'N/A');
+ const createdDate = $derived(network?.Created ? formatDate(network.Created) : 'N/A');
+ const connectedContainers = $derived(network?.Containers ? Object.values(network.Containers) : []);
+ // Determine if network is potentially in use (basic check)
+ const inUse = $derived(connectedContainers.length > 0);
+ // Determine if network is predefined (cannot be removed)
+ const isPredefined = $derived(network?.Name === 'bridge' || network?.Name === 'host' || network?.Name === 'none');
+
+ async function refreshData() {
+ isRefreshing = true;
+ try {
+ await invalidateAll();
+ } finally {
+ isRefreshing = false;
+ }
+ }
+
+ function triggerRemove() {
+ if (isPredefined) {
+ // Optionally show a toast or alert instead of the dialog
+ console.warn('Cannot remove predefined network');
+ return;
+ }
+ showRemoveConfirm = true;
+ }
+
+ // This function is called by the ConfirmDialog
+ function handleRemoveConfirm() {
+ // No 'force' option for network removal in standard Docker API
+ const removeForm = document.getElementById('remove-network-form') as HTMLFormElement;
+ if (removeForm) {
+ removeForm.submit();
+ }
+ }
+</script>
+
+<!-- Confirmation Dialog for Remove -->
+<ConfirmDialog bind:open={showRemoveConfirm} title="Confirm Network Removal" description={`Are you sure you want to remove network "${network?.Name}" (${shortId})? This action cannot be undone. Ensure no containers are connected.`} confirmLabel="Remove" variant="destructive" onConfirm={handleRemoveConfirm} itemType={'network'} isRunning={inUse} />
+
+<div class="space-y-6 pb-8">
+ <!-- Breadcrumb Navigation -->
+ <div class="flex flex-col sm:flex-row justify-between sm:items-center gap-4">
+ <div>
+ <Breadcrumb.Root>
+ <Breadcrumb.List>
+ <Breadcrumb.Item>
+ <Breadcrumb.Link href="/networks">Networks</Breadcrumb.Link>
+ </Breadcrumb.Item>
+ <Breadcrumb.Separator />
+ <Breadcrumb.Item>
+ <Breadcrumb.Page>{network?.Name || shortId}</Breadcrumb.Page>
+ </Breadcrumb.Item>
+ </Breadcrumb.List>
+ </Breadcrumb.Root>
+ <div class="mt-2 flex items-center gap-2">
+ <h1 class="text-2xl font-bold tracking-tight break-all">
+ {network?.Name || 'Network Details'}
+ </h1>
+ {#if inUse}
+ <Badge variant="outline"><Container class="h-3 w-3 mr-1" /> In Use</Badge>
+ {/if}
+ {#if isPredefined}
+ <Badge variant="secondary">Predefined</Badge>
+ {/if}
+ </div>
+ </div>
+
+ <div class="flex gap-2 flex-wrap">
+ <Button variant="outline" size="sm" onclick={refreshData} disabled={isRefreshing}>
+ <RefreshCw class={`h-4 w-4 mr-2 ${isRefreshing ? 'animate-spin' : ''}`} /> Refresh
+ </Button>
+ <!-- Remove Button triggers dialog -->
+ <Button variant="destructive" size="sm" onclick={triggerRemove} disabled={isRemoving || isPredefined} title={isPredefined ? 'Cannot remove predefined networks' : ''}>
+ {#if isRemoving}
+ <Loader2 class="h-4 w-4 mr-2 animate-spin" />
+ {:else}
+ <Trash2 class="h-4 w-4 mr-2" />
+ {/if} Remove
+ </Button>
+ <!-- Hidden form for removal action -->
+ <form
+ id="remove-network-form"
+ method="POST"
+ action="?/remove"
+ use:enhance={() => {
+ isRemoving = true;
+ return async ({ update }) => {
+ await update({ reset: false });
+ isRemoving = false;
+ // isRemoving will be reset by effect or on navigation
+ };
+ }}
+ class="hidden"
+ >
+ <input type="hidden" name="networkId" value={network?.Id} />
+ <button type="submit">Submit</button>
+ </form>
+ </div>
+ </div>
+
+ <!-- Error Alert -->
+ {#if form?.error}
+ <Alert.Root variant="destructive">
+ <AlertCircle class="h-4 w-4 mr-2" />
+ <Alert.Title>Action Failed</Alert.Title>
+ <Alert.Description>{form.error}</Alert.Description>
+ </Alert.Root>
+ {/if}
+
+ {#if network}
+ <!-- Network Details Section -->
+ <div class="space-y-6">
+ <Card.Root class="border shadow-sm">
+ <Card.Header>
+ <Card.Title>Network Details</Card.Title>
+ </Card.Header>
+ <Card.Content>
+ <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
+ <!-- ID -->
+ <div class="flex items-start gap-3">
+ <div class="bg-gray-500/10 p-2 rounded-full h-10 w-10 flex items-center justify-center flex-shrink-0">
+ <Hash class="h-5 w-5 text-gray-500" />
+ </div>
+ <div class="min-w-0 flex-1">
+ <p class="text-sm font-medium text-muted-foreground">ID</p>
+ <p class="text-base font-semibold mt-1 truncate" title={network.Id}>{shortId}</p>
+ </div>
+ </div>
+
+ <!-- Name -->
+ <div class="flex items-start gap-3">
+ <div class="bg-blue-500/10 p-2 rounded-full h-10 w-10 flex items-center justify-center flex-shrink-0">
+ <Network class="h-5 w-5 text-blue-500" />
+ </div>
+ <div class="min-w-0 flex-1">
+ <p class="text-sm font-medium text-muted-foreground">Name</p>
+ <p class="text-base font-semibold mt-1 break-all">{network.Name}</p>
+ </div>
+ </div>
+
+ <!-- Driver -->
+ <div class="flex items-start gap-3">
+ <div class="bg-orange-500/10 p-2 rounded-full h-10 w-10 flex items-center justify-center flex-shrink-0">
+ <HardDrive class="h-5 w-5 text-orange-500" />
+ </div>
+ <div class="min-w-0 flex-1">
+ <p class="text-sm font-medium text-muted-foreground">Driver</p>
+ <p class="text-base font-semibold mt-1">{network.Driver}</p>
+ </div>
+ </div>
+
+ <!-- Scope -->
+ <div class="flex items-start gap-3">
+ <div class="bg-purple-500/10 p-2 rounded-full h-10 w-10 flex items-center justify-center flex-shrink-0">
+ <Globe class="h-5 w-5 text-purple-500" />
+ </div>
+ <div class="min-w-0 flex-1">
+ <p class="text-sm font-medium text-muted-foreground">Scope</p>
+ <p class="text-base font-semibold mt-1 capitalize">{network.Scope}</p>
+ </div>
+ </div>
+
+ <!-- Created -->
+ <div class="flex items-start gap-3">
+ <div class="bg-green-500/10 p-2 rounded-full h-10 w-10 flex items-center justify-center flex-shrink-0">
+ <Clock class="h-5 w-5 text-green-500" />
+ </div>
+ <div class="min-w-0 flex-1">
+ <p class="text-sm font-medium text-muted-foreground">Created</p>
+ <p class="text-base font-semibold mt-1">{createdDate}</p>
+ </div>
+ </div>
+
+ <!-- Attachable -->
+ <div class="flex items-start gap-3">
+ <div class="bg-yellow-500/10 p-2 rounded-full h-10 w-10 flex items-center justify-center flex-shrink-0">
+ <Layers class="h-5 w-5 text-yellow-500" />
+ </div>
+ <div class="min-w-0 flex-1">
+ <p class="text-sm font-medium text-muted-foreground">Attachable</p>
+ <p class="text-base font-semibold mt-1">{network.Attachable ? 'Yes' : 'No'}</p>
+ </div>
+ </div>
+
+ <!-- Internal -->
+ <div class="flex items-start gap-3">
+ <div class="bg-red-500/10 p-2 rounded-full h-10 w-10 flex items-center justify-center flex-shrink-0">
+ <Settings class="h-5 w-5 text-red-500" />
+ </div>
+ <div class="min-w-0 flex-1">
+ <p class="text-sm font-medium text-muted-foreground">Internal</p>
+ <p class="text-base font-semibold mt-1">{network.Internal ? 'Yes' : 'No'}</p>
+ </div>
+ </div>
+
+ <!-- EnableIPv6 -->
+ <div class="flex items-start gap-3">
+ <div class="bg-indigo-500/10 p-2 rounded-full h-10 w-10 flex items-center justify-center flex-shrink-0">
+ <ListTree class="h-5 w-5 text-indigo-500" />
+ </div>
+ <div class="min-w-0 flex-1">
+ <p class="text-sm font-medium text-muted-foreground">IPv6 Enabled</p>
+ <p class="text-base font-semibold mt-1">{network.EnableIPv6 ? 'Yes' : 'No'}</p>
+ </div>
+ </div>
+ </div>
+ </Card.Content>
+ </Card.Root>
+
+ <!-- IPAM Configuration Card -->
+ {#if network.IPAM?.Config && network.IPAM.Config.length > 0}
+ <Card.Root class="border shadow-sm">
+ <Card.Header>
+ <Card.Title>IPAM Configuration</Card.Title>
+ </Card.Header>
+ <Card.Content class="space-y-4">
+ {#each network.IPAM.Config as config, i}
+ <div class="space-y-1">
+ {#if config.Subnet}
+ <p class="text-sm"><span class="font-medium text-muted-foreground">Subnet:</span> <span class="font-mono text-xs">{config.Subnet}</span></p>
+ {/if}
+ {#if config.Gateway}
+ <p class="text-sm"><span class="font-medium text-muted-foreground">Gateway:</span> <span class="font-mono text-xs">{config.Gateway}</span></p>
+ {/if}
+ {#if config.IPRange}
+ <p class="text-sm"><span class="font-medium text-muted-foreground">IP Range:</span> <span class="font-mono text-xs">{config.IPRange}</span></p>
+ {/if}
+ {#if config.AuxiliaryAddresses && Object.keys(config.AuxiliaryAddresses).length > 0}
+ <p class="text-sm font-medium text-muted-foreground mt-1">Auxiliary Addresses:</p>
+ <ul class="list-disc list-inside pl-4">
+ {#each Object.entries(config.AuxiliaryAddresses) as [name, addr]}
+ <li class="text-xs font-mono">{name}: {addr}</li>
+ {/each}
+ </ul>
+ {/if}
+ </div>
+ {#if i < network.IPAM.Config.length - 1}
+ <Separator />
+ {/if}
+ {/each}
+ {#if network.IPAM.Driver}
+ <p class="text-sm mt-2"><span class="font-medium text-muted-foreground">IPAM Driver:</span> {network.IPAM.Driver}</p>
+ {/if}
+ {#if network.IPAM.Options && Object.keys(network.IPAM.Options).length > 0}
+ <p class="text-sm font-medium text-muted-foreground mt-2">IPAM Options:</p>
+ {#each Object.entries(network.IPAM.Options) as [key, value]}
+ <p class="text-xs font-mono pl-4">{key}: {value}</p>
+ {/each}
+ {/if}
+ </Card.Content>
+ </Card.Root>
+ {/if}
+
+ <!-- Connected Containers Card -->
+ {#if connectedContainers.length > 0}
+ <Card.Root class="border shadow-sm">
+ <Card.Header>
+ <Card.Title class="flex items-center gap-2"><Container class="h-5 w-5 text-muted-foreground" /> Connected Containers ({connectedContainers.length})</Card.Title>
+ </Card.Header>
+ <Card.Content class="space-y-2">
+ {#each connectedContainers as container}
+ <div class="text-sm flex flex-col sm:flex-row sm:items-center">
+ <span class="font-medium w-full sm:w-1/3 break-all">
+ <a href="/containers/{container.Name}" class="hover:underline text-primary">{container.Name}</a>
+ </span>
+ <span class="font-mono text-xs sm:text-sm break-all w-full sm:w-2/3">
+ {container.IPv4Address || container.IPv6Address || 'N/A'}
+ </span>
+ </div>
+ {#if connectedContainers.indexOf(container) < connectedContainers.length - 1}
+ <Separator class="my-2" />
+ {/if}
+ {/each}
+ </Card.Content>
+ </Card.Root>
+ {/if}
+
+ <!-- Labels Card -->
+ {#if network.Labels && Object.keys(network.Labels).length > 0}
+ <Card.Root class="border shadow-sm">
+ <Card.Header>
+ <Card.Title class="flex items-center gap-2"><Tag class="h-5 w-5 text-muted-foreground" /> Labels</Card.Title>
+ </Card.Header>
+ <Card.Content class="space-y-2">
+ {#each Object.entries(network.Labels) as [key, value]}
+ <div class="text-sm flex flex-col sm:flex-row sm:items-center">
+ <span class="font-medium text-muted-foreground w-full sm:w-1/4 break-all">{key}:</span>
+ <span class="font-mono text-xs sm:text-sm break-all w-full sm:w-3/4">{value}</span>
+ </div>
+ {#if Object.keys(network.Labels).indexOf(key) < Object.keys(network.Labels).length - 1}
+ <Separator class="my-2" />
+ {/if}
+ {/each}
+ </Card.Content>
+ </Card.Root>
+ {/if}
+
+ <!-- Options Card -->
+ {#if network.Options && Object.keys(network.Options).length > 0}
+ <Card.Root class="border shadow-sm">
+ <Card.Header>
+ <Card.Title>Options</Card.Title>
+ </Card.Header>
+ <Card.Content class="space-y-2">
+ {#each Object.entries(network.Options) as [key, value]}
+ <div class="text-sm flex flex-col sm:flex-row sm:items-center">
+ <span class="font-medium text-muted-foreground w-full sm:w-1/4 break-all">{key}:</span>
+ <span class="font-mono text-xs sm:text-sm break-all w-full sm:w-3/4">{value}</span>
+ </div>
+ {#if Object.keys(network.Options).indexOf(key) < Object.keys(network.Options).length - 1}
+ <Separator class="my-2" />
+ {/if}
+ {/each}
+ </Card.Content>
+ </Card.Root>
+ {/if}
+ </div>
+ {:else}
+ <!-- Network Not Found Section -->
+ <div class="text-center py-12">
+ <p class="text-lg font-medium text-muted-foreground">Network not found.</p>
+ <Button href="/networks" variant="outline" size="sm" class="mt-4">
+ <ArrowLeft class="h-4 w-4 mr-2" /> Back to Networks
+ </Button>
+ </div>
+ {/if}
+</div>
diff --git a/src/routes/networks/columns.ts b/src/routes/networks/columns.ts
index 4b3a52b76..9ffc07486 100644
--- a/src/routes/networks/columns.ts
+++ b/src/routes/networks/columns.ts
@@ -3,6 +3,7 @@ import { renderComponent } from '$lib/components/ui/data-table/index.js';
import NetworkActions from './NetworkActions.svelte';
import SubnetCell from './SubnetCell.svelte';
import type { ServiceNetwork } from '$lib/types/docker';
+import NameCell from '$lib/components/badges/name-cell.svelte';
// Use the ServiceNetwork type directly
export type NetworkInfo = ServiceNetwork;
@@ -10,7 +11,10 @@ export type NetworkInfo = ServiceNetwork;
export const columns: ColumnDef<NetworkInfo>[] = [
{
accessorKey: 'name',
- header: 'Name'
+ header: 'Name',
+ cell: ({ row }) => {
+ return renderComponent(NameCell, { name: row.original.name, link: `/networks/${row.original.id}` });
+ }
},
{
accessorKey: 'driver',