Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 2 additions & 44 deletions ui/src/components/view/DeployVMFromBackup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1451,7 +1451,7 @@ export default {
this.initForm()
this.dataPreFill = this.preFillContent && Object.keys(this.preFillContent).length > 0 ? this.preFillContent : {}
this.showOverrideDiskOfferingOption = this.dataPreFill.overridediskoffering

this.selectedArchitecture = this.dataPreFill.backupArch ? this.dataPreFill.backupArch : this.architectureTypes.opts[0].id
if (this.dataPreFill.isIso) {
this.tabKey = 'isoid'
} else {
Expand Down Expand Up @@ -1540,46 +1540,6 @@ export default {
fillValue (field) {
this.form[field] = this.dataPreFill[field]
},
fetchZoneByQuery () {
return new Promise(resolve => {
let zones = []
let apiName = ''
const params = {}
if (this.templateId) {
apiName = 'listTemplates'
params.listall = true
params.templatefilter = this.isNormalAndDomainUser ? 'executable' : 'all'
params.id = this.templateId
} else if (this.isoId) {
apiName = 'listIsos'
params.listall = true
params.isofilter = this.isNormalAndDomainUser ? 'executable' : 'all'
params.id = this.isoId
} else if (this.networkId) {
params.listall = true
params.id = this.networkId
apiName = 'listNetworks'
}
if (!apiName) return resolve(zones)

getAPI(apiName, params).then(json => {
let objectName
const responseName = [apiName.toLowerCase(), 'response'].join('')
for (const key in json[responseName]) {
if (key === 'count') {
continue
}
objectName = key
break
}
const data = json?.[responseName]?.[objectName] || []
zones = data.map(item => item.zoneid)
return resolve(zones)
}).catch(() => {
return resolve(zones)
})
})
},
async fetchData () {
this.fetchZones(null, null)
_.each(this.params, (param, name) => {
Expand Down Expand Up @@ -1718,6 +1678,7 @@ export default {
if (template.details['vmware-to-kvm-mac-addresses']) {
this.dataPreFill.macAddressArray = JSON.parse(template.details['vmware-to-kvm-mac-addresses'])
}
this.selectedArchitecture = template?.arch || 'x86_64'
}
} else if (name === 'isoid') {
this.templateConfigurations = []
Expand Down Expand Up @@ -2344,9 +2305,6 @@ export default {
this.clusterId = null
this.zone = _.find(this.options.zones, (option) => option.id === value)
this.isZoneSelectedMultiArch = this.zone.ismultiarch
Comment thread
sudo87 marked this conversation as resolved.
if (this.isZoneSelectedMultiArch) {
this.selectedArchitecture = this.architectureTypes.opts[0].id
}
this.zoneSelected = true
this.form.startvm = true
this.selectedZone = this.zoneId
Expand Down
25 changes: 22 additions & 3 deletions ui/src/views/storage/CreateVMFromBackup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,11 @@ export default {
}
},
async created () {
await Promise.all[(
await Promise.all([
this.fetchServiceOffering(),
this.fetchBackupOffering()
)]
this.fetchBackupOffering(),
this.fetchBackupArch()
])
this.loading = false
Comment thread
sudo87 marked this conversation as resolved.
},
methods: {
Expand All @@ -118,6 +119,23 @@ export default {
this.backupOffering = backupOfferings[0]
})
},
fetchBackupArch () {
const isIso = this.resource.vmdetails.isiso === 'true'
const api = isIso ? 'listIsos' : 'listTemplates'
const responseKey = isIso ? 'listisosresponse' : 'listtemplatesresponse'
const itemKey = isIso ? 'iso' : 'template'

return getAPI(api, {
id: this.resource.vmdetails.templateid,
listall: true,
...(isIso ? {} : { templatefilter: 'all' })
}).then(response => {
const items = response?.[responseKey]?.[itemKey] || []
this.backupArch = items[0]?.arch || 'x86_64'
}).catch(() => {
this.backupArch = 'x86_64'
})
},
populatePreFillData () {
this.vmdetails = this.resource.vmdetails
this.dataPreFill.zoneid = this.resource.zoneid
Expand All @@ -128,6 +146,7 @@ export default {
this.dataPreFill.backupid = this.resource.id
this.dataPreFill.computeofferingid = this.vmdetails.serviceofferingid
this.dataPreFill.templateid = this.vmdetails.templateid
this.dataPreFill.backupArch = this.backupArch
this.dataPreFill.allowtemplateisoselection = true
this.dataPreFill.isoid = this.vmdetails.templateid
this.dataPreFill.allowIpAddressesFetch = this.resource.isbackupvmexpunged
Expand Down
Loading