mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-31 14:08:06 +08:00
fix: 修复非运行状态容器删除失败的问题
This commit is contained in:
parent
9f5cc07e9f
commit
9fcd3c78e1
@ -188,7 +188,7 @@ func (u *ContainerService) ContainerOperation(req dto.ContainerOperation) error
|
|||||||
case constant.ContainerOpRename:
|
case constant.ContainerOpRename:
|
||||||
err = client.ContainerRename(ctx, req.ContainerID, req.NewName)
|
err = client.ContainerRename(ctx, req.ContainerID, req.NewName)
|
||||||
case constant.ContainerOpRemove:
|
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
|
return err
|
||||||
}
|
}
|
||||||
|
@ -102,6 +102,7 @@ export namespace Container {
|
|||||||
export interface NetworkInfo {
|
export interface NetworkInfo {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
isSystem: boolean;
|
||||||
labels: Array<string>;
|
labels: Array<string>;
|
||||||
driver: string;
|
driver: string;
|
||||||
ipamDriver: string;
|
ipamDriver: string;
|
||||||
|
@ -7,9 +7,11 @@
|
|||||||
</template>
|
</template>
|
||||||
<div>
|
<div>
|
||||||
<span style="font-size: 12px">{{ operationInfo }}</span>
|
<span style="font-size: 12px">{{ operationInfo }}</span>
|
||||||
<el-input v-model="submitInput"></el-input>
|
<div style="margin-top: 10px">
|
||||||
<span style="font-size: 12px">{{ $t('commons.msg.operateConfirm') }}</span>
|
<span style="font-size: 12px">{{ $t('commons.msg.operateConfirm') }}</span>
|
||||||
<span style="font-size: 12px; color: red; font-weight: 500">'{{ submitInputInfo }}'</span>
|
<span style="font-size: 12px; color: red; font-weight: 500">'{{ submitInputInfo }}'</span>
|
||||||
|
</div>
|
||||||
|
<el-input style="margin-top: 10px" v-model="submitInput"></el-input>
|
||||||
</div>
|
</div>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
|
@ -11,10 +11,11 @@
|
|||||||
{{ $t('commons.button.delete') }}
|
{{ $t('commons.button.delete') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
<el-table-column type="selection" fix />
|
<el-table-column type="selection" :selectable="selectable" fix />
|
||||||
<el-table-column :label="$t('commons.table.name')" show-overflow-tooltip min-width="80" prop="name" fix>
|
<el-table-column :label="$t('commons.table.name')" show-overflow-tooltip min-width="80" prop="name" fix>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-link @click="onInspect(row.id)" type="primary">{{ row.name }}</el-link>
|
<el-link @click="onInspect(row.id)" type="primary">{{ row.name }}</el-link>
|
||||||
|
<el-tag effect="dark" round v-if="row.isSystem" style="margin-left: 5px">system</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('container.driver')" show-overflow-tooltip min-width="40" prop="driver" />
|
<el-table-column :label="$t('container.driver')" show-overflow-tooltip min-width="40" prop="driver" />
|
||||||
@ -81,6 +82,10 @@ const onCreate = async () => {
|
|||||||
dialogCreateRef.value!.acceptParams();
|
dialogCreateRef.value!.acceptParams();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function selectable(row) {
|
||||||
|
return !row.isSystem;
|
||||||
|
}
|
||||||
|
|
||||||
const search = async () => {
|
const search = async () => {
|
||||||
const params = {
|
const params = {
|
||||||
page: paginationConfig.page,
|
page: paginationConfig.page,
|
||||||
@ -89,6 +94,9 @@ const search = async () => {
|
|||||||
await searchNetwork(params).then((res) => {
|
await searchNetwork(params).then((res) => {
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
data.value = res.data.items;
|
data.value = res.data.items;
|
||||||
|
for (const item of data.value) {
|
||||||
|
item.isSystem = isSystem(item.name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
paginationConfig.total = res.data.total;
|
paginationConfig.total = res.data.total;
|
||||||
});
|
});
|
||||||
@ -117,12 +125,19 @@ const onInspect = async (id: string) => {
|
|||||||
codemirror.value!.acceptParams(param);
|
codemirror.value!.acceptParams(param);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function isSystem(val: string) {
|
||||||
|
return val === 'bridge' || val === '1panel' || val === 'none' || val === 'host';
|
||||||
|
}
|
||||||
|
|
||||||
const buttons = [
|
const buttons = [
|
||||||
{
|
{
|
||||||
label: i18n.global.t('commons.button.delete'),
|
label: i18n.global.t('commons.button.delete'),
|
||||||
click: (row: Container.NetworkInfo) => {
|
click: (row: Container.NetworkInfo) => {
|
||||||
batchDelete(row);
|
batchDelete(row);
|
||||||
},
|
},
|
||||||
|
disabled: (row: any) => {
|
||||||
|
return row.isSystem;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -66,9 +66,6 @@
|
|||||||
<div class="login-border"></div>
|
<div class="login-border"></div>
|
||||||
<div class="login-welcome">{{ $t('commons.login.codeInput') }}</div>
|
<div class="login-welcome">{{ $t('commons.login.codeInput') }}</div>
|
||||||
<div class="login-form">
|
<div class="login-form">
|
||||||
<el-form-item>
|
|
||||||
<span style="font-size: 14px">Secret: {{ mfaLoginForm.secret }}</span>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-input
|
<el-input
|
||||||
size="default"
|
size="default"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user