mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-01 03:36:04 +08:00
feat: add persistent state checkbox
Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
This commit is contained in:
@@ -1384,25 +1384,30 @@ export default {
|
||||
},
|
||||
|
||||
setBootMethod(boot = { efi: false, secureBoot: false }) {
|
||||
if (boot.efi && boot.secureBoot) {
|
||||
set(this.spec.template.spec.domain, 'features.smm.enabled', true);
|
||||
set(this.spec.template.spec.domain, 'firmware.bootloader.efi.secureBoot', true);
|
||||
} else if (boot.efi && !boot.secureBoot) {
|
||||
// set(this.spec.template.spec.domain, 'features.smm.enabled', false);
|
||||
|
||||
try {
|
||||
delete this.spec.template.spec.domain.features.smm['enabled'];
|
||||
const noKeys = Object.keys(this.spec.template.spec.domain.features.smm).length === 0;
|
||||
|
||||
if (noKeys) {
|
||||
delete this.spec.template.spec.domain.features['smm'];
|
||||
}
|
||||
} catch (e) {}
|
||||
set(this.spec.template.spec.domain, 'firmware.bootloader.efi.secureBoot', false);
|
||||
} else {
|
||||
if (!boot.efi) {
|
||||
delete this.spec.template.spec.domain['firmware'];
|
||||
delete this.spec.template.spec.domain.features['smm'];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
set(this.spec.template.spec.domain, 'firmware.bootloader.efi.persistent', true);
|
||||
set(this.spec.template.spec.domain, 'firmware.bootloader.efi.secureBoot', !!boot.secureBoot);
|
||||
|
||||
if (boot.secureBoot) {
|
||||
set(this.spec.template.spec.domain, 'features.smm.enabled', true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const smm = this.spec.template.spec.domain.features.smm;
|
||||
|
||||
delete smm['enabled'];
|
||||
if (Object.keys(smm).length === 0) {
|
||||
delete this.spec.template.spec.domain.features['smm'];
|
||||
}
|
||||
} catch (e) {}
|
||||
},
|
||||
|
||||
setCpuPinning(value) {
|
||||
@@ -1415,7 +1420,7 @@ export default {
|
||||
|
||||
setTPM(tpmEnabled) {
|
||||
if (tpmEnabled) {
|
||||
set(this.spec.template.spec.domain.devices, 'tpm', {});
|
||||
set(this.spec.template.spec.domain.devices, 'tpm.persistent', true);
|
||||
} else {
|
||||
delete this.spec.template.spec.domain.devices['tpm'];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user