diff --git a/weed/admin/admin b/weed/admin/admin new file mode 100755 index 000000000..1e1987f97 Binary files /dev/null and b/weed/admin/admin differ diff --git a/weed/admin/dash/admin_server.go b/weed/admin/dash/admin_server.go index 79bce365b..e4fa0c768 100644 --- a/weed/admin/dash/admin_server.go +++ b/weed/admin/dash/admin_server.go @@ -141,15 +141,15 @@ type ClusterVolumesData struct { } type CollectionInfo struct { - Name string `json:"name"` - DataCenter string `json:"datacenter"` - Replication string `json:"replication"` - VolumeCount int `json:"volume_count"` - FileCount int64 `json:"file_count"` - TotalSize int64 `json:"total_size"` - TTL string `json:"ttl"` - DiskType string `json:"disk_type"` - Status string `json:"status"` + Name string `json:"name"` + DataCenter string `json:"datacenter"` + Replication string `json:"replication"` + VolumeCount int `json:"volume_count"` + FileCount int64 `json:"file_count"` + TotalSize int64 `json:"total_size"` + TTL string `json:"ttl"` + DiskTypes []string `json:"disk_types"` + Status string `json:"status"` } type ClusterCollectionsData struct { @@ -879,6 +879,12 @@ func (s *AdminServer) GetClusterCollections() (*ClusterCollectionsData, error) { collectionName = "default" // Default collection for volumes without explicit collection } + // Get disk type from volume info, default to hdd if empty + diskType := volInfo.DiskType + if diskType == "" { + diskType = "hdd" + } + // Get or create collection info if collection, exists := collectionMap[collectionName]; exists { collection.VolumeCount++ @@ -890,6 +896,18 @@ func (s *AdminServer) GetClusterCollections() (*ClusterCollectionsData, error) { collection.DataCenter = "multi" } + // Add disk type if not already present + diskTypeExists := false + for _, existingDiskType := range collection.DiskTypes { + if existingDiskType == diskType { + diskTypeExists = true + break + } + } + if !diskTypeExists { + collection.DiskTypes = append(collection.DiskTypes, diskType) + } + totalVolumes++ totalFiles += int64(volInfo.FileCount) totalSize += int64(volInfo.Size) @@ -910,7 +928,7 @@ func (s *AdminServer) GetClusterCollections() (*ClusterCollectionsData, error) { FileCount: int64(volInfo.FileCount), TotalSize: int64(volInfo.Size), TTL: ttlStr, - DiskType: "hdd", // Default disk type + DiskTypes: []string{diskType}, Status: "active", } collectionMap[collectionName] = &newCollection diff --git a/weed/admin/static/js/admin.js b/weed/admin/static/js/admin.js index cefba4c9a..dfad11a88 100644 --- a/weed/admin/static/js/admin.js +++ b/weed/admin/static/js/admin.js @@ -698,14 +698,14 @@ function exportCollections() { return; } - const headers = ['Collection Name', 'Data Center', 'Replication', 'Volume Count', 'TTL', 'Disk Type', 'Status']; + const headers = ['Collection Name', 'Data Center', 'Replication', 'Volumes', 'Files', 'Size', 'TTL', 'Disk Types', 'Status']; const rows = []; // Get table rows const tableRows = table.querySelectorAll('tbody tr'); tableRows.forEach(row => { const cells = row.querySelectorAll('td'); - if (cells.length >= 7) { + if (cells.length >= 9) { rows.push([ cells[0].textContent.trim(), cells[1].textContent.trim(), @@ -713,7 +713,9 @@ function exportCollections() { cells[3].textContent.trim(), cells[4].textContent.trim(), cells[5].textContent.trim(), - cells[6].textContent.trim() + cells[6].textContent.trim(), + cells[7].textContent.trim(), + cells[8].textContent.trim() ]); } }); diff --git a/weed/admin/view/app/cluster_collections.templ b/weed/admin/view/app/cluster_collections.templ index 1eecb7b7d..5e877fb53 100644 --- a/weed/admin/view/app/cluster_collections.templ +++ b/weed/admin/view/app/cluster_collections.templ @@ -169,7 +169,7 @@ templ ClusterCollections(data dash.ClusterCollectionsData) {
Collection Name | Data Center | Replication | Volumes | Files | Size | TTL | Disk Type | Status | Actions |
---|
Collection Name | Data Center | Replication | Volumes | Files | Size | TTL | Disk Types | Status | Actions | ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, " | ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var15 string - templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(collection.DiskType) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/cluster_collections.templ`, Line: 215, Col: 97} + for i, diskType := range collection.DiskTypes { + if i > 0 { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var15 = []any{fmt.Sprintf("badge bg-%s me-1", getDiskTypeColor(diskType))} + templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var15...) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var17 string + templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(diskType) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/cluster_collections.templ`, Line: 219, Col: 131} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err + if len(collection.DiskTypes) == 0 { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "Unknown") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, " | ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, " | ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var16 = []any{fmt.Sprintf("badge bg-%s", getStatusColor(collection.Status))} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var16...) + var templ_7745c5c3_Var18 = []any{fmt.Sprintf("badge bg-%s", getStatusColor(collection.Status))} + templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var18...) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var18 string - templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(collection.Status) + var templ_7745c5c3_Var20 string + templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(collection.Status) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/cluster_collections.templ`, Line: 219, Col: 66} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/app/cluster_collections.templ`, Line: 227, Col: 66} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, " |
---|
No collections are currently configured in the cluster.
No collections are currently configured in the cluster.