diff --git a/backend/app/service/container.go b/backend/app/service/container.go index df67ff999..840e4ae67 100644 --- a/backend/app/service/container.go +++ b/backend/app/service/container.go @@ -188,7 +188,7 @@ func (u *ContainerService) ContainerOperation(req dto.ContainerOperation) error case constant.ContainerOpRename: err = client.ContainerRename(ctx, req.ContainerID, req.NewName) case constant.ContainerOpRemove: - err = client.ContainerRemove(ctx, req.ContainerID, types.ContainerRemoveOptions{RemoveVolumes: true, RemoveLinks: true, Force: true}) + err = client.ContainerRemove(ctx, req.ContainerID, types.ContainerRemoveOptions{RemoveVolumes: true, Force: true}) } return err } diff --git a/frontend/src/api/interface/container.ts b/frontend/src/api/interface/container.ts index 778ecb9c5..c4eaf791b 100644 --- a/frontend/src/api/interface/container.ts +++ b/frontend/src/api/interface/container.ts @@ -102,6 +102,7 @@ export namespace Container { export interface NetworkInfo { id: string; name: string; + isSystem: boolean; labels: Array; driver: string; ipamDriver: string; diff --git a/frontend/src/components/confirm-dialog/index.vue b/frontend/src/components/confirm-dialog/index.vue index 7f6b2ece6..89fc712c5 100644 --- a/frontend/src/components/confirm-dialog/index.vue +++ b/frontend/src/components/confirm-dialog/index.vue @@ -7,9 +7,11 @@
{{ operationInfo }} - - {{ $t('commons.msg.operateConfirm') }} - '{{ submitInputInfo }}' +
+ {{ $t('commons.msg.operateConfirm') }} + '{{ submitInputInfo }}' +
+
- + @@ -81,6 +82,10 @@ const onCreate = async () => { dialogCreateRef.value!.acceptParams(); }; +function selectable(row) { + return !row.isSystem; +} + const search = async () => { const params = { page: paginationConfig.page, @@ -89,6 +94,9 @@ const search = async () => { await searchNetwork(params).then((res) => { if (res.data) { data.value = res.data.items; + for (const item of data.value) { + item.isSystem = isSystem(item.name); + } } paginationConfig.total = res.data.total; }); @@ -117,12 +125,19 @@ const onInspect = async (id: string) => { codemirror.value!.acceptParams(param); }; +function isSystem(val: string) { + return val === 'bridge' || val === '1panel' || val === 'none' || val === 'host'; +} + const buttons = [ { label: i18n.global.t('commons.button.delete'), click: (row: Container.NetworkInfo) => { batchDelete(row); }, + disabled: (row: any) => { + return row.isSystem; + }, }, ]; diff --git a/frontend/src/views/login/components/login-form.vue b/frontend/src/views/login/components/login-form.vue index 216411740..1fe6e4b8a 100644 --- a/frontend/src/views/login/components/login-form.vue +++ b/frontend/src/views/login/components/login-form.vue @@ -66,9 +66,6 @@