190190 @onClick =" openMigrationModal(record)" />
191191 </template >
192192 <template v-else-if =" column .key == ' deleteactions' && (record .templateid || record .volumeid ) == null && ! [' MOLD-AC' , ' MOLD-HB' ,' ccvm' ].some (forbiddenName => record .name .includes (forbiddenName ))" >
193- <a-col flex =" auto" >
194- <a-button
195- type =" primary"
196- size =" medium"
197- shape =" circle"
198- :tooltip =" $t('label.create')"
199- @click =" showAddTyModal"
200- :loading =" loading"
201- >
202- <template #icon ><plus-outlined /></template >
203- </a-button >
204- <a-popconfirm
205- :title =" `${$t('label.delete.rbd.image')}?`"
206- @confirm =" deleteRbdImage(record.name)"
207- :okText =" $t('label.yes')"
208- :cancelText =" $t('label.no')"
209- placement =" left" >
210- <tooltip-button
211- tooltipPlacement =" bottom"
193+ <a-col flex =" auto" >
194+ <a-button
212195 type =" primary"
213196 size =" medium"
214- icon =" delete-outlined"
215- :tooltip =" $t('label.delete')"
216- :danger =" true"
217- />
218- </a-popconfirm >
197+ shape =" circle"
198+ :tooltip =" $t('label.create')"
199+ @click =" showAddTyModal(record.name, record.size)"
200+ :loading =" loading"
201+ >
202+ <template #icon ><plus-outlined /></template >
203+ </a-button >
204+ <a-popconfirm
205+ :title =" `${$t('label.delete.rbd.image')}?`"
206+ @confirm =" deleteRbdImage(record.name)"
207+ :okText =" $t('label.yes')"
208+ :cancelText =" $t('label.no')"
209+ placement =" left" >
210+ <tooltip-button
211+ tooltipPlacement =" bottom"
212+ type =" primary"
213+ size =" medium"
214+ icon =" delete-outlined"
215+ :tooltip =" $t('label.delete')"
216+ :danger =" true"
217+ />
218+ </a-popconfirm >
219219 </a-col >
220- <a-modal
221- :visible =" showAddTypeModal"
222- :title =" $t('label.volumetype')"
223- @cancel =" closeModals"
224- @ok =" createVolume(record.name, record.size)" >
225- <div class =" title" >{{ $t('label.create.type.rbd.image') }}</div >
226- <a-form-item ref =" volumetype" name =" volumetype" >
227- <a-select v-model:value =" volumetype" @change =" volumeTypeChange" >
228- <a-select-option value =' ROOT' >{{ $t('label.rootdisk') }}</a-select-option >
229- <a-select-option value =' DATADISK' >{{ $t('label.data.disk') }}</a-select-option >
230- </a-select >
231- </a-form-item >
232- </a-modal >
220+ </template >
233221 </template >
234- </template >
235222 </a-table >
223+ <a-modal
224+ :visible =" showAddTypeModal"
225+ :title =" $t('label.volumetype')"
226+ @cancel =" closeModals"
227+ @ok =" createVolume()" >
228+ <div class =" title" >{{ $t('label.create.type.rbd.image') }}</div >
229+ <a-form-item ref =" volumetype" name =" volumetype" >
230+ <a-select v-model:value =" volumetype" @change =" volumeTypeChange" >
231+ <a-select-option value =' ROOT' >{{ $t('label.rootdisk') }}</a-select-option >
232+ <a-select-option value =' DATADISK' >{{ $t('label.data.disk') }}</a-select-option >
233+ </a-select >
234+ </a-form-item >
235+ </a-modal >
236236 </div >
237237 </div >
238238
@@ -245,16 +245,14 @@ import InfoCard from '@/components/view/InfoCard'
245245import TooltipButton from ' @/components/widgets/TooltipButton'
246246import MigrateImageStoreResource from ' @/views/storage/MigrateImageStoreResource'
247247import CreateRbdImage from ' @/views/storage/CreateRbdImage'
248- import CreateVolType from ' @/views/storage/CreateVolType'
249248
250249export default {
251250 name: ' StorageBrowser' ,
252251 components: {
253252 InfoCard,
254253 MigrateImageStoreResource,
255254 TooltipButton,
256- CreateRbdImage,
257- CreateVolType
255+ CreateRbdImage
258256 },
259257 props: {
260258 resource: {
@@ -314,7 +312,9 @@ export default {
314312 rootSwitch: true ,
315313 dataDiskSwitch: false ,
316314 volumetype: ' ROOT' ,
317- keyword: ' '
315+ keyword: ' ' ,
316+ targetName: ' ' ,
317+ targetSize: ' '
318318 }
319319 },
320320 created () {
@@ -344,14 +344,14 @@ export default {
344344 volumeTypeChange (val ) {
345345 this .volumetype = val
346346 },
347- createVolume (name , size ) {
347+ createVolume () {
348348 api (' listDiskOfferings' , { listall: true }).then (json => {
349349 this .offerings = json .listdiskofferingsresponse .diskoffering || []
350350 this .customDiskOffering = this .offerings .filter (x => x .iscustomized === true )
351351 api (' createVolume' , {
352352 diskofferingid: this .customDiskOffering [0 ].id ,
353- size: size / (1024 * 1024 * 1024 ),
354- name: name ,
353+ size: this . targetSize / (1024 * 1024 * 1024 ),
354+ name: this . targetName ,
355355 zoneid: this .resource .zoneid
356356 }).then (response => {
357357 this .$pollJob ({
@@ -361,7 +361,7 @@ export default {
361361 successMethod : (result ) => {
362362 api (' updateVolume' , {
363363 id: result .jobresult .volume .id ,
364- path: name ,
364+ path: this . targetName ,
365365 storageid: this .resource .id ,
366366 state: ' Ready' ,
367367 type: this .volumetype
@@ -432,8 +432,10 @@ export default {
432432 showAddVolModal () {
433433 this .showAddVolumeModal = true
434434 },
435- showAddTyModal () {
435+ showAddTyModal (name , size ) {
436436 this .showAddTypeModal = true
437+ this .targetName = name
438+ this .targetSize = size
437439 },
438440 closeModals () {
439441 this .showAddVolumeModal = false
0 commit comments