package app import ( "fmt" "strings" "github.com/seaweedfs/seaweedfs/weed/admin/dash" ) templ ClusterVolumes(data dash.ClusterVolumesData) {

Cluster Volumes

if data.FilterCollection != "" {
Collection: {data.FilterCollection} Clear Filter
}
Total Volumes
{fmt.Sprintf("%d", data.TotalVolumes)}
if data.CollectionCount == 1 { Collection } else { Collections }
if data.CollectionCount == 1 { {data.SingleCollection} } else { {fmt.Sprintf("%d", data.CollectionCount)} }
if data.DataCenterCount == 1 { Data Center } else { Data Centers }
if data.DataCenterCount == 1 { {data.SingleDataCenter} } else { {fmt.Sprintf("%d", data.DataCenterCount)} }
if data.RackCount == 1 { Rack } else { Racks }
if data.RackCount == 1 { {data.SingleRack} } else { {fmt.Sprintf("%d", data.RackCount)} }
if data.DiskTypeCount == 1 { Disk Type } else { Disk Types }
if data.DiskTypeCount == 1 { {data.SingleDiskType} } else { {strings.Join(data.AllDiskTypes, ", ")} }
if data.VersionCount == 1 { Version } else { Versions }
if data.VersionCount == 1 { {data.SingleVersion} } else { {strings.Join(data.AllVersions, ", ")} }
Total Size
{formatBytes(data.TotalSize)}
Volume Details
if len(data.Volumes) > 0 {
if data.ShowDataCenterColumn { } if data.ShowRackColumn { } if data.ShowCollectionColumn { } if data.ShowDiskTypeColumn { } if data.ShowVersionColumn { } for _, volume := range data.Volumes { if data.ShowDataCenterColumn { } if data.ShowRackColumn { } if data.ShowCollectionColumn { } if data.ShowDiskTypeColumn { } if data.ShowVersionColumn { } }
Volume ID @getSortIcon("id", data.SortBy, data.SortOrder) Server @getSortIcon("server", data.SortBy, data.SortOrder) Data Center @getSortIcon("datacenter", data.SortBy, data.SortOrder) Rack @getSortIcon("rack", data.SortBy, data.SortOrder) Collection @getSortIcon("collection", data.SortBy, data.SortOrder) Size @getSortIcon("size", data.SortBy, data.SortOrder) File Count @getSortIcon("filecount", data.SortBy, data.SortOrder) Replication @getSortIcon("replication", data.SortBy, data.SortOrder) Disk Type @getSortIcon("disktype", data.SortBy, data.SortOrder) Version @getSortIcon("version", data.SortBy, data.SortOrder) Actions
{fmt.Sprintf("%d", volume.ID)} {volume.Server} {volume.DataCenter} {volume.Rack} if volume.Collection == "" { default } else { {volume.Collection} } {formatBytes(volume.Size)} {fmt.Sprintf("%d", volume.FileCount)} {volume.Replication} {volume.DiskType} {fmt.Sprintf("v%d", volume.Version)}
Showing {fmt.Sprintf("%d", (data.CurrentPage-1)*data.PageSize + 1)} to {fmt.Sprintf("%d", minInt(data.CurrentPage*data.PageSize, data.TotalVolumes))} of {fmt.Sprintf("%d", data.TotalVolumes)} volumes
if data.TotalPages > 1 {
Page {fmt.Sprintf("%d", data.CurrentPage)} of {fmt.Sprintf("%d", data.TotalPages)}
}
if data.TotalPages > 1 {
} } else {
No Volumes Found

No volumes are currently available in the cluster.

}
Last updated: {data.LastUpdated.Format("2006-01-02 15:04:05")}
} func countActiveVolumes(volumes []dash.VolumeInfo) int { // Since we removed status tracking, consider all volumes as active return len(volumes) } func countUniqueDataCenters(volumes []dash.VolumeInfo) int { dcMap := make(map[string]bool) for _, volume := range volumes { dcMap[volume.DataCenter] = true } return len(dcMap) } func countUniqueRacks(volumes []dash.VolumeInfo) int { rackMap := make(map[string]bool) for _, volume := range volumes { if volume.Rack != "" { rackMap[volume.Rack] = true } } return len(rackMap) } func countUniqueDiskTypes(volumes []dash.VolumeInfo) int { diskTypeMap := make(map[string]bool) for _, volume := range volumes { diskType := volume.DiskType if diskType == "" { diskType = "hdd" } diskTypeMap[diskType] = true } return len(diskTypeMap) } templ getSortIcon(column, currentSort, currentOrder string) { if column != currentSort { } else if currentOrder == "asc" { } else { } } func minInt(a, b int) int { if a < b { return a } return b } func maxInt(a, b int) int { if a > b { return a } return b }