aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2025-11-01 13:08:29 -0700
committerchrislu <chris.lu@gmail.com>2025-11-01 13:08:29 -0700
commitc56a0a0ebdffbf5e35583385334a0cd3ccb1ef5f (patch)
tree6de91c8dd155ab8d5b1f836cb6b0276861e06c88
parentfb46a8a61fc6e1ba399d54d893a64d856d1b96a8 (diff)
downloadseaweedfs-c56a0a0ebdffbf5e35583385334a0cd3ccb1ef5f.tar.xz
seaweedfs-c56a0a0ebdffbf5e35583385334a0cd3ccb1ef5f.zip
fix: handle 'default' collection filter in cluster volumes page
- Update matchesCollection to recognize 'default' as filter for empty collection - Remove incorrect conversion of 'default' to empty string in handlers - Fixes issue where ?collection=default would show all collections instead of just default collection
-rw-r--r--weed/admin/dash/ec_shard_management.go4
-rw-r--r--weed/admin/handlers/cluster_handlers.go8
2 files changed, 3 insertions, 9 deletions
diff --git a/weed/admin/dash/ec_shard_management.go b/weed/admin/dash/ec_shard_management.go
index 82aa4074d..330d89fd5 100644
--- a/weed/admin/dash/ec_shard_management.go
+++ b/weed/admin/dash/ec_shard_management.go
@@ -16,8 +16,8 @@ import (
// matchesCollection checks if a volume/EC volume collection matches the filter collection.
// Handles the special case where empty collection ("") represents the "default" collection.
func matchesCollection(volumeCollection, filterCollection string) bool {
- // Both empty means default collection matches default filter
- if volumeCollection == "" && filterCollection == "" {
+ // Handle special case where "default" filter matches empty collection
+ if filterCollection == "default" && volumeCollection == "" {
return true
}
// Direct string match for named collections
diff --git a/weed/admin/handlers/cluster_handlers.go b/weed/admin/handlers/cluster_handlers.go
index 1a58e919d..9034ed688 100644
--- a/weed/admin/handlers/cluster_handlers.go
+++ b/weed/admin/handlers/cluster_handlers.go
@@ -170,12 +170,6 @@ func (h *ClusterHandlers) ShowCollectionDetails(c *gin.Context) {
return
}
- // Map "default" collection to empty string for backend filtering
- actualCollectionName := collectionName
- if collectionName == "default" {
- actualCollectionName = ""
- }
-
// Parse query parameters
page, _ := strconv.Atoi(c.DefaultQuery("page", "1"))
pageSize, _ := strconv.Atoi(c.DefaultQuery("page_size", "25"))
@@ -183,7 +177,7 @@ func (h *ClusterHandlers) ShowCollectionDetails(c *gin.Context) {
sortOrder := c.DefaultQuery("sort_order", "asc")
// Get collection details data (volumes and EC volumes)
- collectionDetailsData, err := h.adminServer.GetCollectionDetails(actualCollectionName, page, pageSize, sortBy, sortOrder)
+ collectionDetailsData, err := h.adminServer.GetCollectionDetails(collectionName, page, pageSize, sortBy, sortOrder)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to get collection details: " + err.Error()})
return