mirror of https://github.com/1Panel-dev/1Panel
parent
a09fd97b10
commit
86d5a68cd6
|
@ -9,6 +9,7 @@ import (
|
||||||
"github.com/1Panel-dev/1Panel/backend/app/dto"
|
"github.com/1Panel-dev/1Panel/backend/app/dto"
|
||||||
"github.com/1Panel-dev/1Panel/backend/buserr"
|
"github.com/1Panel-dev/1Panel/backend/buserr"
|
||||||
"github.com/1Panel-dev/1Panel/backend/constant"
|
"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/1Panel-dev/1Panel/backend/utils/docker"
|
||||||
"github.com/docker/docker/api/types/filters"
|
"github.com/docker/docker/api/types/filters"
|
||||||
"github.com/docker/docker/api/types/volume"
|
"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]
|
records = list.Volumes[start:end]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nyc, _ := time.LoadLocation(common.LoadTimeZone())
|
||||||
for _, item := range records {
|
for _, item := range records {
|
||||||
tag := make([]string, 0)
|
tag := make([]string, 0)
|
||||||
for _, val := range item.Labels {
|
for _, val := range item.Labels {
|
||||||
tag = append(tag, val)
|
tag = append(tag, val)
|
||||||
}
|
}
|
||||||
if len(item.CreatedAt) > 19 {
|
var createTime time.Time
|
||||||
item.CreatedAt = item.CreatedAt[0:19]
|
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{
|
data = append(data, dto.Volume{
|
||||||
CreatedAt: createTime,
|
CreatedAt: createTime,
|
||||||
Name: item.Name,
|
Name: item.Name,
|
||||||
|
|
|
@ -332,7 +332,7 @@ func (f *FileService) ReadLogByLine(req request.FileReadByLineReq) (*response.Fi
|
||||||
logFilePath = ssl.GetLogPath()
|
logFilePath = ssl.GetLogPath()
|
||||||
case constant.TypeSystem:
|
case constant.TypeSystem:
|
||||||
fileName := ""
|
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"
|
fileName = "1Panel.log"
|
||||||
} else {
|
} else {
|
||||||
fileName = "1Panel-" + req.Name + ".log"
|
fileName = "1Panel-" + req.Name + ".log"
|
||||||
|
|
|
@ -391,7 +391,7 @@ func (u *ImageService) ImageRemove(req dto.BatchDelete) error {
|
||||||
}
|
}
|
||||||
for _, id := range req.Names {
|
for _, id := range req.Names {
|
||||||
if _, err := client.ImageRemove(context.TODO(), id, types.ImageRemoveOptions{Force: req.Force, PruneChildren: true}); err != nil {
|
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:") {
|
if strings.Contains(id, "sha256:") {
|
||||||
return buserr.New(constant.ErrObjectInUsed)
|
return buserr.New(constant.ErrObjectInUsed)
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ const globalStore = GlobalStore();
|
||||||
const terminalSocket = ref<WebSocket>();
|
const terminalSocket = ref<WebSocket>();
|
||||||
|
|
||||||
const logSearch = reactive({
|
const logSearch = reactive({
|
||||||
isWatch: false,
|
isWatch: true,
|
||||||
container: '',
|
container: '',
|
||||||
containerID: '',
|
containerID: '',
|
||||||
mode: 'all',
|
mode: 'all',
|
||||||
|
@ -197,7 +197,7 @@ const acceptParams = (props: DialogProps): void => {
|
||||||
logSearch.containerID = props.containerID;
|
logSearch.containerID = props.containerID;
|
||||||
logSearch.tail = 100;
|
logSearch.tail = 100;
|
||||||
logSearch.mode = 'all';
|
logSearch.mode = 'all';
|
||||||
logSearch.isWatch = false;
|
logSearch.isWatch = true;
|
||||||
logSearch.container = props.container;
|
logSearch.container = props.container;
|
||||||
searchLogs();
|
searchLogs();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue