diff --git a/backend/app/service/container_volume.go b/backend/app/service/container_volume.go index af47203f6..d2005e19a 100644 --- a/backend/app/service/container_volume.go +++ b/backend/app/service/container_volume.go @@ -9,6 +9,7 @@ import ( "github.com/1Panel-dev/1Panel/backend/app/dto" "github.com/1Panel-dev/1Panel/backend/buserr" "github.com/1Panel-dev/1Panel/backend/constant" + "github.com/1Panel-dev/1Panel/backend/utils/common" "github.com/1Panel-dev/1Panel/backend/utils/docker" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/volume" @@ -51,15 +52,20 @@ func (u *ContainerService) PageVolume(req dto.SearchWithPage) (int64, interface{ records = list.Volumes[start:end] } + nyc, _ := time.LoadLocation(common.LoadTimeZone()) for _, item := range records { tag := make([]string, 0) for _, val := range item.Labels { tag = append(tag, val) } - if len(item.CreatedAt) > 19 { - item.CreatedAt = item.CreatedAt[0:19] + var createTime time.Time + if strings.Contains(item.CreatedAt, "Z") { + createTime, _ = time.ParseInLocation("2006-01-02T15:04:05Z", item.CreatedAt, nyc) + } else if strings.Contains(item.CreatedAt, "+") { + createTime, _ = time.ParseInLocation("2006-01-02T15:04:05+08:00", item.CreatedAt, nyc) + } else { + createTime, _ = time.ParseInLocation("2006-01-02T15:04:05", item.CreatedAt, nyc) } - createTime, _ := time.Parse("2006-01-02T15:04:05", item.CreatedAt) data = append(data, dto.Volume{ CreatedAt: createTime, Name: item.Name, diff --git a/backend/app/service/file.go b/backend/app/service/file.go index 7545588b4..71db41c89 100644 --- a/backend/app/service/file.go +++ b/backend/app/service/file.go @@ -332,7 +332,7 @@ func (f *FileService) ReadLogByLine(req request.FileReadByLineReq) (*response.Fi logFilePath = ssl.GetLogPath() case constant.TypeSystem: fileName := "" - if req.Name == time.Now().Format("2006-01-02") { + if len(req.Name) == 0 || req.Name == time.Now().Format("2006-01-02") { fileName = "1Panel.log" } else { fileName = "1Panel-" + req.Name + ".log" diff --git a/backend/app/service/image.go b/backend/app/service/image.go index 452231407..82957545b 100644 --- a/backend/app/service/image.go +++ b/backend/app/service/image.go @@ -391,7 +391,7 @@ func (u *ImageService) ImageRemove(req dto.BatchDelete) error { } for _, id := range req.Names { if _, err := client.ImageRemove(context.TODO(), id, types.ImageRemoveOptions{Force: req.Force, PruneChildren: true}); err != nil { - if strings.Contains(err.Error(), "image is being used") { + if strings.Contains(err.Error(), "image is being used") || strings.Contains(err.Error(), "is using") { if strings.Contains(id, "sha256:") { return buserr.New(constant.ErrObjectInUsed) } diff --git a/frontend/src/views/container/container/log/index.vue b/frontend/src/views/container/container/log/index.vue index b3b979ec0..137222ac9 100644 --- a/frontend/src/views/container/container/log/index.vue +++ b/frontend/src/views/container/container/log/index.vue @@ -95,7 +95,7 @@ const globalStore = GlobalStore(); const terminalSocket = ref(); const logSearch = reactive({ - isWatch: false, + isWatch: true, container: '', containerID: '', mode: 'all', @@ -197,7 +197,7 @@ const acceptParams = (props: DialogProps): void => { logSearch.containerID = props.containerID; logSearch.tail = 100; logSearch.mode = 'all'; - logSearch.isWatch = false; + logSearch.isWatch = true; logSearch.container = props.container; searchLogs();