1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-31 14:08:06 +08:00

fix: 解决容器编辑失败时未更新容器 ID 的问题 (#2522)

This commit is contained in:
ssongliu 2023-10-12 13:52:32 +08:00 committed by GitHub
parent 0252a30f05
commit cc6873c941
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,11 @@
<template>
<el-drawer v-model="drawerVisible" :destroy-on-close="true" :close-on-click-modal="false" size="50%">
<el-drawer
v-model="drawerVisible"
@close="handleClose"
:destroy-on-close="true"
:close-on-click-modal="false"
size="50%"
>
<template #header>
<DrawerHeader
:header="title"
@ -259,6 +265,7 @@ import {
updateContainer,
loadResourceLimit,
listNetwork,
searchContainer,
} from '@/api/modules/container';
import { Container } from '@/api/interface/container';
import { MsgError, MsgSuccess } from '@/utils/message';
@ -471,6 +478,7 @@ const onSubmit = async (formEl: FormInstance | undefined) => {
drawerVisible.value = false;
})
.catch(() => {
updateContainerID();
loading.value = false;
});
})
@ -481,6 +489,23 @@ const onSubmit = async (formEl: FormInstance | undefined) => {
});
};
const updateContainerID = async () => {
let params = {
page: 1,
pageSize: 1,
name: dialogData.value.rowData.name,
filters: '',
orderBy: 'created_at',
order: 'null',
};
await searchContainer(params).then((res) => {
if (res.data.items?.length === 1) {
dialogData.value.rowData.containerID = res.data.items[0].containerID;
return;
}
});
};
const checkPortValid = () => {
if (dialogData.value.rowData!.exposedPorts.length === 0) {
return true;