diff --git a/src/config/section/compute.js b/src/config/section/compute.js index 94dd2d0d7..f948d340b 100644 --- a/src/config/section/compute.js +++ b/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/src/locales/en.json b/src/locales/en.json index cae086994..43ac0d419 100644 --- a/src/locales/en.json +++ b/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/src/utils/request.js b/src/utils/request.js index 0582ee850..1131a6e4f 100644 --- a/src/utils/request.js +++ b/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/src/views/compute/DeployVM.vue b/src/views/compute/DeployVM.vue index 088cddc00..4071a7a26 100644 --- a/src/views/compute/DeployVM.vue +++ b/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')