2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 13:47:15 +08:00

fix(容器): 获取卷列表 panic

This commit is contained in:
耗子
2024-03-20 01:33:03 +08:00
parent e127572300
commit 9b6c9484e4

View File

@@ -946,6 +946,13 @@ func (r *ContainerController) VolumeList(ctx http.Context) http.Response {
var items []any
for _, item := range paged {
var usage any
if item.UsageData != nil {
usage = map[string]any{
"ref_count": item.UsageData.RefCount,
"size": tools.FormatBytes(float64(item.UsageData.Size)),
}
}
items = append(items, map[string]any{
"id": item.Name,
"created": item.CreatedAt,
@@ -955,10 +962,7 @@ func (r *ContainerController) VolumeList(ctx http.Context) http.Response {
"options": item.Options,
"scope": item.Scope,
"status": item.Status,
"usage": map[string]any{
"ref_count": item.UsageData.RefCount,
"size": tools.FormatBytes(float64(item.UsageData.Size)),
},
"usage": usage,
})
}