|
35 | 35 | v-else |
36 | 36 | /> |
37 | 37 | </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") }} |
40 | 41 |
|
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> |
46 | 64 | </div> |
47 | 65 | </div> |
48 | 66 | <div class="rounded-box border-base-content/10 overflow-x-auto border"> |
|
66 | 84 | </tr> |
67 | 85 | </thead> |
68 | 86 | <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 | + > |
70 | 93 | <td v-if="isVisible('name')" class="max-w-80 truncate"> |
71 | 94 | <router-link :to="{ name: '/container/[id]', params: { id: container.id } }" :title="container.name"> |
72 | 95 | {{ container.name }} |
|
78 | 101 | <RelativeTime :date="container.created" /> |
79 | 102 | </td> |
80 | 103 | <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" /> |
82 | 105 | </td> |
83 | 106 | <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" /> |
85 | 108 | </td> |
86 | 109 | </tr> |
87 | 110 | </tbody> |
@@ -167,6 +190,7 @@ const { containers } = defineProps<{ |
167 | 190 | }>(); |
168 | 191 | type keys = keyof typeof fields; |
169 | 192 |
|
| 193 | +const statMode = useStorage<"chart" | "progress">("DOZZLE_TABLE_STAT_MODE", "chart"); |
170 | 194 | const perPage = useStorage("DOZZLE_TABLE_PAGE_SIZE", 15); |
171 | 195 | const pageSizes = [15, 30, 50, 100]; |
172 | 196 |
|
|
0 commit comments