mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-13 21:21:44 +00:00
(cherry picked from commit 5841508b2619c685d819738955545da51a0c1dca) Co-authored-by: Yiya Chen <yiya.chen@suse.com>
This commit is contained in:
parent
f8fa82f614
commit
9ee81f4054
@ -50,35 +50,45 @@ export default class HciVmImage extends HarvesterResource {
|
|||||||
canCreateVM = false;
|
canCreateVM = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
const customActions = this.isReady ? [
|
||||||
{
|
{
|
||||||
action: 'createFromImage',
|
action: 'createFromImage',
|
||||||
enabled: canCreateVM,
|
enabled: canCreateVM,
|
||||||
icon: 'icon icon-circle-plus',
|
icon: 'icon icon-circle-plus',
|
||||||
label: this.t('harvester.action.createVM'),
|
label: this.t('harvester.action.createVM'),
|
||||||
disabled: !this.isReady,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
action: 'encryptImage',
|
action: 'encryptImage',
|
||||||
enabled: this.volumeEncryptionFeatureEnabled && !this.isEncrypted,
|
enabled: this.volumeEncryptionFeatureEnabled && !this.isEncrypted,
|
||||||
icon: 'icon icon-lock',
|
icon: 'icon icon-lock',
|
||||||
label: this.t('harvester.action.encryptImage'),
|
label: this.t('harvester.action.encryptImage'),
|
||||||
disabled: !this.isReady,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
action: 'decryptImage',
|
action: 'decryptImage',
|
||||||
enabled: this.volumeEncryptionFeatureEnabled && this.isEncrypted,
|
enabled: this.volumeEncryptionFeatureEnabled && this.isEncrypted,
|
||||||
icon: 'icon icon-unlock',
|
icon: 'icon icon-unlock',
|
||||||
label: this.t('harvester.action.decryptImage'),
|
label: this.t('harvester.action.decryptImage'),
|
||||||
disabled: !this.isReady,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
action: 'imageDownload',
|
action: 'imageDownload',
|
||||||
enabled: this.links?.download,
|
enabled: this.links?.download,
|
||||||
icon: 'icon icon-download',
|
icon: 'icon icon-download',
|
||||||
label: this.t('asyncButton.download.action'),
|
label: this.t('asyncButton.download.action'),
|
||||||
},
|
}
|
||||||
...out
|
] : [];
|
||||||
|
|
||||||
|
let filteredOut;
|
||||||
|
|
||||||
|
if (customActions.length > 0) {
|
||||||
|
filteredOut = out;
|
||||||
|
} else {
|
||||||
|
// if the first item is a divider, remove it from the array
|
||||||
|
filteredOut = out[0]?.divider ? out.slice(1) : out;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
...customActions,
|
||||||
|
...filteredOut
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user