Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a95bb5b

Browse files
committed
feat: expand pool details for rebalance and decommission
1 parent 70e6cd3 commit a95bb5b

17 files changed

Lines changed: 284 additions & 29 deletions

components/pools/overview.tsx

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useMemo } from "react"
44
import { useTranslation } from "react-i18next"
55
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
66
import { Badge } from "@/components/ui/badge"
7+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"
78
import { niceBytes } from "@/lib/functions"
89
import type { PoolsOverview } from "@/lib/pool-operations"
910

@@ -16,6 +17,24 @@ function Stat({ label, value }: { label: string; value: string }) {
1617
)
1718
}
1819

20+
function formatBytesValue(value?: number) {
21+
return value === undefined ? "--" : niceBytes(String(value))
22+
}
23+
24+
function formatNumberValue(value?: number) {
25+
return value === undefined ? "--" : value.toLocaleString()
26+
}
27+
28+
function formatPercentValue(value?: number) {
29+
return value === undefined ? "--" : `${value.toFixed(2)}%`
30+
}
31+
32+
function formatDateTime(value?: string) {
33+
if (!value) return "--"
34+
const date = new Date(value)
35+
return Number.isNaN(date.getTime()) ? value : date.toLocaleString()
36+
}
37+
1938
export function PoolsOverviewCard({ overview, operationLabel }: { overview: PoolsOverview; operationLabel: string }) {
2039
const { t } = useTranslation()
2140
const usedPercent = useMemo(() => {
@@ -45,6 +64,66 @@ export function PoolsOverviewCard({ overview, operationLabel }: { overview: Pool
4564
value={overview.totalUsedCapacity ? niceBytes(String(overview.totalUsedCapacity)) : "--"}
4665
/>
4766
<Stat label={t("Usage")} value={`${usedPercent}%`} />
67+
<div className="md:col-span-4">
68+
<Table className="min-w-[1120px]">
69+
<TableHeader>
70+
<TableRow>
71+
<TableHead>{t("ID")}</TableHead>
72+
<TableHead>{t("Pool")}</TableHead>
73+
<TableHead>{t("Status")}</TableHead>
74+
<TableHead>{t("Total Capacity")}</TableHead>
75+
<TableHead>{t("Current Size")}</TableHead>
76+
<TableHead>{t("Used Capacity")}</TableHead>
77+
<TableHead>{t("Available")}</TableHead>
78+
<TableHead>{t("Usage")}</TableHead>
79+
<TableHead>{t("Updated At")}</TableHead>
80+
<TableHead>{t("Start Time")}</TableHead>
81+
<TableHead>{t("Start Size")}</TableHead>
82+
<TableHead>{t("Complete")}</TableHead>
83+
<TableHead>{t("Failed Status")}</TableHead>
84+
<TableHead>{t("Canceled")}</TableHead>
85+
<TableHead>{t("Objects")}</TableHead>
86+
<TableHead>{t("Objects Failed")}</TableHead>
87+
<TableHead>{t("Bytes Moved")}</TableHead>
88+
<TableHead>{t("Bytes Failed")}</TableHead>
89+
</TableRow>
90+
</TableHeader>
91+
<TableBody>
92+
{overview.pools.length === 0 ? (
93+
<TableRow>
94+
<TableCell colSpan={18} className="text-center text-muted-foreground">
95+
{t("No Data")}
96+
</TableCell>
97+
</TableRow>
98+
) : (
99+
overview.pools.map((pool) => (
100+
<TableRow key={pool.id}>
101+
<TableCell>{pool.id}</TableCell>
102+
<TableCell className="max-w-[360px] truncate" title={pool.name}>
103+
{pool.name}
104+
</TableCell>
105+
<TableCell>{pool.status || "--"}</TableCell>
106+
<TableCell>{formatBytesValue(pool.total)}</TableCell>
107+
<TableCell>{formatBytesValue(pool.currentSize)}</TableCell>
108+
<TableCell>{formatBytesValue(pool.used)}</TableCell>
109+
<TableCell>{formatBytesValue(pool.available)}</TableCell>
110+
<TableCell>{formatPercentValue(pool.usagePercent)}</TableCell>
111+
<TableCell>{formatDateTime(pool.lastUpdate)}</TableCell>
112+
<TableCell>{formatDateTime(pool.decommission.startTime)}</TableCell>
113+
<TableCell>{formatBytesValue(pool.decommission.startSize)}</TableCell>
114+
<TableCell>{pool.decommission.complete ? t("Yes") : t("No")}</TableCell>
115+
<TableCell>{pool.decommission.failed ? t("Yes") : t("No")}</TableCell>
116+
<TableCell>{pool.decommission.canceled ? t("Yes") : t("No")}</TableCell>
117+
<TableCell>{formatNumberValue(pool.decommission.objects)}</TableCell>
118+
<TableCell>{formatNumberValue(pool.decommission.objectsFailed)}</TableCell>
119+
<TableCell>{formatBytesValue(pool.decommission.bytes)}</TableCell>
120+
<TableCell>{formatBytesValue(pool.decommission.bytesFailed)}</TableCell>
121+
</TableRow>
122+
))
123+
)}
124+
</TableBody>
125+
</Table>
126+
</div>
48127
</CardContent>
49128
</Card>
50129
)

i18n/locales/ar-MA.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,5 +1307,12 @@
13071307
"username length cannot be less than 8 characters and greater than 16 characters": "لا يمكن أن يكون طول اسم المستخدم أقل من 8 أحرف وأكثر من 16 حرفًا",
13081308
"waiting": "في الانتظار",
13091309
"Completed Status": "مكتمل",
1310-
"Active Pool": "التجمع النشط"
1310+
"Active Pool": "التجمع النشط",
1311+
"Bytes Failed": "Bytes Failed",
1312+
"Complete": "Complete",
1313+
"Current Size": "Current Size",
1314+
"ID": "ID",
1315+
"Objects Failed": "Objects Failed",
1316+
"Start Size": "Start Size",
1317+
"Start Time": "Start Time"
13111318
}

i18n/locales/de-DE.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,5 +1307,12 @@
13071307
"username length cannot be less than 8 characters and greater than 16 characters": "Benutzernamenlänge darf nicht weniger als 8 Zeichen und nicht mehr als 16 Zeichen sein",
13081308
"waiting": "Warten",
13091309
"Completed Status": "Abgeschlossen",
1310-
"Active Pool": "Aktiver Pool"
1310+
"Active Pool": "Aktiver Pool",
1311+
"Bytes Failed": "Bytes Failed",
1312+
"Complete": "Complete",
1313+
"Current Size": "Current Size",
1314+
"ID": "ID",
1315+
"Objects Failed": "Objects Failed",
1316+
"Start Size": "Start Size",
1317+
"Start Time": "Start Time"
13111318
}

i18n/locales/en-US.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,5 +1307,12 @@
13071307
"username length cannot be less than 8 characters and greater than 16 characters": "username length cannot be less than 8 characters and greater than 16 characters",
13081308
"waiting": "Waiting",
13091309
"Completed Status": "Completed",
1310-
"Active Pool": "Active Pool"
1310+
"Active Pool": "Active Pool",
1311+
"Bytes Failed": "Bytes Failed",
1312+
"Complete": "Complete",
1313+
"Current Size": "Current Size",
1314+
"ID": "ID",
1315+
"Objects Failed": "Objects Failed",
1316+
"Start Size": "Start Size",
1317+
"Start Time": "Start Time"
13111318
}

i18n/locales/es-ES.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,5 +1307,12 @@
13071307
"username length cannot be less than 8 characters and greater than 16 characters": "La longitud del nombre de usuario no puede ser menor de 8 caracteres y mayor de 16 caracteres",
13081308
"waiting": "Esperando",
13091309
"Completed Status": "Completada",
1310-
"Active Pool": "Pool activo"
1310+
"Active Pool": "Pool activo",
1311+
"Bytes Failed": "Bytes Failed",
1312+
"Complete": "Complete",
1313+
"Current Size": "Current Size",
1314+
"ID": "ID",
1315+
"Objects Failed": "Objects Failed",
1316+
"Start Size": "Start Size",
1317+
"Start Time": "Start Time"
13111318
}

i18n/locales/fr-FR.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,5 +1307,12 @@
13071307
"username length cannot be less than 8 characters and greater than 16 characters": "la longueur du nom d'utilisateur ne peut pas être inférieure à 8 caractères et supérieure à 16 caractères",
13081308
"waiting": "En attente",
13091309
"Completed Status": "Terminé",
1310-
"Active Pool": "Pool actif"
1310+
"Active Pool": "Pool actif",
1311+
"Bytes Failed": "Bytes Failed",
1312+
"Complete": "Complete",
1313+
"Current Size": "Current Size",
1314+
"ID": "ID",
1315+
"Objects Failed": "Objects Failed",
1316+
"Start Size": "Start Size",
1317+
"Start Time": "Start Time"
13111318
}

i18n/locales/id-ID.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,5 +1307,12 @@
13071307
"username length cannot be less than 8 characters and greater than 16 characters": "panjang nama pengguna tidak boleh kurang dari 8 karakter dan lebih dari 16 karakter",
13081308
"waiting": "Menunggu",
13091309
"Completed Status": "Selesai",
1310-
"Active Pool": "Pool aktif"
1310+
"Active Pool": "Pool aktif",
1311+
"Bytes Failed": "Bytes Failed",
1312+
"Complete": "Complete",
1313+
"Current Size": "Current Size",
1314+
"ID": "ID",
1315+
"Objects Failed": "Objects Failed",
1316+
"Start Size": "Start Size",
1317+
"Start Time": "Start Time"
13111318
}

i18n/locales/it-IT.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,5 +1307,12 @@
13071307
"username length cannot be less than 8 characters and greater than 16 characters": "La lunghezza del nome utente non può essere inferiore a 8 caratteri e superiore a 16 caratteri",
13081308
"waiting": "In attesa",
13091309
"Completed Status": "Completato",
1310-
"Active Pool": "Pool attivo"
1310+
"Active Pool": "Pool attivo",
1311+
"Bytes Failed": "Bytes Failed",
1312+
"Complete": "Complete",
1313+
"Current Size": "Current Size",
1314+
"ID": "ID",
1315+
"Objects Failed": "Objects Failed",
1316+
"Start Size": "Start Size",
1317+
"Start Time": "Start Time"
13111318
}

i18n/locales/ja-JP.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,5 +1307,12 @@
13071307
"username length cannot be less than 8 characters and greater than 16 characters": "ユーザー名の長さは8文字未満、16文字を超えることはできません",
13081308
"waiting": "待機中",
13091309
"Completed Status": "完了しました",
1310-
"Active Pool": "アクティブなプール"
1310+
"Active Pool": "アクティブなプール",
1311+
"Bytes Failed": "Bytes Failed",
1312+
"Complete": "Complete",
1313+
"Current Size": "Current Size",
1314+
"ID": "ID",
1315+
"Objects Failed": "Objects Failed",
1316+
"Start Size": "Start Size",
1317+
"Start Time": "Start Time"
13111318
}

i18n/locales/ko-KR.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,5 +1307,12 @@
13071307
"username length cannot be less than 8 characters and greater than 16 characters": "사용자 이름 길이는 8자 미만, 16자 초과일 수 없습니다",
13081308
"waiting": "대기 중",
13091309
"Completed Status": "완료",
1310-
"Active Pool": "활성 풀"
1310+
"Active Pool": "활성 풀",
1311+
"Bytes Failed": "Bytes Failed",
1312+
"Complete": "Complete",
1313+
"Current Size": "Current Size",
1314+
"ID": "ID",
1315+
"Objects Failed": "Objects Failed",
1316+
"Start Size": "Start Size",
1317+
"Start Time": "Start Time"
13111318
}

0 commit comments

Comments
 (0)