Skip to content
This repository was archived by the owner on Jan 20, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions src/config/section/compute.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DaanHoogland I've tested and fixed a case here - we want to make Primate work with all recent/pass/future version of CloudStack; so if there's a feature adding new params for autogenerated forms, we can check if the param is available by checking the API discovery /cc @shwstppr @davidjumani

fields.push('bootintosetup')
}
}
return fields
},
response: (result) => { return result.virtualmachine && result.virtualmachine.password ? `Password of the VM is ${result.virtualmachine.password}` : null }
},
{
Expand All @@ -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',
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion src/utils/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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) {
Expand Down
12 changes: 11 additions & 1 deletion src/views/compute/DeployVM.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@
@change="value => this.hypervisor = value" />
</a-form-item>
</p>
<a-form-item :label="this.$t('label.bootintosetup')" v-if="zoneSelected && ((tabKey === 'isoid' && hypervisor === 'VMware') || (tabKey === 'templateid' && template && template.hypervisor === 'VMware'))" >
<a-switch
v-decorator="['bootintosetup']">
</a-switch>
</a-form-item>
</a-card>
<a-form-item class="form-item-hidden">
<a-input v-decorator="['templateid']"/>
Expand Down Expand Up @@ -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: '',
Expand Down Expand Up @@ -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')
Expand Down