From 4916f3c90d1aee8c5eadff05b51c3e3ed150dd1c Mon Sep 17 00:00:00 2001 From: Hoang Nguyen Date: Mon, 10 Jan 2022 20:34:46 +0700 Subject: [PATCH] UI - Fix Locked "Override Root Disk Size" switch (#5843) * Fix Locked "Override Root Disk Size" switch * fixes ut --- ui/src/views/compute/DeployVM.vue | 3 ++- ui/tests/unit/views/AutogenView.spec.js | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ui/src/views/compute/DeployVM.vue b/ui/src/views/compute/DeployVM.vue index bc59d58ce51..979343a8731 100644 --- a/ui/src/views/compute/DeployVM.vue +++ b/ui/src/views/compute/DeployVM.vue @@ -1133,7 +1133,7 @@ export default { this.vm.hostname = host.name } - if (this.serviceOffering.rootdisksize) { + if (this.serviceOffering?.rootdisksize) { this.vm.disksizetotalgb = this.serviceOffering.rootdisksize } else if (this.diskSize) { this.vm.disksizetotalgb = this.diskSize @@ -2097,6 +2097,7 @@ export default { this.updateComputeOffering(null) }, updateTemplateConfigurationOfferingDetails (offeringId) { + this.rootDiskSizeFixed = 0 var offering = this.serviceOffering if (!offering || offering.id !== offeringId) { offering = _.find(this.options.serviceOfferings, (option) => option.id === offeringId) diff --git a/ui/tests/unit/views/AutogenView.spec.js b/ui/tests/unit/views/AutogenView.spec.js index 9a20a0a3306..99df7d9fa42 100644 --- a/ui/tests/unit/views/AutogenView.spec.js +++ b/ui/tests/unit/views/AutogenView.spec.js @@ -57,7 +57,11 @@ mocks = { return option }), info: jest.fn((option) => { - return option + return { + message: option.message, + description: 'test-description', + duration: option.duration + } }), success: jest.fn((option) => { return option