Skip to content

Commit ecf748d

Browse files
committed
adds icons
1 parent 2c666a9 commit ecf748d

File tree

4 files changed

+60
-13
lines changed

4 files changed

+60
-13
lines changed

.claude/settings.local.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"Bash(go build:*)",
2323
"Bash(gh issue view:*)",
2424
"Bash(xargs ls:*)",
25-
"Bash(gh pr list:*)"
25+
"Bash(gh pr list:*)",
26+
"Bash(pnpm typecheck:*)"
2627
]
2728
}
2829
}

assets/components.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ declare module 'vue' {
9393
'Mdi:arrowUp': typeof import('~icons/mdi/arrow-up')['default']
9494
'Mdi:beer': typeof import('~icons/mdi/beer')['default']
9595
'Mdi:bell': typeof import('~icons/mdi/bell')['default']
96+
'Mdi:chartBar': typeof import('~icons/mdi/chart-bar')['default']
9697
'Mdi:chartLine': typeof import('~icons/mdi/chart-line')['default']
9798
'Mdi:check': typeof import('~icons/mdi/check')['default']
9899
'Mdi:checkCircle': typeof import('~icons/mdi/check-circle')['default']
@@ -117,9 +118,11 @@ declare module 'vue' {
117118
'Mdi:magnify': typeof import('~icons/mdi/magnify')['default']
118119
'Mdi:pencilOutline': typeof import('~icons/mdi/pencil-outline')['default']
119120
'Mdi:plus': typeof import('~icons/mdi/plus')['default']
121+
'Mdi:poll': typeof import('~icons/mdi/poll')['default']
120122
'Mdi:satelliteVariant': typeof import('~icons/mdi/satellite-variant')['default']
121123
'Mdi:textBoxOutline': typeof import('~icons/mdi/text-box-outline')['default']
122124
'Mdi:trashCanOutline': typeof import('~icons/mdi/trash-can-outline')['default']
125+
'Mdi:viewSequential': typeof import('~icons/mdi/view-sequential')['default']
123126
'Mdi:webhook': typeof import('~icons/mdi/webhook')['default']
124127
MetricAlertFields: typeof import('./components/Notification/MetricAlertFields.vue')['default']
125128
MetricCard: typeof import('./components/MetricCard.vue')['default']

assets/components/ContainerStatCell.vue

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<template>
22
<div class="flex flex-row items-center gap-2">
3-
<BarChart class="h-4 flex-1" :chart-data="chartData" :bar-class="barClass" />
3+
<template v-if="mode === 'chart'">
4+
<BarChart class="h-4 flex-1" :chart-data="chartData" :bar-class="barClass" />
5+
</template>
6+
<template v-else>
7+
<progress class="progress flex-1" :class="progressClass" :value="averageValue" max="100"></progress>
8+
</template>
49
<span class="w-fit text-right text-sm">{{ displayValue }}</span>
510
</div>
611
</template>
@@ -9,10 +14,16 @@
914
import type { Container } from "@/models/Container";
1015
import type { Host } from "@/stores/hosts";
1116
12-
const { container, type, host } = defineProps<{
17+
const {
18+
container,
19+
type,
20+
host,
21+
mode = "chart",
22+
} = defineProps<{
1323
container: Container;
1424
type: "cpu" | "mem";
1525
host: Host;
26+
mode?: "chart" | "progress";
1627
}>();
1728
1829
function totalCores(): number {
@@ -52,4 +63,12 @@ const barClass = computed(() => {
5263
if (value <= 90) return "bg-warning";
5364
return "bg-error";
5465
});
66+
67+
const progressClass = computed(() => {
68+
const value = averageValue.value;
69+
if (value <= 50) return "progress-success";
70+
if (value <= 70) return "progress-secondary";
71+
if (value <= 90) return "progress-warning";
72+
return "progress-error";
73+
});
5574
</script>

assets/components/ContainerTable.vue

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,32 @@
3535
v-else
3636
/>
3737
</div>
38-
<div class="flex-1 text-right" v-show="containers.length > pageSizes[0]">
39-
{{ $t("label.per-page") }}
38+
<div class="flex flex-1 items-center justify-end gap-2">
39+
<div v-show="containers.length > pageSizes[0]">
40+
{{ $t("label.per-page") }}
4041

41-
<DropdownMenu
42-
class="dropdown-left btn-xs md:btn-sm"
43-
v-model="perPage"
44-
:options="pageSizes.map((i) => ({ label: i.toLocaleString(), value: i }))"
45-
/>
42+
<DropdownMenu
43+
class="dropdown-left btn-xs md:btn-sm"
44+
v-model="perPage"
45+
:options="pageSizes.map((i) => ({ label: i.toLocaleString(), value: i }))"
46+
/>
47+
</div>
48+
<div class="join">
49+
<button
50+
class="btn join-item btn-xs md:btn-sm"
51+
:class="statMode === 'chart' ? 'btn-active' : 'btn-ghost'"
52+
@click="statMode = 'chart'"
53+
>
54+
<mdi:chart-bar />
55+
</button>
56+
<button
57+
class="btn join-item btn-xs md:btn-sm"
58+
:class="statMode === 'progress' ? 'btn-active' : 'btn-ghost'"
59+
@click="statMode = 'progress'"
60+
>
61+
<mdi:poll class="scale-x-[-1] rotate-90" />
62+
</button>
63+
</div>
4664
</div>
4765
</div>
4866
<div class="rounded-box border-base-content/10 overflow-x-auto border">
@@ -66,7 +84,12 @@
6684
</tr>
6785
</thead>
6886
<tbody class="bg-base-300/30">
69-
<tr v-for="container in paginated" :key="container.id" v-memo="[container.id]" class="hover:bg-base-100/80!">
87+
<tr
88+
v-for="container in paginated"
89+
:key="container.id"
90+
v-memo="[container.id, statMode]"
91+
class="hover:bg-base-100/80!"
92+
>
7093
<td v-if="isVisible('name')" class="max-w-80 truncate">
7194
<router-link :to="{ name: '/container/[id]', params: { id: container.id } }" :title="container.name">
7295
{{ container.name }}
@@ -78,10 +101,10 @@
78101
<RelativeTime :date="container.created" />
79102
</td>
80103
<td v-if="isVisible('cpu')">
81-
<ContainerStatCell :container="container" type="cpu" :host="hosts[container.host]" />
104+
<ContainerStatCell :container="container" type="cpu" :host="hosts[container.host]" :mode="statMode" />
82105
</td>
83106
<td v-if="isVisible('mem')">
84-
<ContainerStatCell :container="container" type="mem" :host="hosts[container.host]" />
107+
<ContainerStatCell :container="container" type="mem" :host="hosts[container.host]" :mode="statMode" />
85108
</td>
86109
</tr>
87110
</tbody>
@@ -167,6 +190,7 @@ const { containers } = defineProps<{
167190
}>();
168191
type keys = keyof typeof fields;
169192
193+
const statMode = useStorage<"chart" | "progress">("DOZZLE_TABLE_STAT_MODE", "chart");
170194
const perPage = useStorage("DOZZLE_TABLE_PAGE_SIZE", 15);
171195
const pageSizes = [15, 30, 50, 100];
172196

0 commit comments

Comments
 (0)