@@ -92,11 +92,11 @@ export default {
9292 }
9393 },
9494 async created () {
95- await Promise .all [(
95+ await Promise .all ([
9696 this .fetchServiceOffering (),
9797 this .fetchBackupOffering (),
98- this .fetchTemplateArch ()
99- )]
98+ this .fetchBackupArch ()
99+ ])
100100 this .loading = false
101101 },
102102 methods: {
@@ -119,16 +119,21 @@ export default {
119119 this .backupOffering = backupOfferings[0 ]
120120 })
121121 },
122- fetchTemplateArch () {
123- return getAPI (' listTemplates' , {
122+ fetchBackupArch () {
123+ const isIso = this .resource .vmdetails .isiso === ' true'
124+ const api = isIso ? ' listIsos' : ' listTemplates'
125+ const responseKey = isIso ? ' listisosresponse' : ' listtemplatesresponse'
126+ const itemKey = isIso ? ' iso' : ' template'
127+
128+ return getAPI (api, {
124129 id: this .resource .vmdetails .templateid ,
125130 listall: true ,
126- templatefilter: ' all'
131+ ... (isIso ? {} : { templatefilter: ' all' })
127132 }).then (response => {
128- const templates = response . listtemplatesresponse . template || []
129- this .templateArch = templates [0 ]? .arch || ' x86_64'
133+ const items = response? .[responseKey] ? .[itemKey] || []
134+ this .backupArch = items [0 ]? .arch || ' x86_64'
130135 }).catch (() => {
131- this .templateArch = ' x86_64'
136+ this .backupArch = ' x86_64'
132137 })
133138 },
134139 populatePreFillData () {
@@ -141,7 +146,7 @@ export default {
141146 this .dataPreFill .backupid = this .resource .id
142147 this .dataPreFill .computeofferingid = this .vmdetails .serviceofferingid
143148 this .dataPreFill .templateid = this .vmdetails .templateid
144- this .dataPreFill .templateArch = this .templateArch
149+ this .dataPreFill .backupArch = this .backupArch
145150 this .dataPreFill .allowtemplateisoselection = true
146151 this .dataPreFill .isoid = this .vmdetails .templateid
147152 this .dataPreFill .allowIpAddressesFetch = this .resource .isbackupvmexpunged
0 commit comments