Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions agent/app/service/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -1686,7 +1686,7 @@
return exposedPorts
}

func searchWithFilter(req dto.PageContainer, containers []container.Summary) []dto.ContainerInfo {

Check failure on line 1689 in agent/app/service/container.go

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this method to reduce its Cognitive Complexity from 49 to the 15 allowed.

See more on https://sonarcloud.io/project/issues?id=1Panel-dev_1Panel&issues=AZq4u9Q90C4CwrwAmYIE&open=AZq4u9Q90C4CwrwAmYIE&pullRequest=11059
var (
records []dto.ContainerInfo
list []container.Summary
Expand Down Expand Up @@ -1785,10 +1785,7 @@
}
}
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
}
5 changes: 1 addition & 4 deletions agent/app/service/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
func NewIImageService() IImageService {
return &ImageService{}
}
func (u *ImageService) Page(req dto.PageImage) (int64, interface{}, error) {

Check failure on line 53 in agent/app/service/image.go

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this method to reduce its Cognitive Complexity from 45 to the 15 allowed.

See more on https://sonarcloud.io/project/issues?id=1Panel-dev_1Panel&issues=AZq4u9Ui0C4CwrwAmYIF&open=AZq4u9Ui0C4CwrwAmYIF&pullRequest=11059
var (
list []image.Summary
records []dto.ImageInfo
Expand Down Expand Up @@ -138,10 +138,7 @@
}
}
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 {
Expand Down
4 changes: 2 additions & 2 deletions agent/utils/cloud_storage/client/webdav.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package client

import (
"crypto/tls"
"fmt"
"io"
"net"
"net/http"
"os"
"path"
Expand All @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions core/utils/cloud_storage/client/webdav.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package client

import (
"crypto/tls"
"net"
"fmt"
"net/http"
"os"
"path"
Expand All @@ -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
}
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/views/container/container/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/views/container/image/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@
</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>
</el-table-column>
<el-table-column
:label="$t('container.tag')"
prop="tags"
sortable
sortable="custom"
min-width="160"
:width="mobile ? 400 : 'auto'"
fix
Expand All @@ -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')"
Expand Down
Loading