From 2490b5d93ed581f61d98e6e989eae729132bd19e Mon Sep 17 00:00:00 2001
From: dahn
Date: Tue, 16 Jun 2020 11:53:20 +0200
Subject: [PATCH] compute: VMware Bootintobios (#313)
UI implementation for apache/cloudstack#4021
Signed-off-by: Rohit Yadav
Co-authored-by: Daan Hoogland
Co-authored-by: Abhishek Kumar
Co-authored-by: Rohit Yadav
---
ui/src/config/section/compute.js | 24 ++++++++++++++++++++++--
ui/src/locales/en.json | 1 +
ui/src/utils/request.js | 3 ++-
ui/src/views/compute/DeployVM.vue | 12 +++++++++++-
4 files changed, 36 insertions(+), 4 deletions(-)
diff --git a/ui/src/config/section/compute.js b/ui/src/config/section/compute.js
index 94dd2d0d7d4..f948d340ba0 100644
--- a/ui/src/config/section/compute.js
+++ b/ui/src/config/section/compute.js
@@ -89,7 +89,18 @@ export default {
dataView: true,
groupAction: true,
show: (record) => { return ['Stopped'].includes(record.state) },
- args: (record, store) => { return ['Admin'].includes(store.userInfo.roletype) ? ['podid', 'clusterid', 'hostid'] : [] },
+ args: (record, store) => {
+ var fields = []
+ if (store.userInfo.roletype === 'Admin') {
+ fields = ['podid', 'clusterid', 'hostid']
+ }
+ if (record.hypervisor === 'VMware') {
+ if (store.apis.startVirtualMachine.params.filter(x => x.name === 'bootintosetup').length > 0) {
+ fields.push('bootintosetup')
+ }
+ }
+ return fields
+ },
response: (result) => { return result.virtualmachine && result.virtualmachine.password ? `Password of the VM is ${result.virtualmachine.password}` : null }
},
{
@@ -109,7 +120,16 @@ export default {
label: 'label.action.reboot.instance',
message: 'message.action.reboot.instance',
dataView: true,
- show: (record) => { return ['Running'].includes(record.state) }
+ show: (record) => { return ['Running'].includes(record.state) },
+ args: (record, store) => {
+ var fields = []
+ if (record.hypervisor === 'VMware') {
+ if (store.apis.rebootVirtualMachine.params.filter(x => x.name === 'bootintosetup').length > 0) {
+ fields.push('bootintosetup')
+ }
+ }
+ return fields
+ }
},
{
api: 'restoreVirtualMachine',
diff --git a/ui/src/locales/en.json b/ui/src/locales/en.json
index cae08699413..43ac0d419d1 100644
--- a/ui/src/locales/en.json
+++ b/ui/src/locales/en.json
@@ -458,6 +458,7 @@
"label.bladeid": "Blade ID",
"label.blades": "Blades",
"label.bootable": "Bootable",
+"label.bootintosetup": "Boot into hardware setup",
"label.broadcastdomainrange": "Broadcast domain range",
"label.broadcastdomaintype": "Broadcast Domain Type",
"label.broadcasturi": "Broadcast URI",
diff --git a/ui/src/utils/request.js b/ui/src/utils/request.js
index 0582ee85014..1131a6e4f6f 100644
--- a/ui/src/utils/request.js
+++ b/ui/src/utils/request.js
@@ -18,6 +18,7 @@
import Vue from 'vue'
import axios from 'axios'
import config from '@/config/settings'
+import router from '@/router'
import store from '@/store'
import { VueAxios } from './axios'
import notification from 'ant-design-vue/es/notification'
@@ -53,7 +54,7 @@ const err = (error) => {
}
if (response.status === 404) {
notification.error({ message: 'Not Found', description: 'Resource not found' })
- this.$router.push({ path: '/exception/404' })
+ router.push({ path: '/exception/404' })
}
}
if (error.isAxiosError && !error.response) {
diff --git a/ui/src/views/compute/DeployVM.vue b/ui/src/views/compute/DeployVM.vue
index 088cddc007e..4071a7a2616 100644
--- a/ui/src/views/compute/DeployVM.vue
+++ b/ui/src/views/compute/DeployVM.vue
@@ -133,6 +133,11 @@
@change="value => this.hypervisor = value" />
+
+
+
+
@@ -416,7 +421,8 @@ export default {
DISK_OFFERING: 3,
AFFINITY_GROUP: 4,
NETWORK: 5,
- SSH_KEY_PAIR: 6
+ SSH_KEY_PAIR: 6,
+ ENABLE_SETUP: 7
},
initDataConfig: {},
defaultNetwork: '',
@@ -946,6 +952,10 @@ export default {
deployVmData.keypair = values.keypair
deployVmData.name = values.name
deployVmData.displayname = values.name
+ // step 8: enter setup
+ if ('bootintosetup' in values) {
+ deployVmData.bootintosetup = values.bootintosetup
+ }
const title = this.$t('label.launch.vm')
const description = values.name || ''
const password = this.$t('label.password')