Skip to content

Modern Docker Management, Designed for Everyone

fix: unused badge color and layout

Kyle Mendell67e5bc552f81
diff --git a/src/lib/components/badges/custom-badge.svelte b/src/lib/components/badges/custom-badge.svelte
index f29c308e9..ede763d21 100644
--- a/src/lib/components/badges/custom-badge.svelte
+++ b/src/lib/components/badges/custom-badge.svelte
@@ -136,9 +136,9 @@
border: "rgba(239, 68, 68, 0.15)",
},
Unused: {
- bg: "rgba(239, 68, 68, 0.15)",
- color: "rgb(185, 28, 28)",
- border: "rgba(239, 68, 68, 0.15)",
+ bg: "rgba(234, 179, 8, 0.2)",
+ color: "rgb(210, 153, 34)",
+ border: "rgba(234, 179, 8, 0.2)",
},
pending: {
bg: "rgba(59, 130, 246, 0.15)",
diff --git a/src/lib/components/badges/unused-text-badge.svelte b/src/lib/components/badges/unused-text-badge.svelte
new file mode 100644
index 000000000..5f3d63d5b
--- /dev/null
+++ b/src/lib/components/badges/unused-text-badge.svelte
@@ -0,0 +1,13 @@
+<script lang="ts">
+ import CustomBadge from "$lib/components/badges/custom-badge.svelte";
+
+ export let name: string;
+ export let inUse: boolean | undefined;
+</script>
+
+<div class="flex items-center gap-2">
+ <span class="truncate">{name}</span>
+ {#if !inUse}
+ <CustomBadge variant="status" text="Unused" className="ml-2" />
+ {/if}
+</div>
diff --git a/src/routes/images/columns.ts b/src/routes/images/columns.ts
index d7d54f570..152f4f179 100644
--- a/src/routes/images/columns.ts
+++ b/src/routes/images/columns.ts
@@ -3,7 +3,7 @@ import type { ColumnDef } from "@tanstack/table-core";
import { renderComponent } from "$lib/components/ui/data-table/index.js";
import ImageActions from "./ImageActions.svelte";
import { formatBytes } from "$lib/utils";
-import CustomBadge from "$lib/components/badges/custom-badge.svelte";
+import UnusedTextBadge from "$lib/components/badges/unused-text-badge.svelte";
// Enhanced type with usage info
export type EnhancedImage = ServiceImage & { inUse?: boolean };
@@ -13,7 +13,12 @@ export const columns: ColumnDef<EnhancedImage>[] = [
accessorKey: "repo",
header: "Name",
cell: ({ row }) => {
- return row.original.repo;
+ const inUse = row.original.inUse;
+
+ return renderComponent(UnusedTextBadge, {
+ name: row.original.repo,
+ inUse: row.original.inUse,
+ });
},
},
{
@@ -23,29 +28,6 @@ export const columns: ColumnDef<EnhancedImage>[] = [
return row.original.tag;
},
},
- {
- accessorKey: "usage",
- header: "Status",
- cell: ({ row }) => {
- const inUse = row.original.inUse;
- if (inUse === undefined) {
- return null;
- }
-
- if (inUse) {
- return renderComponent(CustomBadge, {
- variant: "status",
- text: "In use",
- });
- } else {
- return renderComponent(CustomBadge, {
- variant: "status",
- text: "Unused",
- });
- }
- },
- enableSorting: true,
- },
{
accessorKey: "id",
header: "Image ID",
diff --git a/src/routes/settings/+page.svelte b/src/routes/settings/+page.svelte
index 53c4d6ad6..1decd0e68 100644
--- a/src/routes/settings/+page.svelte
+++ b/src/routes/settings/+page.svelte
@@ -109,7 +109,7 @@
{#each tabs as tab}
<Tabs.Content value={tab.id} class="space-y-4">
- <svelte:component this={tab.component} {data} {form} />
+ <tab.component {data} {form} />
</Tabs.Content>
{/each}
</form>
diff --git a/src/routes/volumes/columns.ts b/src/routes/volumes/columns.ts
index c978d9bbc..9089d7505 100644
--- a/src/routes/volumes/columns.ts
+++ b/src/routes/volumes/columns.ts
@@ -4,6 +4,7 @@ import VolumeActions from "./VolumeActions.svelte";
import MountpointCell from "./MountpointCell.svelte";
import CustomBadge from "$lib/components/badges/custom-badge.svelte";
import type { ServiceVolume } from "$lib/services/docker-service";
+import UnusedTextBadge from "$lib/components/badges/unused-text-badge.svelte";
// Update the type to include the inUse property
export type VolumeInfo = ServiceVolume & { inUse?: boolean };
@@ -12,6 +13,14 @@ export const columns: ColumnDef<VolumeInfo>[] = [
{
accessorKey: "name",
header: "Name",
+ cell: ({ row }) => {
+ const inUse = row.original.inUse;
+
+ return renderComponent(UnusedTextBadge, {
+ name: row.original.name,
+ inUse: inUse,
+ });
+ },
},
{
accessorKey: "driver",
@@ -21,29 +30,6 @@ export const columns: ColumnDef<VolumeInfo>[] = [
accessorKey: "scope",
header: "Scope",
},
- {
- accessorKey: "usage",
- header: "Status",
- cell: ({ row }) => {
- const inUse = row.original.inUse;
- if (inUse === undefined) {
- return null;
- }
-
- if (inUse) {
- return renderComponent(CustomBadge, {
- variant: "status",
- text: "In use",
- });
- } else {
- return renderComponent(CustomBadge, {
- variant: "status",
- text: "Unused",
- });
- }
- },
- enableSorting: true,
- },
{
accessorKey: "mountpoint",
header: "Mountpoint",