Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
feat: add usage badge to network table
Kyle Mendell60190456dd46
diff --git a/backend/internal/dto/network_dto.go b/backend/internal/dto/network_dto.goindex f7108e00a..3bfc693b8 100644--- a/backend/internal/dto/network_dto.go+++ b/backend/internal/dto/network_dto.go@@ -14,6 +14,7 @@ type NetworkSummaryDto struct {Created time.Time `json:"created"`Options map[string]string `json:"options"`Labels map[string]string `json:"labels"`+ InUse bool `json:"inUse"`}type NetworkUsageCounts struct {@@ -48,6 +49,8 @@ type NetworkPruneReportDto struct {}func NewNetworkSummaryDto(s network.Summary) NetworkSummaryDto {+ iu := len(s.Containers) > 1+return NetworkSummaryDto{ID: s.ID,Name: s.Name,@@ -56,5 +59,6 @@ func NewNetworkSummaryDto(s network.Summary) NetworkSummaryDto {Created: s.Created,Options: s.Options,Labels: s.Labels,+ InUse: iu,}}diff --git a/frontend/src/lib/types/network.type.ts b/frontend/src/lib/types/network.type.tsindex b81594135..471ab1dfb 100644--- a/frontend/src/lib/types/network.type.ts+++ b/frontend/src/lib/types/network.type.ts@@ -126,6 +126,7 @@ export interface NetworkSummaryDto {created: string; // ISO RFC3339 stringoptions?: Record<string, string> | null;labels?: Record<string, string> | null;+ inUse: boolean;}export interface NetworkInspectDto {diff --git a/frontend/src/routes/networks/network-table.svelte b/frontend/src/routes/networks/network-table.svelteindex f45745cf5..ae200eda6 100644--- a/frontend/src/routes/networks/network-table.svelte+++ b/frontend/src/routes/networks/network-table.svelte@@ -123,6 +123,18 @@title: m.common_id(),cell: IdCell},+ {+ accessorKey: 'inUse',+ title: m.common_status(),+ sortable: true,+ cell: StatusCell,+ filterFn: (row, columnId, filterValue) => {+ const selected = Array.isArray(filterValue) ? (filterValue as boolean[]) : [];+ if (selected.length === 0) return true;+ const value = Boolean(row.getValue<boolean>(columnId));+ return selected.includes(value);+ }+ },{accessorKey: 'driver',title: m.common_driver(),@@ -165,6 +177,14 @@<StatusBadge variant={item.scope === 'local' ? 'green' : 'amber'} text={capitalizeFirstLetter(item.scope)} />{/snippet}+{#snippet StatusCell({ item }: { item: NetworkSummaryDto })}+ {#if item.inUse}+ <StatusBadge text={m.common_in_use()} variant="green" />+ {:else}+ <StatusBadge text={m.common_unused()} variant="amber" />+ {/if}+{/snippet}+{#snippet RowActions({ item }: { item: NetworkSummaryDto })}<DropdownMenu.Root><DropdownMenu.Trigger>