mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-01 03:36:04 +08:00
add encrypt image and decrypt image actions
Signed-off-by: andy.lee <andy.lee@suse.com>
This commit is contained in:
@@ -57,6 +57,20 @@ export default class HciVmImage extends HarvesterResource {
|
||||
label: this.t('harvester.action.createVM'),
|
||||
disabled: !this.isReady,
|
||||
},
|
||||
{
|
||||
action: 'encryptImage',
|
||||
enabled: !this.isEncrypted,
|
||||
icon: 'icon icon-lock',
|
||||
label: this.t('harvester.action.encryptImage'),
|
||||
disabled: !this.isReady,
|
||||
},
|
||||
{
|
||||
action: 'decryptImage',
|
||||
enabled: this.isEncrypted,
|
||||
icon: 'icon icon-unlock',
|
||||
label: this.t('harvester.action.decryptImage'),
|
||||
disabled: !this.isReady,
|
||||
},
|
||||
{
|
||||
action: 'download',
|
||||
enabled: this.links?.download,
|
||||
@@ -67,6 +81,36 @@ export default class HciVmImage extends HarvesterResource {
|
||||
];
|
||||
}
|
||||
|
||||
encryptImage() {
|
||||
const router = this.currentRouter();
|
||||
|
||||
router.push({
|
||||
name: `${ HARVESTER_PRODUCT }-c-cluster-resource-create`,
|
||||
params: { resource: HCI.IMAGE },
|
||||
query: {
|
||||
image: this,
|
||||
fromPage: HCI.IMAGE,
|
||||
sourceType: 'clone',
|
||||
cryptoOperation: 'encrypt'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
decryptImage() {
|
||||
const router = this.currentRouter();
|
||||
|
||||
router.push({
|
||||
name: `${ HARVESTER_PRODUCT }-c-cluster-resource-create`,
|
||||
params: { resource: HCI.IMAGE },
|
||||
query: {
|
||||
image: this,
|
||||
fromPage: HCI.IMAGE,
|
||||
sourceType: 'clone',
|
||||
cryptoOperation: 'decrypt'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
applyDefaults(resources = this, realMode) {
|
||||
if (realMode !== _CLONE) {
|
||||
this.metadata['labels'] = { [HCI_ANNOTATIONS.OS_TYPE]: '', [HCI_ANNOTATIONS.IMAGE_SUFFIX]: '' };
|
||||
@@ -151,6 +195,10 @@ export default class HciVmImage extends HarvesterResource {
|
||||
!!this.spec.securityParameters?.sourceImageNamespace;
|
||||
}
|
||||
|
||||
get displayNameWithNamespace() {
|
||||
return `${ this.metadata.namespace }/${ this.spec.displayName }`;
|
||||
}
|
||||
|
||||
get imageMessage() {
|
||||
if (this.uploadError) {
|
||||
return ucFirst(this.uploadError);
|
||||
|
||||
Reference in New Issue
Block a user