mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-01 03:36:04 +08:00
add lock icon in VM list page
This commit is contained in:
@@ -214,11 +214,7 @@ export default class HciPv extends HarvesterResource {
|
||||
}
|
||||
|
||||
get isEncrypted() {
|
||||
const inStore = this.$rootGetters['currentProduct'].inStore;
|
||||
|
||||
const longhornVolume = this.$rootGetters[`${ inStore }/all`](LONGHORN.VOLUMES).find(v => v.metadata?.name === this.spec?.volumeName);
|
||||
|
||||
return longhornVolume?.spec.encrypted || false;
|
||||
return this.relatedPV?.spec.csi.volumeAttributes.encrypted || false;
|
||||
}
|
||||
|
||||
get longhornVolume() {
|
||||
|
||||
@@ -574,6 +574,29 @@ 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() {
|
||||
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).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) ;
|
||||
}
|
||||
|
||||
get isError() {
|
||||
const conditions = get(this.vmi, 'status.conditions');
|
||||
const vmiFailureCond = findBy(conditions, 'type', 'Failure');
|
||||
|
||||
Reference in New Issue
Block a user