Skip to content

Commit 28790e3

Browse files
committed
ui: allow macaddress input for add nic to vm
Fixes #12143 Signed-off-by: Abhishek Kumar <[email protected]>
1 parent 028dd86 commit 28790e3

File tree

1 file changed

+38
-27
lines changed

1 file changed

+38
-27
lines changed

ui/src/views/network/NicsTab.vue

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,16 @@
8080
:footer="null"
8181
@cancel="closeModals">
8282
{{ $t('message.network.addvm.desc') }}
83-
<a-form @finish="submitAddNetwork" v-ctrl-enter="submitAddNetwork">
84-
<div class="modal-form">
85-
<p class="modal-form__label">{{ $t('label.network') }}:</p>
83+
<a-form
84+
@finish="submitAddNetwork"
85+
v-ctrl-enter="submitAddNetwork"
86+
layout="vertical">
87+
<a-form-item name="network" ref="network">
88+
<template #label>
89+
<tooltip-label :title="$t('label.network')" :tooltip="addNetworkData.apiParams.networkid.description"/>
90+
</template>
8691
<a-select
92+
:placeholder="addNetworkData.apiParams.networkid.description"
8793
:value="addNetworkData.network"
8894
@change="e => addNetworkData.network = e"
8995
v-focus="true"
@@ -104,14 +110,28 @@
104110
</span>
105111
</a-select-option>
106112
</a-select>
107-
<p class="modal-form__label">{{ $t('label.publicip') }}:</p>
108-
<a-input v-model:value="addNetworkData.ip"></a-input>
109-
<br>
113+
</a-form-item>
114+
<a-form-item name="ip" ref="ip">
115+
<template #label>
116+
<tooltip-label :title="$t('label.ipaddress')" :tooltip="addNetworkData.apiParams.ipaddress.description"/>
117+
</template>
118+
<a-input
119+
:placeholder="addNetworkData.apiParams.ipaddress.description"
120+
v-model:value="addNetworkData.ipaddress" />
121+
</a-form-item>
122+
<a-form-item name="macaddress" ref="macaddress">
123+
<template #label>
124+
<tooltip-label :title="$t('label.macaddress')" :tooltip="addNetworkData.apiParams.macaddress.description"/>
125+
</template>
126+
<a-input
127+
:placeholder="addNetworkData.apiParams.macaddress.description"
128+
v-model:value="addNetworkData.macaddress" />
129+
</a-form-item>
130+
<a-form-item name="makedefault" ref="makedefault">
110131
<a-checkbox v-model:checked="addNetworkData.makedefault">
111132
{{ $t('label.make.default') }}
112133
</a-checkbox>
113-
<br>
114-
</div>
134+
</a-form-item>
115135

116136
<div :span="24" class="action-button">
117137
<a-button @click="closeModals">{{ $t('label.cancel') }}</a-button>
@@ -229,13 +249,15 @@
229249
<script>
230250
import { api } from '@/api'
231251
import NicsTable from '@/views/network/NicsTable'
252+
import TooltipLabel from '@/components/widgets/TooltipLabel'
232253
import TooltipButton from '@/components/widgets/TooltipButton'
233254
import ResourceIcon from '@/components/view/ResourceIcon'
234255
235256
export default {
236257
name: 'NicsTab',
237258
components: {
238259
NicsTable,
260+
TooltipLabel,
239261
TooltipButton,
240262
ResourceIcon
241263
},
@@ -279,6 +301,7 @@ export default {
279301
},
280302
created () {
281303
this.vm = this.resource
304+
this.addNetworkData.apiParams = this.$getApiParams('addNicToVirtualMachine')
282305
},
283306
methods: {
284307
listNetworks () {
@@ -338,7 +361,8 @@ export default {
338361
this.showUpdateIpModal = false
339362
this.showSecondaryIpModal = false
340363
this.addNetworkData.network = ''
341-
this.addNetworkData.ip = ''
364+
this.addNetworkData.ipaddress = ''
365+
this.addNetworkData.macaddress = ''
342366
this.addNetworkData.makedefault = false
343367
this.editIpAddressValue = ''
344368
this.newSecondaryIp = ''
@@ -367,8 +391,11 @@ export default {
367391
const params = {}
368392
params.virtualmachineid = this.vm.id
369393
params.networkid = this.addNetworkData.network
370-
if (this.addNetworkData.ip) {
371-
params.ipaddress = this.addNetworkData.ip
394+
if (this.addNetworkData.ipaddress) {
395+
params.ipaddress = this.addNetworkData.ipaddress
396+
}
397+
if (this.addNetworkData.macaddress) {
398+
params.macaddress = this.addNetworkData.macaddress
372399
}
373400
this.showAddNetworkModal = false
374401
this.loadingNic = true
@@ -603,22 +630,6 @@ export default {
603630
}
604631
}
605632
606-
.action-button {
607-
display: flex;
608-
flex-wrap: wrap;
609-
610-
button {
611-
padding: 5px;
612-
height: auto;
613-
margin-bottom: 10px;
614-
align-self: flex-start;
615-
616-
&:not(:last-child) {
617-
margin-right: 10px;
618-
}
619-
}
620-
}
621-
622633
.wide-modal {
623634
min-width: 50vw;
624635
}

0 commit comments

Comments
 (0)