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

Cluster Collections

Total Collections
{fmt.Sprintf("%d", data.TotalCollections)}
Active Collections
{fmt.Sprintf("%d", countActiveCollections(data.Collections))}
Total Volumes
{fmt.Sprintf("%d", data.TotalVolumes)}
Total Files
{fmt.Sprintf("%d", data.TotalFiles)}
Total Storage Size
{formatBytes(data.TotalSize)}
Data Centers
{fmt.Sprintf("%d", countUniqueCollectionDataCenters(data.Collections))}
Collection Details
if len(data.Collections) > 0 {
for _, collection := range data.Collections { }
Collection Name Data Center Replication Volumes Files Size TTL Disk Type Status Actions
{collection.Name} {collection.DataCenter} {collection.Replication}
{fmt.Sprintf("%d", collection.VolumeCount)}
{fmt.Sprintf("%d", collection.FileCount)}
{formatBytes(collection.TotalSize)}
if collection.TTL != "" { {collection.TTL} } else { None } {collection.DiskType} {collection.Status}
} else {
No Collections Found

No collections are currently configured in the cluster.

}
Last updated: {data.LastUpdated.Format("2006-01-02 15:04:05")}
} func countActiveCollections(collections []dash.CollectionInfo) int { count := 0 for _, collection := range collections { if collection.Status == "active" { count++ } } return count } func countUniqueCollectionDataCenters(collections []dash.CollectionInfo) int { dcMap := make(map[string]bool) for _, collection := range collections { dcMap[collection.DataCenter] = true } return len(dcMap) }