mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-12-20 06:18:56 +08:00
fix: Fix the issue of missing parameters when creating macvlan (#10583)
Refs #10580
This commit is contained in:
parent
339b085db7
commit
e7b1aadb0e
12 changed files with 37 additions and 1 deletions
|
|
@ -913,6 +913,7 @@ const message = {
|
||||||
driver: 'Driver',
|
driver: 'Driver',
|
||||||
option: 'Option',
|
option: 'Option',
|
||||||
attachable: 'Attachable',
|
attachable: 'Attachable',
|
||||||
|
parentNetworkCard: 'Parent Network Card',
|
||||||
subnet: 'Subnet',
|
subnet: 'Subnet',
|
||||||
scope: 'IP scope',
|
scope: 'IP scope',
|
||||||
gateway: 'Gateway',
|
gateway: 'Gateway',
|
||||||
|
|
|
||||||
|
|
@ -915,6 +915,7 @@ const message = {
|
||||||
driver: 'Driver',
|
driver: 'Driver',
|
||||||
option: 'Opción',
|
option: 'Opción',
|
||||||
attachable: 'Adjuntable',
|
attachable: 'Adjuntable',
|
||||||
|
parentNetworkCard: 'Tarjeta de Red Principal',
|
||||||
subnet: 'Subred',
|
subnet: 'Subred',
|
||||||
scope: 'Rango de IP',
|
scope: 'Rango de IP',
|
||||||
gateway: 'Puerta de enlace',
|
gateway: 'Puerta de enlace',
|
||||||
|
|
|
||||||
|
|
@ -889,6 +889,7 @@ const message = {
|
||||||
driver: 'ドライバ',
|
driver: 'ドライバ',
|
||||||
option: 'オプション',
|
option: 'オプション',
|
||||||
attachable: '取り付け可能',
|
attachable: '取り付け可能',
|
||||||
|
parentNetworkCard: '親ネットワークカード',
|
||||||
subnet: 'サブネット',
|
subnet: 'サブネット',
|
||||||
scope: 'IPスコープ',
|
scope: 'IPスコープ',
|
||||||
gateway: 'ゲートウェイ',
|
gateway: 'ゲートウェイ',
|
||||||
|
|
|
||||||
|
|
@ -880,6 +880,7 @@ const message = {
|
||||||
driver: '드라이버',
|
driver: '드라이버',
|
||||||
option: '옵션',
|
option: '옵션',
|
||||||
attachable: '연결 가능',
|
attachable: '연결 가능',
|
||||||
|
parentNetworkCard: '부모 네트워크 카드',
|
||||||
subnet: '서브넷',
|
subnet: '서브넷',
|
||||||
scope: 'IP 범위',
|
scope: 'IP 범위',
|
||||||
gateway: '게이트웨이',
|
gateway: '게이트웨이',
|
||||||
|
|
|
||||||
|
|
@ -907,6 +907,7 @@ const message = {
|
||||||
driver: 'Pemacu',
|
driver: 'Pemacu',
|
||||||
option: 'Pilihan',
|
option: 'Pilihan',
|
||||||
attachable: 'Boleh dilampirkan',
|
attachable: 'Boleh dilampirkan',
|
||||||
|
parentNetworkCard: 'Kad Rangkaian Induk',
|
||||||
subnet: 'Subnet',
|
subnet: 'Subnet',
|
||||||
scope: 'Skop IP',
|
scope: 'Skop IP',
|
||||||
gateway: 'Gerbang',
|
gateway: 'Gerbang',
|
||||||
|
|
|
||||||
|
|
@ -902,6 +902,7 @@ const message = {
|
||||||
driver: 'Driver',
|
driver: 'Driver',
|
||||||
option: 'Opção',
|
option: 'Opção',
|
||||||
attachable: 'Anexável',
|
attachable: 'Anexável',
|
||||||
|
parentNetworkCard: 'Placa de Rede Principal',
|
||||||
subnet: 'Sub-rede',
|
subnet: 'Sub-rede',
|
||||||
scope: 'Escopo IP',
|
scope: 'Escopo IP',
|
||||||
gateway: 'Gateway',
|
gateway: 'Gateway',
|
||||||
|
|
|
||||||
|
|
@ -905,6 +905,7 @@ const message = {
|
||||||
driver: 'Драйвер',
|
driver: 'Драйвер',
|
||||||
option: 'Опция',
|
option: 'Опция',
|
||||||
attachable: 'Подключаемая',
|
attachable: 'Подключаемая',
|
||||||
|
parentNetworkCard: 'Родительская Сетевая Карта',
|
||||||
subnet: 'Подсеть',
|
subnet: 'Подсеть',
|
||||||
scope: 'Диапазон IP',
|
scope: 'Диапазон IP',
|
||||||
gateway: 'Шлюз',
|
gateway: 'Шлюз',
|
||||||
|
|
|
||||||
|
|
@ -923,6 +923,7 @@ const message = {
|
||||||
driver: 'Sürücü',
|
driver: 'Sürücü',
|
||||||
option: 'Seçenek',
|
option: 'Seçenek',
|
||||||
attachable: 'Eklenebilir',
|
attachable: 'Eklenebilir',
|
||||||
|
parentNetworkCard: 'Ana Ağ Kartı',
|
||||||
subnet: 'Alt ağ',
|
subnet: 'Alt ağ',
|
||||||
scope: 'IP kapsamı',
|
scope: 'IP kapsamı',
|
||||||
gateway: 'Ağ geçidi',
|
gateway: 'Ağ geçidi',
|
||||||
|
|
|
||||||
|
|
@ -878,6 +878,7 @@ const message = {
|
||||||
driver: '模式',
|
driver: '模式',
|
||||||
option: '參數',
|
option: '參數',
|
||||||
attachable: '可用',
|
attachable: '可用',
|
||||||
|
parentNetworkCard: '父網卡',
|
||||||
subnet: '子網',
|
subnet: '子網',
|
||||||
scope: 'IP 範圍',
|
scope: 'IP 範圍',
|
||||||
gateway: '閘道器',
|
gateway: '閘道器',
|
||||||
|
|
|
||||||
|
|
@ -877,6 +877,7 @@ const message = {
|
||||||
driver: '模式',
|
driver: '模式',
|
||||||
option: '参数',
|
option: '参数',
|
||||||
attachable: '可用',
|
attachable: '可用',
|
||||||
|
parentNetworkCard: '父网卡',
|
||||||
subnet: '子网',
|
subnet: '子网',
|
||||||
scope: 'IP 范围',
|
scope: 'IP 范围',
|
||||||
gateway: '网关',
|
gateway: '网关',
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,17 @@
|
||||||
<el-option label="overlay" value="overlay" />
|
<el-option label="overlay" value="overlay" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
v-if="form.driver === 'macvlan'"
|
||||||
|
:label="$t('container.parentNetworkCard')"
|
||||||
|
prop="parentNetworkCard"
|
||||||
|
>
|
||||||
|
<el-select v-model="form.parentNetworkCard">
|
||||||
|
<span v-for="item in netOptions" :key="item">
|
||||||
|
<el-option v-if="item !== 'all'" :label="item" :value="item" />
|
||||||
|
</span>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
<el-checkbox v-model="form.ipv4">IPv4</el-checkbox>
|
<el-checkbox v-model="form.ipv4">IPv4</el-checkbox>
|
||||||
<div v-if="form.ipv4">
|
<div v-if="form.ipv4">
|
||||||
|
|
@ -133,12 +144,14 @@ import { ElForm } from 'element-plus';
|
||||||
import { createNetwork } from '@/api/modules/container';
|
import { createNetwork } from '@/api/modules/container';
|
||||||
import { MsgSuccess } from '@/utils/message';
|
import { MsgSuccess } from '@/utils/message';
|
||||||
import { checkIp, checkIpV6 } from '@/utils/util';
|
import { checkIp, checkIpV6 } from '@/utils/util';
|
||||||
|
import { getNetworkOptions } from '@/api/modules/host';
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
|
|
||||||
const drawerVisible = ref(false);
|
const drawerVisible = ref(false);
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
name: '',
|
name: '',
|
||||||
|
parentNetworkCard: '',
|
||||||
labelStr: '',
|
labelStr: '',
|
||||||
labels: [] as Array<string>,
|
labels: [] as Array<string>,
|
||||||
optionStr: '',
|
optionStr: '',
|
||||||
|
|
@ -163,6 +176,7 @@ const acceptParams = (): void => {
|
||||||
form.optionStr = '';
|
form.optionStr = '';
|
||||||
form.options = [];
|
form.options = [];
|
||||||
form.driver = 'bridge';
|
form.driver = 'bridge';
|
||||||
|
form.parentNetworkCard = '';
|
||||||
form.ipv4 = true;
|
form.ipv4 = true;
|
||||||
form.subnet = '';
|
form.subnet = '';
|
||||||
form.gateway = '';
|
form.gateway = '';
|
||||||
|
|
@ -174,6 +188,7 @@ const acceptParams = (): void => {
|
||||||
form.ipRangeV6 = '';
|
form.ipRangeV6 = '';
|
||||||
form.auxAddressV6 = [];
|
form.auxAddressV6 = [];
|
||||||
drawerVisible.value = true;
|
drawerVisible.value = true;
|
||||||
|
loadNetworkOptions();
|
||||||
};
|
};
|
||||||
const emit = defineEmits<{ (e: 'search'): void }>();
|
const emit = defineEmits<{ (e: 'search'): void }>();
|
||||||
|
|
||||||
|
|
@ -181,9 +196,12 @@ const handleClose = () => {
|
||||||
drawerVisible.value = false;
|
drawerVisible.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const netOptions = ref();
|
||||||
|
|
||||||
const rules = reactive({
|
const rules = reactive({
|
||||||
name: [Rules.requiredInput],
|
name: [Rules.requiredInput],
|
||||||
driver: [Rules.requiredSelect],
|
driver: [Rules.requiredSelect],
|
||||||
|
parentNetworkCard: [Rules.requiredSelect],
|
||||||
subnet: [{ validator: checkCidr, trigger: 'blur' }, Rules.requiredInput],
|
subnet: [{ validator: checkCidr, trigger: 'blur' }, Rules.requiredInput],
|
||||||
gateway: [{ validator: checkGateway, trigger: 'blur' }],
|
gateway: [{ validator: checkGateway, trigger: 'blur' }],
|
||||||
ipRange: [{ validator: checkCidr, trigger: 'blur' }],
|
ipRange: [{ validator: checkCidr, trigger: 'blur' }],
|
||||||
|
|
@ -263,6 +281,11 @@ const handleV6Delete = (index: number) => {
|
||||||
form.auxAddressV6.splice(index, 1);
|
form.auxAddressV6.splice(index, 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const loadNetworkOptions = async () => {
|
||||||
|
const res = await getNetworkOptions();
|
||||||
|
netOptions.value = res.data;
|
||||||
|
};
|
||||||
|
|
||||||
type FormInstance = InstanceType<typeof ElForm>;
|
type FormInstance = InstanceType<typeof ElForm>;
|
||||||
const formRef = ref<FormInstance>();
|
const formRef = ref<FormInstance>();
|
||||||
const onSubmit = async (formEl: FormInstance | undefined) => {
|
const onSubmit = async (formEl: FormInstance | undefined) => {
|
||||||
|
|
@ -276,6 +299,9 @@ const onSubmit = async (formEl: FormInstance | undefined) => {
|
||||||
form.options = form.optionStr.split('\n');
|
form.options = form.optionStr.split('\n');
|
||||||
}
|
}
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
|
if (form.driver === 'macvlan') {
|
||||||
|
form.options.push('parent=' + form.parentNetworkCard);
|
||||||
|
}
|
||||||
await createNetwork(form)
|
await createNetwork(form)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,7 @@ const onDelete = async (row: Cronjob.ScriptInfo | null) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSync = async () => {
|
const onSync = async () => {
|
||||||
ElMessageBox.confirm(i18n.global.t('cronjob.library.syncHelper'), i18n.global.t('commons.button.syncNow'), {
|
ElMessageBox.confirm(i18n.global.t('cronjob.library.syncHelper'), i18n.global.t('cronjob.library.syncNow'), {
|
||||||
confirmButtonText: i18n.global.t('commons.button.confirm'),
|
confirmButtonText: i18n.global.t('commons.button.confirm'),
|
||||||
cancelButtonText: i18n.global.t('commons.button.cancel'),
|
cancelButtonText: i18n.global.t('commons.button.cancel'),
|
||||||
type: 'info',
|
type: 'info',
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue