mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-01 03:36:04 +08:00
show volume encryption in vm detail volume tab
Signed-off-by: andy.lee <andy.lee@suse.com>
This commit is contained in:
@@ -214,7 +214,7 @@ export default class HciPv extends HarvesterResource {
|
||||
}
|
||||
|
||||
get isEncrypted() {
|
||||
return this.relatedPV?.spec.csi.volumeAttributes.encrypted || false;
|
||||
return Boolean(this.relatedPV?.spec.csi.volumeAttributes.encrypted) || false;
|
||||
}
|
||||
|
||||
get longhornVolume() {
|
||||
|
||||
@@ -574,27 +574,20 @@ export default class VirtVm extends HarvesterResource {
|
||||
return vmis.find(VMI => VMI.id === this.id);
|
||||
}
|
||||
|
||||
get isVMImageEncrypted() {
|
||||
const inStore = this.productInStore;
|
||||
const imageList = this.$rootGetters[`${ inStore }/all`](HCI.IMAGE);
|
||||
const rootImage = imageList.find(image => this.rootImageId === image.id);
|
||||
|
||||
return rootImage?.isEncrypted || false;
|
||||
}
|
||||
|
||||
get isVolumeEncrypted() {
|
||||
get encryptedVolumeType() {
|
||||
const inStore = this.productInStore;
|
||||
const pvcs = this.$rootGetters[`${ inStore }/all`](PVC);
|
||||
|
||||
// filter out the root image PVC
|
||||
const nonRootImagePVCs = pvcs.filter(pvc => !pvc.metadata.annotations[HCI_ANNOTATIONS.IMAGE_ID]);
|
||||
const volumeClaimNames = this.spec.template.spec.volumes?.map(v => v.persistentVolumeClaim?.claimName).filter(v => !!v) || [];
|
||||
const volumes = pvcs.filter(pvc => volumeClaimNames.includes(pvc.metadata.name));
|
||||
|
||||
const volumeClaimNames = this.spec.template.spec.volumes?.map(v => v.persistentVolumeClaim?.claimName).map(v => v) || [];
|
||||
|
||||
const pvcVolumes = nonRootImagePVCs.filter(pvc => volumeClaimNames.includes(pvc.metadata.name));
|
||||
|
||||
// if any non-rootImage PCV volume is encrypted, return true, otherwise return false
|
||||
return pvcVolumes.some(pvcVol => pvcVol.isEncrypted) ;
|
||||
if (volumes.every(vol => vol.isEncrypted)) {
|
||||
return 'all';
|
||||
} else if (volumes.some(vol => vol.isEncrypted)) {
|
||||
return 'partial';
|
||||
} else {
|
||||
return 'none';
|
||||
}
|
||||
}
|
||||
|
||||
get isError() {
|
||||
|
||||
Reference in New Issue
Block a user