package app import ( "fmt" "github.com/seaweedfs/seaweedfs/weed/admin/dash" ) templ EcVolumeDetails(data dash.EcVolumeDetailsData) {

EC Volume Details

Volume Information
if !data.IsComplete { }
Volume ID: {fmt.Sprintf("%d", data.VolumeID)}
Collection: if data.Collection != "" { {data.Collection} } else { default }
Status: if data.IsComplete { Complete ({data.TotalShards}/14 shards) } else { Incomplete ({data.TotalShards}/14 shards) }
Missing Shards: for i, shardID := range data.MissingShards { if i > 0 { , } {fmt.Sprintf("%02d", shardID)} }
Data Centers: for i, dc := range data.DataCenters { if i > 0 { , } {dc} }
Servers: {fmt.Sprintf("%d servers", len(data.Servers))}
Last Updated: {data.LastUpdated.Format("2006-01-02 15:04:05")}
Volume Health
if data.TotalSize > 0 {
{bytesToHumanReadableUint64(data.TotalSize - data.DeletedByteCount)}
Active Bytes
{bytesToHumanReadableUint64(data.DeletedByteCount)}
Deleted Bytes
{fmt.Sprintf("%d", data.FileCount - data.DeleteCount)}
Active Files
{fmt.Sprintf("%d", data.DeleteCount)}
Deleted Files
{fmt.Sprintf("%.1f%%", data.GarbageRatio * 100)}
Garbage Ratio if data.GarbageRatio >= 0.3 {
EC Vacuum Candidate
}
} else {
Volume health metrics not available
This may be normal for newly created EC volumes
}
Shard Distribution

{fmt.Sprintf("%d", data.TotalShards)}

Total Shards

{fmt.Sprintf("%d", len(data.DataCenters))}

Data Centers

{fmt.Sprintf("%d", len(data.Servers))}

Servers
Present Shards:
for _, shard := range data.Shards { {fmt.Sprintf("%02d", shard.ShardID)} }
if len(data.MissingShards) > 0 {
Missing Shards:
for _, shardID := range data.MissingShards { {fmt.Sprintf("%02d", shardID)} }
}
Shard Details
if len(data.Shards) > 0 { } else {
No EC shards found

This volume may not be EC encoded yet.

}
} // Helper function to convert bytes to human readable format (uint64 version) func bytesToHumanReadableUint64(bytes uint64) string { const unit = 1024 if bytes < unit { return fmt.Sprintf("%dB", bytes) } div, exp := uint64(unit), 0 for n := bytes / unit; n >= unit; n /= unit { div *= unit exp++ } return fmt.Sprintf("%.1f%cB", float64(bytes)/float64(div), "KMGTPE"[exp]) } // Helper function to get color for garbage ratio display func getGarbageRatioColor(ratio float64) string { if ratio >= 0.5 { return "#dc3545" // Red for high garbage ratio } else if ratio >= 0.3 { return "#fd7e14" // Orange for medium garbage ratio } else if ratio >= 0.1 { return "#ffc107" // Yellow for low garbage ratio } return "#28a745" // Green for very low garbage ratio }