Browse Source

weed admin: disk types card can also show all disk type values, not just a count.

pull/6941/head
chrislu 3 months ago
parent
commit
645b6d2603
  1. 12
      weed/admin/dash/admin_server.go
  2. 2
      weed/admin/view/app/cluster_volumes.templ
  3. 2
      weed/admin/view/app/cluster_volumes_templ.go

12
weed/admin/dash/admin_server.go

@ -168,6 +168,9 @@ type ClusterVolumesData struct {
// All versions when multiple exist // All versions when multiple exist
AllVersions []string `json:"all_versions"` AllVersions []string `json:"all_versions"`
// All disk types when multiple exist
AllDiskTypes []string `json:"all_disk_types"`
// Filtering // Filtering
FilterCollection string `json:"filter_collection"` FilterCollection string `json:"filter_collection"`
} }
@ -942,7 +945,7 @@ func (s *AdminServer) GetClusterVolumes(page int, pageSize int, sortBy string, s
showVersionColumn := versionCount > 1 showVersionColumn := versionCount > 1
var singleDataCenter, singleRack, singleDiskType, singleCollection, singleVersion string var singleDataCenter, singleRack, singleDiskType, singleCollection, singleVersion string
var allVersions []string
var allVersions, allDiskTypes []string
if dataCenterCount == 1 { if dataCenterCount == 1 {
for dc := range dataCenterMap { for dc := range dataCenterMap {
@ -961,6 +964,12 @@ func (s *AdminServer) GetClusterVolumes(page int, pageSize int, sortBy string, s
singleDiskType = diskType singleDiskType = diskType
break break
} }
} else {
// Collect all disk types and sort them
for diskType := range diskTypeMap {
allDiskTypes = append(allDiskTypes, diskType)
}
sort.Strings(allDiskTypes)
} }
if collectionCount == 1 { if collectionCount == 1 {
for collection := range collectionMap { for collection := range collectionMap {
@ -1007,6 +1016,7 @@ func (s *AdminServer) GetClusterVolumes(page int, pageSize int, sortBy string, s
SingleCollection: singleCollection, SingleCollection: singleCollection,
SingleVersion: singleVersion, SingleVersion: singleVersion,
AllVersions: allVersions, AllVersions: allVersions,
AllDiskTypes: allDiskTypes,
FilterCollection: collection, FilterCollection: collection,
}, nil }, nil
} }

2
weed/admin/view/app/cluster_volumes.templ

@ -161,7 +161,7 @@ templ ClusterVolumes(data dash.ClusterVolumesData) {
if data.DiskTypeCount == 1 { if data.DiskTypeCount == 1 {
{data.SingleDiskType} {data.SingleDiskType}
} else { } else {
{fmt.Sprintf("%d", data.DiskTypeCount)}
{strings.Join(data.AllDiskTypes, ", ")}
} }
</div> </div>
</div> </div>

2
weed/admin/view/app/cluster_volumes_templ.go

@ -262,7 +262,7 @@ func ClusterVolumes(data dash.ClusterVolumesData) templ.Component {
} }
} else { } else {
var templ_7745c5c3_Var11 string var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", data.DiskTypeCount))
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(strings.Join(data.AllDiskTypes, ", "))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/cluster_volumes.templ`, Line: 164, Col: 78} return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/cluster_volumes.templ`, Line: 164, Col: 78}
} }

Loading…
Cancel
Save