From 614570a4c756fb41b92d19727c4a81055a74a676 Mon Sep 17 00:00:00 2001 From: ssongliu Date: Fri, 2 Dec 2022 14:09:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=9B=E5=BB=BA=E5=AE=B9=E5=99=A8?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=97=B6=EF=BC=8C=E5=88=A0=E9=99=A4=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E5=AE=B9=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/container.go | 2 ++ frontend/src/views/cronjob/operate/index.vue | 3 +++ 2 files changed, 5 insertions(+) diff --git a/backend/app/service/container.go b/backend/app/service/container.go index 840e4ae67..0c311566b 100644 --- a/backend/app/service/container.go +++ b/backend/app/service/container.go @@ -157,9 +157,11 @@ func (u *ContainerService) ContainerCreate(req dto.ContainerCreate) error { } container, err := client.ContainerCreate(context.TODO(), config, hostConf, &network.NetworkingConfig{}, &v1.Platform{}, req.Name) if err != nil { + _ = client.ContainerRemove(context.Background(), req.Name, types.ContainerRemoveOptions{RemoveVolumes: true, Force: true}) return err } if err := client.ContainerStart(context.TODO(), container.ID, types.ContainerStartOptions{}); err != nil { + _ = client.ContainerRemove(context.Background(), req.Name, types.ContainerRemoveOptions{RemoveVolumes: true, Force: true}) return fmt.Errorf("create successful but start failed, err: %v", err) } return nil diff --git a/frontend/src/views/cronjob/operate/index.vue b/frontend/src/views/cronjob/operate/index.vue index b3e92e415..82db28fd4 100644 --- a/frontend/src/views/cronjob/operate/index.vue +++ b/frontend/src/views/cronjob/operate/index.vue @@ -298,6 +298,9 @@ const loadBackups = async () => { for (const item of res.data) { if (item.type === 'LOCAL') { localDirID.value = item.id; + if (!dialogData.value.rowData!.targetDirID) { + dialogData.value.rowData!.targetDirID = item.id; + } } backupOptions.value.push({ label: loadBackupName(item.type), value: item.id }); }