mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-01-09 16:44:21 +08:00
fix: Fix the issue where container details cannot be fully selected and copied (#11144)
This commit is contained in:
parent
e867deb547
commit
a5d86d4c00
6 changed files with 12 additions and 27 deletions
|
|
@ -1786,9 +1786,9 @@ func searchWithFilter(req dto.PageContainer, containers []container.Summary) []d
|
|||
}
|
||||
records = append(records, info)
|
||||
}
|
||||
dscriptions, _ := settingRepo.GetDescriptionList(repo.WithByType("container"))
|
||||
descriptions, _ := settingRepo.GetDescriptionList(repo.WithByType("container"))
|
||||
for i := 0; i < len(records); i++ {
|
||||
for _, desc := range dscriptions {
|
||||
for _, desc := range descriptions {
|
||||
if desc.ID == records[i].ContainerID {
|
||||
records[i].Description = desc.Description
|
||||
records[i].IsPinned = desc.IsPinned
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import (
|
|||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode"
|
||||
|
||||
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
||||
"github.com/1Panel-dev/1Panel/agent/buserr"
|
||||
|
|
@ -57,7 +56,7 @@ func (u *ContainerService) PageVolume(req dto.SearchWithPage) (int64, interface{
|
|||
var volume dto.Volume
|
||||
volume.Driver = item.Driver
|
||||
volume.Mountpoint = item.Mountpoint
|
||||
volume.Name = simplifyVolumeName(item.Name)
|
||||
volume.Name = item.Name
|
||||
for key, val := range item.Labels {
|
||||
volume.Labels = append(volume.Labels, dto.VolumeOption{Key: key, Value: val})
|
||||
}
|
||||
|
|
@ -143,16 +142,3 @@ func (u *ContainerService) CreateVolume(req dto.VolumeCreate) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func simplifyVolumeName(name string) string {
|
||||
if len(name) != 64 {
|
||||
return name
|
||||
}
|
||||
|
||||
for _, char := range name {
|
||||
if !unicode.Is(unicode.ASCII_Hex_Digit, char) {
|
||||
return name
|
||||
}
|
||||
}
|
||||
return name[:12]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import (
|
|||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
pathUtils "path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
|
@ -147,7 +146,7 @@ func (u *CronjobService) handleShell(cronjob model.Cronjob, taskItem *task.Task)
|
|||
if len(cronjob.ContainerName) != 0 {
|
||||
scriptItem := cronjob.Script
|
||||
if cronjob.ScriptMode == "select" {
|
||||
scriptItem = path.Join("/tmp", path.Base(cronjob.Script))
|
||||
scriptItem = pathUtils.Join("/tmp", pathUtils.Base(cronjob.Script))
|
||||
if err := cmdMgr.Run("docker", "cp", cronjob.Script, cronjob.ContainerName+":"+scriptItem); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -252,11 +251,11 @@ func (u *CronjobService) handleCleanLog(cronjob model.Cronjob, taskItem *task.Ta
|
|||
if appInstall.ID > 0 {
|
||||
curStr := i18n.GetWithName("CleanLogByName", "OpenResty")
|
||||
t.LogStart(curStr)
|
||||
accessLogPath := path.Join(appInstall.GetPath(), "log", "access.log")
|
||||
accessLogPath := pathUtils.Join(appInstall.GetPath(), "log", "access.log")
|
||||
if err := os.Truncate(accessLogPath, 0); err != nil {
|
||||
t.LogFailedWithErr(curStr, err)
|
||||
}
|
||||
errLogPath := path.Join(appInstall.GetPath(), "log", "error.log")
|
||||
errLogPath := pathUtils.Join(appInstall.GetPath(), "log", "error.log")
|
||||
if err := os.Truncate(errLogPath, 0); err != nil {
|
||||
t.LogFailedWithErr(curStr, err)
|
||||
}
|
||||
|
|
@ -274,8 +273,8 @@ func (u *CronjobService) handleSyncIpGroup(cronjob model.Cronjob, taskItem *task
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ipGroupDir := path.Join(appInstall.GetPath(), "1pwaf", "data", "rules", "ip_group")
|
||||
urlDir := path.Join(ipGroupDir, "ip_group_url")
|
||||
ipGroupDir := pathUtils.Join(appInstall.GetPath(), "1pwaf", "data", "rules", "ip_group")
|
||||
urlDir := pathUtils.Join(ipGroupDir, "ip_group_url")
|
||||
|
||||
urlsFiles, err := os.ReadDir(urlDir)
|
||||
if err != nil {
|
||||
|
|
@ -471,7 +470,7 @@ func (u *CronjobService) removeExpiredLog(cronjob model.Cronjob) {
|
|||
}
|
||||
_ = cronjobRepo.DeleteRecord(repo.WithByID(records[i].ID))
|
||||
_ = taskRepo.Delete(taskRepo.WithByID(records[i].TaskID))
|
||||
_ = os.Remove(path.Join(global.CONF.Base.InstallDir, "1panel/log/task/Cronjob", records[i].TaskID+".log"))
|
||||
_ = os.Remove(pathUtils.Join(global.CONF.Base.InstallDir, "1panel/log/task/Cronjob", records[i].TaskID+".log"))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<DrawerPro v-model="codeVisible" :header="header" size="large" @close="handleClose">
|
||||
<CodemirrorPro v-model="detailInfo" :height-diff="160" :disabled="true" :mode="mode"></CodemirrorPro>
|
||||
<CodemirrorPro v-model="detailInfo" :height-diff="160" :readonly="true" :mode="mode"></CodemirrorPro>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="codeVisible = false">{{ $t('commons.button.cancel') }}</el-button>
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@
|
|||
{{ $t('commons.button.copy') }}
|
||||
</el-button>
|
||||
</div>
|
||||
<CodemirrorPro v-model="rawJson" :height-diff="240" :readonly="true" mode="json" />
|
||||
<CodemirrorPro v-model="rawJson" :height-diff="270" :readonly="true" mode="json" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@
|
|||
{{ $t('commons.button.copy') }}
|
||||
</el-button>
|
||||
</div>
|
||||
<CodemirrorPro v-model="rawJson" :height-diff="240" :readonly="true" mode="json" />
|
||||
<CodemirrorPro v-model="rawJson" :height-diff="270" :readonly="true" mode="json" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue