From 1647c556396a576141a5c0a012133038e3bd0d88 Mon Sep 17 00:00:00 2001
From: davidjumani
Date: Wed, 8 Jul 2020 12:32:39 +0530
Subject: [PATCH] compute: Simplifying Deploy VM Wizard (#499)
Fixes #490
Fixes #491
Signed-off-by: Rohit Yadav
---
ui/src/locales/en.json | 1 +
ui/src/views/compute/DeployVM.vue | 95 +++++++++++--------
.../compute/wizard/AffinityGroupSelection.vue | 1 +
.../compute/wizard/DiskSizeSelection.vue | 36 ++++---
4 files changed, 82 insertions(+), 51 deletions(-)
diff --git a/ui/src/locales/en.json b/ui/src/locales/en.json
index 285fafa2070..f8530b4f0f4 100644
--- a/ui/src/locales/en.json
+++ b/ui/src/locales/en.json
@@ -1408,6 +1408,7 @@
"label.overprovisionfactor": "Overprovisioning Factor",
"label.override.guest.traffic": "Override Guest-Traffic",
"label.override.public.traffic": "Override Public-Traffic",
+"label.override.rootdisk.size": "Override Root Disk Size",
"label.overrideguesttraffic": "Override Guest-Traffic",
"label.overridepublictraffic": "Override Public-Traffic",
"label.ovf.properties": "OVF Properties",
diff --git a/ui/src/views/compute/DeployVM.vue b/ui/src/views/compute/DeployVM.vue
index ce7084bbeb0..cd1836e2743 100644
--- a/ui/src/views/compute/DeployVM.vue
+++ b/ui/src/views/compute/DeployVM.vue
@@ -89,12 +89,18 @@
:selected="tabKey"
:loading="loading.templates"
:preFillContent="dataPreFill"
- @update-template-iso="updateFieldValue"
- >
+ @update-template-iso="updateFieldValue" />
+
+ {{ $t('label.override.rootdisk.size') }}
+ { this.showRootDiskSizeChanger = val }" style="margin-left: 10px;"/>
+
+ :minDiskSize="dataPreFill.minrootdisksize"
+ @update-disk-size="updateFieldValue"
+ style="margin-top: 10px;"/>
{{ $t('message.iso.desc') }}
@@ -203,24 +209,6 @@
-
-
-
-
updateAffinityGroups($event)"
- @handle-search-filter="($event) => handleSearchFilter('affinityGroups', $event)"
- >
-
-
-
@@ -265,25 +253,14 @@
- {{ $t('message.vm.review.launch') }}
-
-
-
-
-
-
-
-
-
-
+
+ {{ $t('label.isadvanced') }}
+ { this.showDetails = val }" style="margin-left: 10px"/>
+
+
@@ -317,6 +294,40 @@
v-decorator="['userdata']">
+
+ updateAffinityGroups($event)"
+ @handle-search-filter="($event) => handleSearchFilter('affinityGroups', $event)"/>
+
+
+
+
+
+
+
+ {{ $t('message.vm.review.launch') }}
+
+
+
+
+
+
+
+
+
@@ -505,7 +516,9 @@ export default {
}
],
tabKey: 'templateid',
- dataPreFill: {}
+ dataPreFill: {},
+ showDetails: false,
+ showRootDiskSizeChanger: false
}
},
computed: {
@@ -880,6 +893,10 @@ export default {
templateid: value,
isoid: null
})
+ const templates = this.options.templates.filter(x => x.id === value)
+ if (templates.length > 0) {
+ this.dataPreFill.minrootdisksize = templates[0].size / (1024 * 1024 * 1024) || 0 // bytes to GB
+ }
} else if (name === 'isoid') {
this.tabKey = 'isoid'
this.form.setFieldsValue({
diff --git a/ui/src/views/compute/wizard/AffinityGroupSelection.vue b/ui/src/views/compute/wizard/AffinityGroupSelection.vue
index 25a9fbd8cea..8c6d5e9f480 100644
--- a/ui/src/views/compute/wizard/AffinityGroupSelection.vue
+++ b/ui/src/views/compute/wizard/AffinityGroupSelection.vue
@@ -17,6 +17,7 @@
+ {{ $t('message.select.affinity.groups') }}
-
- updateDiskSize($event)"
- />
-
updateDiskSize($event)"
/>
- GB
+ GB
+ {{ $t(error) }}
@@ -52,11 +45,23 @@ export default {
preFillContent: {
type: Object,
default: () => {}
+ },
+ minDiskSize: {
+ type: Number,
+ default: 0
+ }
+ },
+ watch: {
+ minDiskSize (newItem) {
+ if (this.inputValue < newItem) {
+ this.inputValue = newItem
+ }
}
},
data () {
return {
- inputValue: 0
+ inputValue: 0,
+ error: false
}
},
mounted () {
@@ -64,14 +69,21 @@ export default {
},
methods: {
fillValue () {
+ this.inputValue = this.minDiskSize
if (this.inputDecorator === 'rootdisksize') {
- this.inputValue = this.preFillContent.rootdisksize ? this.preFillContent.rootdisksize : 0
+ this.inputValue = this.preFillContent.rootdisksize ? this.preFillContent.rootdisksize : this.minDiskSize
} else if (this.inputDecorator === 'size') {
- this.inputValue = this.preFillContent.size ? this.preFillContent.size : 0
+ this.inputValue = this.preFillContent.size ? this.preFillContent.size : this.minDiskSize
}
this.$emit('update-disk-size', this.inputDecorator, this.inputValue)
},
updateDiskSize (value) {
+ if (value < this.minDiskSize) {
+ this.inputValue = this.minDiskSize
+ this.error = 'The value must not be less than ' + this.minDiskSize + ' GB'
+ return
+ }
+ this.error = false
this.$emit('update-disk-size', this.inputDecorator, value)
}
}