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 {
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
}

View file

@ -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 {

View file

@ -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
}

View file

@ -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
}

View file

@ -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"
/>
<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 }">
<el-dropdown placement="bottom">
<Status :key="row.state" :status="row.state" :operate="true"></Status>
@ -518,7 +518,7 @@ const changePinned = (row: any, isPinned: boolean) => {
id: row.containerID,
type: 'container',
detailType: '',
isPinned: !row.isPinned,
isPinned: row.isPinned,
description: row.description || '',
};
if (isPinned) {

View file

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