package app import ( "fmt" "github.com/seaweedfs/seaweedfs/weed/admin/dash" "github.com/seaweedfs/seaweedfs/weed/storage/erasure_coding" ) 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}/{fmt.Sprintf("%d", erasure_coding.TotalShardsCount)} shards) } else { Incomplete ({data.TotalShards}/{fmt.Sprintf("%d", erasure_coding.TotalShardsCount)} shards) }
Missing Shards: for i, shardID := range data.MissingShards { if i > 0 { , } @renderEcShardBadge(uint32(shardID), true) }
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")}
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 { @renderEcShardBadge(shard.ShardID, false) }
Data Parity Data shards are blue, parity shards are yellow.
if len(data.MissingShards) > 0 {
Missing Shards:
for _, shardID := range data.MissingShards { @renderEcShardBadge(uint32(shardID), true) }
}
Shard Details
if len(data.Shards) > 0 { } else {
No EC shards found

This volume may not be EC encoded yet.

}
} templ renderEcShardBadge(shardID uint32, missing bool) { if shardID < erasure_coding.DataShardsCount { if missing { { fmt.Sprintf("D%02d", shardID) } } else { { fmt.Sprintf("D%02d", shardID) } } } else { if missing { { fmt.Sprintf("P%02d", shardID) } } else { { fmt.Sprintf("P%02d", shardID) } } } } // 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]) }