Refine Bucket Size Metrics: Logical and Physical Size (#7943)

* refactor: implement logical size calculation with replication factor using dedicated helper

* ui: update bucket list to show logical/physical size
This commit is contained in:
Chris Lu
2026-01-02 18:28:00 -08:00
committed by GitHub
parent b97d17f79f
commit 24556ebdcc
7 changed files with 408 additions and 482 deletions

View File

@@ -48,26 +48,13 @@ type CreateBucketRequest struct {
func (s *AdminServer) ShowS3Buckets(c *gin.Context) {
username := c.GetString("username")
buckets, err := s.GetS3Buckets()
data, err := s.GetS3BucketsData()
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to get Object Store buckets: " + err.Error()})
return
}
// Calculate totals
var totalSize int64
for _, bucket := range buckets {
totalSize += bucket.Size
}
data := S3BucketsData{
Username: username,
Buckets: buckets,
TotalBuckets: len(buckets),
TotalSize: totalSize,
LastUpdated: time.Now(),
}
data.Username = username
c.JSON(http.StatusOK, data)
}