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

EC Shards

if data.FilterCollection != "" {
if data.FilterCollection == "default" { Collection: default } else { Collection: {data.FilterCollection} } Clear Filter
}
Total Shards

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

EC Volumes

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

Healthy Volumes

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

Complete (14/14 shards)
Degraded Volumes

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

Incomplete/Critical
if data.ShowCollectionColumn { } if data.ShowDataCenterColumn { } if data.ShowRackColumn { } for _, shard := range data.EcShards { if data.ShowCollectionColumn { } if data.ShowDataCenterColumn { } if data.ShowRackColumn { } }
Volume ID if data.SortBy == "volume_id" { if data.SortOrder == "asc" { } else { } } else { } Collection if data.SortBy == "collection" { if data.SortOrder == "asc" { } else { } } else { } Server if data.SortBy == "server" { if data.SortOrder == "asc" { } else { } } else { } Data Center if data.SortBy == "datacenter" { if data.SortOrder == "asc" { } else { } } else { } Rack if data.SortBy == "rack" { if data.SortOrder == "asc" { } else { } } else { } Distribution Status Actions
{fmt.Sprintf("%d", shard.VolumeID)} if shard.Collection != "" { {shard.Collection} } else { default } {shard.Server} {shard.DataCenter} {shard.Rack} @displayShardDistribution(shard, data.EcShards) @displayVolumeStatus(shard)
if !shard.IsComplete { }
if data.TotalPages > 1 { } } // displayShardDistribution shows the distribution summary for a volume's shards templ displayShardDistribution(shard dash.EcShardWithInfo, allShards []dash.EcShardWithInfo) {
{ calculateDistributionSummary(shard.VolumeID, allShards) }
} // displayVolumeStatus shows an improved status display templ displayVolumeStatus(shard dash.EcShardWithInfo) { if shard.IsComplete { Complete } else { if len(shard.MissingShards) > 10 { Critical ({fmt.Sprintf("%d", len(shard.MissingShards))} missing) } else if len(shard.MissingShards) > 6 { Degraded ({fmt.Sprintf("%d", len(shard.MissingShards))} missing) } else if len(shard.MissingShards) > 2 { Incomplete ({fmt.Sprintf("%d", len(shard.MissingShards))} missing) } else { Minor Issues ({fmt.Sprintf("%d", len(shard.MissingShards))} missing) } } } // calculateDistributionSummary calculates and formats the distribution summary func calculateDistributionSummary(volumeID uint32, allShards []dash.EcShardWithInfo) string { dataCenters := make(map[string]bool) racks := make(map[string]bool) servers := make(map[string]bool) for _, s := range allShards { if s.VolumeID == volumeID { dataCenters[s.DataCenter] = true racks[s.Rack] = true servers[s.Server] = true } } return fmt.Sprintf("%d DCs, %d racks, %d servers", len(dataCenters), len(racks), len(servers)) }