Skip to content

Commit dd3c0aa

Browse files
committed
fix: Fix the issue where container details cannot be fully selected and copied
1 parent e867deb commit dd3c0aa

File tree

6 files changed

+12
-27
lines changed

6 files changed

+12
-27
lines changed

agent/app/service/container.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,9 +1786,9 @@ func searchWithFilter(req dto.PageContainer, containers []container.Summary) []d
17861786
}
17871787
records = append(records, info)
17881788
}
1789-
dscriptions, _ := settingRepo.GetDescriptionList(repo.WithByType("container"))
1789+
descriptions, _ := settingRepo.GetDescriptionList(repo.WithByType("container"))
17901790
for i := 0; i < len(records); i++ {
1791-
for _, desc := range dscriptions {
1791+
for _, desc := range descriptions {
17921792
if desc.ID == records[i].ContainerID {
17931793
records[i].Description = desc.Description
17941794
records[i].IsPinned = desc.IsPinned

agent/app/service/container_volume.go

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"sort"
66
"strings"
77
"time"
8-
"unicode"
98

109
"github.com/1Panel-dev/1Panel/agent/app/dto"
1110
"github.com/1Panel-dev/1Panel/agent/buserr"
@@ -57,7 +56,7 @@ func (u *ContainerService) PageVolume(req dto.SearchWithPage) (int64, interface{
5756
var volume dto.Volume
5857
volume.Driver = item.Driver
5958
volume.Mountpoint = item.Mountpoint
60-
volume.Name = simplifyVolumeName(item.Name)
59+
volume.Name = item.Name
6160
for key, val := range item.Labels {
6261
volume.Labels = append(volume.Labels, dto.VolumeOption{Key: key, Value: val})
6362
}
@@ -143,16 +142,3 @@ func (u *ContainerService) CreateVolume(req dto.VolumeCreate) error {
143142
}
144143
return nil
145144
}
146-
147-
func simplifyVolumeName(name string) string {
148-
if len(name) != 64 {
149-
return name
150-
}
151-
152-
for _, char := range name {
153-
if !unicode.Is(unicode.ASCII_Hex_Digit, char) {
154-
return name
155-
}
156-
}
157-
return name[:12]
158-
}

agent/app/service/cronjob_helper.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"io"
99
"net/http"
1010
"os"
11-
"path"
1211
pathUtils "path"
1312
"path/filepath"
1413
"strings"
@@ -147,7 +146,7 @@ func (u *CronjobService) handleShell(cronjob model.Cronjob, taskItem *task.Task)
147146
if len(cronjob.ContainerName) != 0 {
148147
scriptItem := cronjob.Script
149148
if cronjob.ScriptMode == "select" {
150-
scriptItem = path.Join("/tmp", path.Base(cronjob.Script))
149+
scriptItem = pathUtils.Join("/tmp", pathUtils.Base(cronjob.Script))
151150
if err := cmdMgr.Run("docker", "cp", cronjob.Script, cronjob.ContainerName+":"+scriptItem); err != nil {
152151
return err
153152
}
@@ -252,11 +251,11 @@ func (u *CronjobService) handleCleanLog(cronjob model.Cronjob, taskItem *task.Ta
252251
if appInstall.ID > 0 {
253252
curStr := i18n.GetWithName("CleanLogByName", "OpenResty")
254253
t.LogStart(curStr)
255-
accessLogPath := path.Join(appInstall.GetPath(), "log", "access.log")
254+
accessLogPath := pathUtils.Join(appInstall.GetPath(), "log", "access.log")
256255
if err := os.Truncate(accessLogPath, 0); err != nil {
257256
t.LogFailedWithErr(curStr, err)
258257
}
259-
errLogPath := path.Join(appInstall.GetPath(), "log", "error.log")
258+
errLogPath := pathUtils.Join(appInstall.GetPath(), "log", "error.log")
260259
if err := os.Truncate(errLogPath, 0); err != nil {
261260
t.LogFailedWithErr(curStr, err)
262261
}
@@ -274,8 +273,8 @@ func (u *CronjobService) handleSyncIpGroup(cronjob model.Cronjob, taskItem *task
274273
if err != nil {
275274
return err
276275
}
277-
ipGroupDir := path.Join(appInstall.GetPath(), "1pwaf", "data", "rules", "ip_group")
278-
urlDir := path.Join(ipGroupDir, "ip_group_url")
276+
ipGroupDir := pathUtils.Join(appInstall.GetPath(), "1pwaf", "data", "rules", "ip_group")
277+
urlDir := pathUtils.Join(ipGroupDir, "ip_group_url")
279278

280279
urlsFiles, err := os.ReadDir(urlDir)
281280
if err != nil {
@@ -471,7 +470,7 @@ func (u *CronjobService) removeExpiredLog(cronjob model.Cronjob) {
471470
}
472471
_ = cronjobRepo.DeleteRecord(repo.WithByID(records[i].ID))
473472
_ = taskRepo.Delete(taskRepo.WithByID(records[i].TaskID))
474-
_ = os.Remove(path.Join(global.CONF.Base.InstallDir, "1panel/log/task/Cronjob", records[i].TaskID+".log"))
473+
_ = os.Remove(pathUtils.Join(global.CONF.Base.InstallDir, "1panel/log/task/Cronjob", records[i].TaskID+".log"))
475474
}
476475
}
477476

frontend/src/components/codemirror-pro/drawer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<DrawerPro v-model="codeVisible" :header="header" size="large" @close="handleClose">
3-
<CodemirrorPro v-model="detailInfo" :height-diff="160" :disabled="true" :mode="mode"></CodemirrorPro>
3+
<CodemirrorPro v-model="detailInfo" :height-diff="160" :readonly="true" :mode="mode"></CodemirrorPro>
44
<template #footer>
55
<span class="dialog-footer">
66
<el-button @click="codeVisible = false">{{ $t('commons.button.cancel') }}</el-button>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@
154154
{{ $t('commons.button.copy') }}
155155
</el-button>
156156
</div>
157-
<CodemirrorPro v-model="rawJson" :height-diff="240" :readonly="true" mode="json" />
157+
<CodemirrorPro v-model="rawJson" :height-diff="270" :readonly="true" mode="json" />
158158
</el-tab-pane>
159159
</el-tabs>
160160

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
{{ $t('commons.button.copy') }}
9999
</el-button>
100100
</div>
101-
<CodemirrorPro v-model="rawJson" :height-diff="240" :readonly="true" mode="json" />
101+
<CodemirrorPro v-model="rawJson" :height-diff="270" :readonly="true" mode="json" />
102102
</el-tab-pane>
103103
</el-tabs>
104104

0 commit comments

Comments
 (0)