3434 :rowKey =" record => record.id"
3535 :pagination =" false"
3636 >
37- <template slot="account" slot-scope="record">
37+ <template slot="account" slot-scope="record" v-if = " ! basicGuestNetwork " >
3838 <a-button @click =" () => handleOpenAccountModal(record)" >{{ `[${record.domain}] ${record.account === undefined ? '' : record.account}` }}</a-button >
3939 </template >
4040 <template slot="actions" slot-scope="record">
4141 <div class =" actions" >
4242 <tooltip-button
43- v-if =" record.account === 'system'"
43+ v-if =" record.account === 'system' && !basicGuestNetwork "
4444 tooltipPlacement =" bottom"
4545 :tooltip =" $t('label.add.account')"
4646 icon =" user-add"
4747 @click =" () => handleOpenAddAccountModal(record)"
4848 :disabled =" !('dedicatePublicIpRange' in $store.getters.apis)" />
4949 <tooltip-button
50- v-else
50+ v-if = " record.account !== 'system' && !basicGuestNetwork "
5151 tooltipPlacement =" bottom"
5252 :tooltip =" $t('label.release.account')"
5353 icon =" user-delete"
137137 layout =" vertical"
138138 class =" form"
139139 >
140+ <a-form-item :label =" $t('label.podid')" class =" form__item" v-if =" basicGuestNetwork" >
141+ <a-select
142+ autoFocus
143+ v-decorator =" ['podid', {
144+ rules: [{ required: true, message: `${$t('label.required')}` }]
145+ }]"
146+ >
147+ <a-select-option v-for =" pod in pods" :key =" pod.id" :value =" pod.id" >{{ pod.name }}</a-select-option >
148+ </a-select >
149+ </a-form-item >
140150 <a-form-item :label =" $t('label.gateway')" class =" form__item" >
141151 <a-input
142152 autoFocus
148158 v-decorator =" ['netmask', { rules: [{ required: true, message: `${$t('label.required')}` }] }]" >
149159 </a-input >
150160 </a-form-item >
151- <a-form-item :label =" $t('label.vlan')" class =" form__item" >
161+ <a-form-item :label =" $t('label.vlan')" class =" form__item" v-if = " !basicGuestNetwork " >
152162 <a-input
153163 v-decorator =" ['vlan']" >
154164 </a-input >
163173 v-decorator =" ['endip', { rules: [{ required: true, message: `${$t('label.required')}` }] }]" >
164174 </a-input >
165175 </a-form-item >
166- <div class =" form__item" >
176+ <div class =" form__item" v-if = " !basicGuestNetwork " >
167177 <div style =" color : black ;" >{{ $t('label.set.reservation') }}</div >
168178 <a-switch @change =" handleShowAccountFields" ></a-switch >
169179 </div >
170- <div v-if =" showAccountFields" style =" margin-top : 20px ;" >
180+ <div v-if =" showAccountFields && !basicGuestNetwork " style =" margin-top : 20px ;" >
171181 <div v-html =" $t('label.set.reservation.desc')" ></div >
172182 <a-form-item :label =" $t('label.system.vms')" class =" form__item" >
173183 <a-switch v-decorator =" ['forsystemvms']" ></a-switch >
@@ -214,6 +224,10 @@ export default {
214224 network: {
215225 type: Object ,
216226 required: true
227+ },
228+ basicGuestNetwork: {
229+ type: Boolean ,
230+ required: true
217231 }
218232 },
219233 data () {
@@ -232,6 +246,8 @@ export default {
232246 domainsLoading: false ,
233247 addIpRangeModal: false ,
234248 showAccountFields: false ,
249+ podsLoading: false ,
250+ pods: [],
235251 page: 1 ,
236252 pageSize: 10 ,
237253 columns: [
@@ -255,10 +271,6 @@ export default {
255271 title: this .$t (' label.endip' ),
256272 dataIndex: ' endip'
257273 },
258- {
259- title: this .$t (' label.account' ),
260- scopedSlots: { customRender: ' account' }
261- },
262274 {
263275 title: this .$t (' label.action' ),
264276 scopedSlots: { customRender: ' actions' }
@@ -270,6 +282,19 @@ export default {
270282 this .form = this .$form .createForm (this )
271283 },
272284 created () {
285+ if (! this .basicGuestNetwork ) {
286+ this .columns .splice (5 , 0 ,
287+ {
288+ title: this .$t (' label.account' ),
289+ scopedSlots: { customRender: ' account' }
290+ }
291+ )
292+ } else {
293+ this .columns .unshift ({
294+ title: this .$t (' label.pod' ),
295+ dataIndex: ' podname'
296+ })
297+ }
273298 this .fetchData ()
274299 },
275300 watch: {
@@ -296,6 +321,7 @@ export default {
296321 }).finally (() => {
297322 this .componentLoading = false
298323 })
324+ this .fetchPods ()
299325 },
300326 fetchDomains () {
301327 this .domainsLoading = true
@@ -314,6 +340,22 @@ export default {
314340 this .domainsLoading = false
315341 })
316342 },
343+ fetchPods () {
344+ this .podsLoading = true
345+ api (' listPods' , {
346+ zoneid: this .resource .zoneid ,
347+ page: this .page ,
348+ pagesize: this .pageSize
349+ }).then (response => {
350+ this .total = response .listpodsresponse .count || 0
351+ this .pods = response .listpodsresponse .pod ? response .listpodsresponse .pod : []
352+ }).catch (error => {
353+ console .log (error)
354+ this .$notifyError (error)
355+ }).finally (() => {
356+ this .podsLoading = false
357+ })
358+ },
317359 handleAddAccount () {
318360 this .domainsLoading = true
319361
@@ -384,18 +426,25 @@ export default {
384426
385427 this .componentLoading = true
386428 this .addIpRangeModal = false
387- api (' createVlanIpRange' , {
388- zoneId: this .resource .zoneid ,
389- vlan: values .vlan ,
429+ var params = {
390430 gateway: values .gateway ,
391431 netmask: values .netmask ,
392432 startip: values .startip ,
393- endip: values .endip ,
394- forsystemvms: values .forsystemvms ,
395- account: values .forsystemvms ? null : values .account ,
396- domainid: values .forsystemvms ? null : values .domain ,
397- forvirtualnetwork: true
398- }).then (() => {
433+ endip: values .endip
434+ }
435+ if (! this .basicGuestNetwork ) {
436+ params .zoneId = this .resource .zoneid
437+ params .vlan = values .vlan
438+ params .forsystemvms = values .forsystemvms
439+ params .account = values .forsystemvms ? null : values .account
440+ params .domainid = values .forsystemvms ? null : values .domain
441+ params .forvirtualnetwork = true
442+ } else {
443+ params .forvirtualnetwork = false
444+ params .podid = values .podid
445+ params .networkid = this .network .id
446+ }
447+ api (' createVlanIpRange' , params).then (() => {
399448 this .$notification .success ({
400449 message: this .$t (' message.success.add.iprange' )
401450 })
0 commit comments