From 6d4c1f8e794cfa8a62aed848b85aaefbba957b50 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Tue, 25 Nov 2025 11:17:34 +0800 Subject: [PATCH] fix: Fix the issue of abnormal container list sorting (#11059) --- agent/app/service/container.go | 5 +---- agent/app/service/image.go | 5 +---- agent/utils/cloud_storage/client/webdav.go | 4 ++-- core/utils/cloud_storage/client/webdav.go | 4 ++-- frontend/src/views/container/container/index.vue | 6 +++--- frontend/src/views/container/image/index.vue | 8 ++++---- 6 files changed, 13 insertions(+), 19 deletions(-) diff --git a/agent/app/service/container.go b/agent/app/service/container.go index 29d1e8eaa..33c0fb777 100644 --- a/agent/app/service/container.go +++ b/agent/app/service/container.go @@ -1785,10 +1785,7 @@ func searchWithFilter(req dto.PageContainer, containers []container.Summary) []d } } sort.Slice(records, func(i, j int) bool { - if records[i].IsPinned == records[j].IsPinned { - return list[i].Created > list[j].Created - } - return records[i].IsPinned + return records[i].IsPinned && !records[j].IsPinned }) return records } diff --git a/agent/app/service/image.go b/agent/app/service/image.go index c0b38a4f3..25509cfe9 100644 --- a/agent/app/service/image.go +++ b/agent/app/service/image.go @@ -138,10 +138,7 @@ func (u *ImageService) Page(req dto.PageImage) (int64, interface{}, error) { } } sort.Slice(records, func(i, j int) bool { - if records[i].IsPinned == records[j].IsPinned { - return records[i].IsUsed - } - return records[i].IsPinned + return records[i].IsPinned && !records[j].IsPinned }) total, start, end := len(records), (req.Page-1)*req.PageSize, req.Page*req.PageSize if start > total { diff --git a/agent/utils/cloud_storage/client/webdav.go b/agent/utils/cloud_storage/client/webdav.go index f82d467fc..a7f581654 100644 --- a/agent/utils/cloud_storage/client/webdav.go +++ b/agent/utils/cloud_storage/client/webdav.go @@ -2,8 +2,8 @@ package client import ( "crypto/tls" + "fmt" "io" - "net" "net/http" "os" "path" @@ -25,7 +25,7 @@ func NewWebDAVClient(vars map[string]interface{}) (*webDAVClient, error) { username := loadParamFromVars("username", vars) bucket := loadParamFromVars("bucket", vars) - url := net.JoinHostPort(address, port) + url := fmt.Sprintf("%s:%s", address, port) if len(port) == 0 { url = address } diff --git a/core/utils/cloud_storage/client/webdav.go b/core/utils/cloud_storage/client/webdav.go index c0c032a47..f83ecb1a3 100644 --- a/core/utils/cloud_storage/client/webdav.go +++ b/core/utils/cloud_storage/client/webdav.go @@ -2,7 +2,7 @@ package client import ( "crypto/tls" - "net" + "fmt" "net/http" "os" "path" @@ -24,7 +24,7 @@ func NewWebDAVClient(vars map[string]interface{}) (*webDAVClient, error) { username := loadParamFromVars("username", vars) bucket := loadParamFromVars("bucket", vars) - url := net.JoinHostPort(address, port) + url := fmt.Sprintf("%s:%s", address, port) if len(port) == 0 { url = address } diff --git a/frontend/src/views/container/container/index.vue b/frontend/src/views/container/container/index.vue index 96b18cf5b..5b8d473df 100644 --- a/frontend/src/views/container/container/index.vue +++ b/frontend/src/views/container/container/index.vue @@ -93,7 +93,7 @@ :label="$t('commons.table.name')" min-width="250" prop="name" - sortable + sortable="custom" fix :fixed="mobile ? false : 'left'" show-overflow-tooltip @@ -125,7 +125,7 @@ min-width="180" prop="imageName" /> - + - + @@ -71,7 +71,7 @@ - +