Skip to content

Commit

Permalink
Improvements on information about disk sizes and offerings on VM depl…
Browse files Browse the repository at this point in the history
…oyment wizard's InfoCard (#9249)
  • Loading branch information
winterhazel authored Jul 12, 2024
1 parent 2919cac commit 4079906
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 18 deletions.
13 changes: 10 additions & 3 deletions ui/src/components/view/InfoCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -551,12 +551,19 @@
<span v-else>{{ resource.serviceofferingname || resource.serviceofferingid }}</span>
</div>
</div>
<div class="resource-detail-item" v-if="resource.diskofferingname && resource.diskofferingid">
<div class="resource-detail-item" v-if="resource.rootdiskofferingid && resource.rootdiskofferingdisplaytext || resource.datadiskofferingid && resource.datadiskofferingdisplaytext">
<div class="resource-detail-item__label">{{ $t('label.diskoffering') }}</div>
<div class="resource-detail-item__details">
<hdd-outlined />
<router-link v-if="!isStatic && $router.resolve('/diskoffering/' + resource.diskofferingid).matched[0].redirect !== '/exception/404'" :to="{ path: '/diskoffering/' + resource.diskofferingid }">{{ resource.diskofferingname || resource.diskofferingid }} </router-link>
<span v-else>{{ resource.diskofferingname || resource.diskofferingid }}</span>
<div v-if="resource.rootdiskofferingid">
<router-link v-if="!isStatic && $router.resolve('/diskoffering/' + resource.rootdiskofferingid).matched[0].redirect !== '/exception/404'" :to="{ path: '/diskoffering/' + resource.rootdiskofferingid }">{{ resource.rootdiskofferingdisplaytext }}</router-link>
<span v-else>{{ resource.rootdiskofferingdisplaytext }}</span>
</div>
<span v-if="resource.rootdiskofferingid && resource.datadiskofferingid">&nbsp;|&nbsp;</span>
<div v-if="resource.datadiskofferingid">
<router-link v-if="!isStatic && $router.resolve('/diskoffering/' + resource.datadiskofferingid).matched[0].redirect !== '/exception/404'" :to="{ path: '/diskoffering/' + resource.datadiskofferingid }">{{ resource.datadiskofferingdisplaytext }}</router-link>
<span v-else>{{ resource.datadiskofferingdisplaytext }}</span>
</div>
</div>
</div>
<div class="resource-detail-item" v-if="resource.backupofferingid">
Expand Down
58 changes: 43 additions & 15 deletions ui/src/views/compute/DeployVM.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1078,26 +1078,55 @@ export default {
return ['User'].includes(this.$store.getters.userInfo.roletype) || store.getters.project.id
},
diskSize () {
const customRootDiskSize = _.get(this.instanceConfig, 'rootdisksize', null)
const customDataDiskSize = _.get(this.instanceConfig, 'size', null)
let computeOfferingDiskSize = _.get(this.serviceOffering, 'rootdisksize', null)
computeOfferingDiskSize = computeOfferingDiskSize > 0 ? computeOfferingDiskSize : null
const diskOfferingDiskSize = _.get(this.diskOffering, 'disksize', null)
const overrideDiskOfferingDiskSize = _.get(this.overrideDiskOffering, 'disksize', null)
let rootDiskSize
let dataDiskSize
let rootDiskSize = _.get(this.instanceConfig, 'rootdisksize', 0)
const diskOfferingDiskSize = _.get(this.diskOffering, 'disksize', 0)
const customDiskSize = _.get(this.instanceConfig, 'size', 0)
if (this.vm.isoid != null) {
rootDiskSize = diskOfferingDiskSize > 0 ? diskOfferingDiskSize : customDiskSize
rootDiskSize = this.diskOffering?.iscustomized ? customDataDiskSize : diskOfferingDiskSize
} else {
dataDiskSize = diskOfferingDiskSize > 0 ? diskOfferingDiskSize : customDiskSize
rootDiskSize = this.overrideDiskOffering?.iscustomized ? customRootDiskSize : overrideDiskOfferingDiskSize || computeOfferingDiskSize || this.dataPreFill.minrootdisksize
dataDiskSize = this.diskOffering?.iscustomized ? customDataDiskSize : diskOfferingDiskSize
}
const size = []
if (rootDiskSize > 0) {
if (rootDiskSize) {
size.push(`${rootDiskSize} GB (Root)`)
}
if (dataDiskSize > 0) {
if (dataDiskSize) {
size.push(`${dataDiskSize} GB (Data)`)
}
return size.join(' | ')
},
rootDiskOffering () {
const rootDiskOffering = this.vm.isoid != null ? this.diskOffering : this.overrideDiskOffering
const id = _.get(rootDiskOffering, 'id', null)
const displayText = _.get(rootDiskOffering, 'displaytext', null)
return {
id: id,
displayText: `${displayText} (Root)`
}
},
dataDiskOffering () {
if (this.vm.isoid != null) {
return null
}
const id = _.get(this.diskOffering, 'id', null)
const displayText = _.get(this.diskOffering, 'displaytext', null)
return {
id: id,
displayText: `${displayText} (Data)`
}
},
affinityGroupIds () {
return _.map(this.affinityGroups, 'id')
},
Expand Down Expand Up @@ -1439,18 +1468,12 @@ export default {
this.vm.hostname = host.name
}
if (this.serviceOffering?.rootdisksize) {
this.vm.disksizetotalgb = this.serviceOffering.rootdisksize
} else if (this.diskSize) {
if (this.diskSize) {
this.vm.disksizetotalgb = this.diskSize
} else {
this.vm.disksizetotalgb = null
}
if (this.diskSize) {
this.vm.disksizetotalgb = this.diskSize
}
if (this.networks) {
this.vm.networks = this.networks
this.vm.defaultnetworkid = this.defaultnetworkid
Expand Down Expand Up @@ -1498,6 +1521,11 @@ export default {
this.vm.diskofferingsize = this.diskOffering.disksize
}
this.vm.rootdiskofferingid = this.rootDiskOffering?.id
this.vm.rootdiskofferingdisplaytext = this.rootDiskOffering?.displayText
this.vm.datadiskofferingid = this.dataDiskOffering?.id
this.vm.datadiskofferingdisplaytext = this.dataDiskOffering?.displayText
if (this.affinityGroups) {
this.vm.affinitygroup = this.affinityGroups
}
Expand Down

0 comments on commit 4079906

Please sign in to comment.