Skip to content

Commit efac1be

Browse files
committed
fix: Fix the issue of abnormal container list sorting
1 parent e88fe0a commit efac1be

File tree

6 files changed

+14
-19
lines changed

6 files changed

+14
-19
lines changed

agent/app/service/container.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,10 +1785,7 @@ func searchWithFilter(req dto.PageContainer, containers []container.Summary) []d
17851785
}
17861786
}
17871787
sort.Slice(records, func(i, j int) bool {
1788-
if records[i].IsPinned == records[j].IsPinned {
1789-
return list[i].Created > list[j].Created
1790-
}
1791-
return records[i].IsPinned
1788+
return records[i].IsPinned && !records[j].IsPinned
17921789
})
17931790
return records
17941791
}

agent/app/service/image.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,7 @@ func (u *ImageService) Page(req dto.PageImage) (int64, interface{}, error) {
138138
}
139139
}
140140
sort.Slice(records, func(i, j int) bool {
141-
if records[i].IsPinned == records[j].IsPinned {
142-
return records[i].IsUsed
143-
}
144-
return records[i].IsPinned
141+
return records[i].IsPinned && !records[j].IsPinned
145142
})
146143
total, start, end := len(records), (req.Page-1)*req.PageSize, req.Page*req.PageSize
147144
if start > total {

agent/utils/cloud_storage/client/webdav.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package client
22

33
import (
44
"crypto/tls"
5+
"fmt"
56
"io"
6-
"net"
77
"net/http"
88
"os"
99
"path"
@@ -25,7 +25,7 @@ func NewWebDAVClient(vars map[string]interface{}) (*webDAVClient, error) {
2525
username := loadParamFromVars("username", vars)
2626
bucket := loadParamFromVars("bucket", vars)
2727

28-
url := net.JoinHostPort(address, port)
28+
url := fmt.Sprintf("%s:%s", address, port)
2929
if len(port) == 0 {
3030
url = address
3131
}

core/utils/cloud_storage/client/webdav.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package client
22

33
import (
44
"crypto/tls"
5-
"net"
5+
"fmt"
66
"net/http"
77
"os"
88
"path"
@@ -24,7 +24,7 @@ func NewWebDAVClient(vars map[string]interface{}) (*webDAVClient, error) {
2424
username := loadParamFromVars("username", vars)
2525
bucket := loadParamFromVars("bucket", vars)
2626

27-
url := net.JoinHostPort(address, port)
27+
url := fmt.Sprintf("%s:%s", address, port)
2828
if len(port) == 0 {
2929
url = address
3030
}

frontend/src/views/container/container/index.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
:label="$t('commons.table.name')"
9494
min-width="250"
9595
prop="name"
96-
sortable
96+
sortable="custom"
9797
fix
9898
:fixed="mobile ? false : 'left'"
9999
show-overflow-tooltip
@@ -125,7 +125,7 @@
125125
min-width="180"
126126
prop="imageName"
127127
/>
128-
<el-table-column :label="$t('commons.table.status')" min-width="150" prop="state" sortable>
128+
<el-table-column :label="$t('commons.table.status')" min-width="150" prop="state">
129129
<template #default="{ row }">
130130
<el-dropdown placement="bottom">
131131
<Status :key="row.state" :status="row.state" :operate="true"></Status>
@@ -489,6 +489,7 @@ const search = async (column?: any) => {
489489
.then((res) => {
490490
loading.value = false;
491491
data.value = res.data.items || [];
492+
console.log(data.value);
492493
paginationConfig.total = res.data.total;
493494
})
494495
.catch(() => {
@@ -518,7 +519,7 @@ const changePinned = (row: any, isPinned: boolean) => {
518519
id: row.containerID,
519520
type: 'container',
520521
detailType: '',
521-
isPinned: !row.isPinned,
522+
isPinned: row.isPinned,
522523
description: row.description || '',
523524
};
524525
if (isPinned) {

frontend/src/views/container/image/index.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@
6363
</div>
6464
</template>
6565
</el-table-column>
66-
<el-table-column :label="$t('commons.table.status')" prop="isUsed" width="100" sortable>
66+
<el-table-column :label="$t('commons.table.status')" prop="isUsed" width="100" sortable="custom">
6767
<template #default="{ row }">
6868
<Status :status="row.isUsed ? 'used' : 'unused'" />
6969
</template>
7070
</el-table-column>
7171
<el-table-column
7272
:label="$t('container.tag')"
7373
prop="tags"
74-
sortable
74+
sortable="custom"
7575
min-width="160"
7676
:width="mobile ? 400 : 'auto'"
7777
fix
@@ -88,13 +88,13 @@
8888
</el-tag>
8989
</template>
9090
</el-table-column>
91-
<el-table-column :label="$t('container.size')" prop="size" min-width="60" fix sortable>
91+
<el-table-column :label="$t('container.size')" prop="size" min-width="60" fix sortable="custom">
9292
<template #default="{ row }">
9393
{{ computeSize2(row.size) }}
9494
</template>
9595
</el-table-column>
9696
<el-table-column
97-
sortable
97+
sortable="custom"
9898
prop="createdAt"
9999
min-width="80"
100100
:label="$t('commons.table.date')"

0 commit comments

Comments
 (0)