fix: Fix the issue of abnormal container list sorting (#11059)

This commit is contained in:
ssongliu 2025-11-25 11:17:34 +08:00 committed by GitHub
parent e88fe0ac2f
commit 6d4c1f8e79
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 13 additions and 19 deletions

View file

@ -1785,10 +1785,7 @@ func searchWithFilter(req dto.PageContainer, containers []container.Summary) []d
} }
} }
sort.Slice(records, func(i, j int) bool { sort.Slice(records, func(i, j int) bool {
if records[i].IsPinned == records[j].IsPinned { return records[i].IsPinned && !records[j].IsPinned
return list[i].Created > list[j].Created
}
return records[i].IsPinned
}) })
return records return records
} }

View file

@ -138,10 +138,7 @@ func (u *ImageService) Page(req dto.PageImage) (int64, interface{}, error) {
} }
} }
sort.Slice(records, func(i, j int) bool { sort.Slice(records, func(i, j int) bool {
if records[i].IsPinned == records[j].IsPinned { return records[i].IsPinned && !records[j].IsPinned
return records[i].IsUsed
}
return records[i].IsPinned
}) })
total, start, end := len(records), (req.Page-1)*req.PageSize, req.Page*req.PageSize total, start, end := len(records), (req.Page-1)*req.PageSize, req.Page*req.PageSize
if start > total { if start > total {

View file

@ -2,8 +2,8 @@ package client
import ( import (
"crypto/tls" "crypto/tls"
"fmt"
"io" "io"
"net"
"net/http" "net/http"
"os" "os"
"path" "path"
@ -25,7 +25,7 @@ func NewWebDAVClient(vars map[string]interface{}) (*webDAVClient, error) {
username := loadParamFromVars("username", vars) username := loadParamFromVars("username", vars)
bucket := loadParamFromVars("bucket", vars) bucket := loadParamFromVars("bucket", vars)
url := net.JoinHostPort(address, port) url := fmt.Sprintf("%s:%s", address, port)
if len(port) == 0 { if len(port) == 0 {
url = address url = address
} }

View file

@ -2,7 +2,7 @@ package client
import ( import (
"crypto/tls" "crypto/tls"
"net" "fmt"
"net/http" "net/http"
"os" "os"
"path" "path"
@ -24,7 +24,7 @@ func NewWebDAVClient(vars map[string]interface{}) (*webDAVClient, error) {
username := loadParamFromVars("username", vars) username := loadParamFromVars("username", vars)
bucket := loadParamFromVars("bucket", vars) bucket := loadParamFromVars("bucket", vars)
url := net.JoinHostPort(address, port) url := fmt.Sprintf("%s:%s", address, port)
if len(port) == 0 { if len(port) == 0 {
url = address url = address
} }

View file

@ -93,7 +93,7 @@
:label="$t('commons.table.name')" :label="$t('commons.table.name')"
min-width="250" min-width="250"
prop="name" prop="name"
sortable sortable="custom"
fix fix
:fixed="mobile ? false : 'left'" :fixed="mobile ? false : 'left'"
show-overflow-tooltip show-overflow-tooltip
@ -125,7 +125,7 @@
min-width="180" min-width="180"
prop="imageName" prop="imageName"
/> />
<el-table-column :label="$t('commons.table.status')" min-width="150" prop="state" sortable> <el-table-column :label="$t('commons.table.status')" min-width="150" prop="state">
<template #default="{ row }"> <template #default="{ row }">
<el-dropdown placement="bottom"> <el-dropdown placement="bottom">
<Status :key="row.state" :status="row.state" :operate="true"></Status> <Status :key="row.state" :status="row.state" :operate="true"></Status>
@ -518,7 +518,7 @@ const changePinned = (row: any, isPinned: boolean) => {
id: row.containerID, id: row.containerID,
type: 'container', type: 'container',
detailType: '', detailType: '',
isPinned: !row.isPinned, isPinned: row.isPinned,
description: row.description || '', description: row.description || '',
}; };
if (isPinned) { if (isPinned) {

View file

@ -63,7 +63,7 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('commons.table.status')" prop="isUsed" width="100" sortable> <el-table-column :label="$t('commons.table.status')" prop="isUsed" width="100" sortable="custom">
<template #default="{ row }"> <template #default="{ row }">
<Status :status="row.isUsed ? 'used' : 'unused'" /> <Status :status="row.isUsed ? 'used' : 'unused'" />
</template> </template>
@ -71,7 +71,7 @@
<el-table-column <el-table-column
:label="$t('container.tag')" :label="$t('container.tag')"
prop="tags" prop="tags"
sortable sortable="custom"
min-width="160" min-width="160"
:width="mobile ? 400 : 'auto'" :width="mobile ? 400 : 'auto'"
fix fix
@ -88,13 +88,13 @@
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('container.size')" prop="size" min-width="60" fix sortable> <el-table-column :label="$t('container.size')" prop="size" min-width="60" fix sortable="custom">
<template #default="{ row }"> <template #default="{ row }">
{{ computeSize2(row.size) }} {{ computeSize2(row.size) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
sortable sortable="custom"
prop="createdAt" prop="createdAt"
min-width="80" min-width="80"
:label="$t('commons.table.date')" :label="$t('commons.table.date')"