server: Root disk size should be listed in GB at listServiceOffering (#5085)

* Root disk size should be listed in GB at listServiceOffering

* Update UI to handle rootdisk size in GB instead of Bytes
This commit is contained in:
Gabriel Beims Bräscher 2021-06-09 02:44:18 -03:00 committed by GitHub
parent 8fe0ff854b
commit 1afcd823e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -45,6 +45,13 @@ public class ServiceOfferingJoinDaoImpl extends GenericDaoBase<ServiceOfferingJo
private SearchBuilder<ServiceOfferingJoinVO> sofIdSearch;
/**
* Constant used to convert GB into Bytes (or the other way around).
* GB * MB * KB = Bytes //
* 1024 * 1024 * 1024 = 1073741824
*/
private static final long GB_TO_BYTES = 1073741824;
protected ServiceOfferingJoinDaoImpl() {
sofIdSearch = createSearchBuilder();
@ -123,7 +130,8 @@ public class ServiceOfferingJoinDaoImpl extends GenericDaoBase<ServiceOfferingJo
}
}
offeringResponse.setRootDiskSize(offering.getRootDiskSize());
long rootDiskSizeInGb = (long) offering.getRootDiskSize() / GB_TO_BYTES;
offeringResponse.setRootDiskSize(rootDiskSizeInGb);
return offeringResponse;
}

View File

@ -35,7 +35,7 @@
</div>
<div v-else-if="$route.meta.name === 'computeoffering' && item === 'rootdisksize'">
<div>
{{ parseFloat( resource.rootdisksize / (1024.0 * 1024.0 * 1024.0)).toFixed(1) }} GB
{{ resource.rootdisksize }} GB
</div>
</div>
<div v-else-if="['name', 'type'].includes(item)">