You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2020/05/07 17:17:03 UTC
[cloudstack-primate] branch master updated: compute: fix vm actions
show conditions (#329)
This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack-primate.git
The following commit(s) were added to refs/heads/master by this push:
new 4b03da7 compute: fix vm actions show conditions (#329)
4b03da7 is described below
commit 4b03da7c995824160b765f09bedaa80f8f43521c
Author: Abhishek Kumar <ab...@gmail.com>
AuthorDate: Thu May 7 22:46:53 2020 +0530
compute: fix vm actions show conditions (#329)
Fixes #173
Signed-off-by: Abhishek Kumar <ab...@gmail.com>
---
src/config/section/compute.js | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/src/config/section/compute.js b/src/config/section/compute.js
index b19d398..25e3c68 100644
--- a/src/config/section/compute.js
+++ b/src/config/section/compute.js
@@ -76,7 +76,8 @@ export default {
icon: 'edit',
label: 'Update VM',
dataView: true,
- args: ['name', 'displayname', 'ostypeid', 'isdynamicallyscalable', 'haenable', 'group']
+ args: ['name', 'displayname', 'ostypeid', 'isdynamicallyscalable', 'haenable', 'group'],
+ show: (record) => { return ['Stopped'].includes(record.state) }
},
{
api: 'startVirtualMachine',
@@ -112,6 +113,7 @@ export default {
label: 'label.reinstall.vm',
dataView: true,
args: ['virtualmachineid', 'templateid'],
+ show: (record) => { return ['Running', 'Stopped'].includes(record.state) },
mapping: {
virtualmachineid: {
value: (record) => { return record.id }
@@ -196,7 +198,7 @@ export default {
label: 'label.action.attach.iso',
dataView: true,
args: ['id', 'virtualmachineid'],
- show: (record) => { return !record.isoid },
+ show: (record) => { return ['Running', 'Stopped'].includes(record.state) && !record.isoid },
mapping: {
id: {
api: 'listIsos'
@@ -212,7 +214,7 @@ export default {
label: 'label.action.detach.iso',
dataView: true,
args: ['virtualmachineid'],
- show: (record) => { return 'isoid' in record && record.isoid },
+ show: (record) => { return ['Running', 'Stopped'].includes(record.state) && 'isoid' in record && record.isoid },
mapping: {
virtualmachineid: {
value: (record, params) => { return record.id }
@@ -248,7 +250,7 @@ export default {
icon: 'drag',
label: 'label.migrate.instance.to.host',
dataView: true,
- show: (record) => { return ['Running'].includes(record.state) },
+ show: (record, store) => { return ['Running'].includes(record.state) && ['Admin'].includes(store.userInfo.roletype) },
component: () => import('@/views/compute/MigrateWizard'),
popup: true,
args: ['hostid', 'virtualmachineid'],
@@ -263,7 +265,7 @@ export default {
icon: 'drag',
label: 'label.migrate.instance.to.ps',
dataView: true,
- show: (record) => { return ['Stopped'].includes(record.state) },
+ show: (record, store) => { return ['Stopped'].includes(record.state) && ['Admin'].includes(store.userInfo.roletype) },
args: ['storageid', 'virtualmachineid'],
mapping: {
storageid: {
@@ -279,7 +281,7 @@ export default {
icon: 'key',
label: 'Reset Instance Password',
dataView: true,
- show: (record) => { return ['Stopped'].includes(record.state) },
+ show: (record) => { return ['Running', 'Stopped'].includes(record.state) },
response: (result) => { return result.virtualmachine && result.virtualmachine.password ? `Password of the VM is ${result.virtualmachine.password}` : null }
},
{
@@ -288,7 +290,7 @@ export default {
label: 'Reset SSH Key',
dataView: true,
args: ['keypair'],
- show: (record) => { return ['Stopped'].includes(record.state) },
+ show: (record) => { return ['Running', 'Stopped'].includes(record.state) },
mapping: {
keypair: {
api: 'listSSHKeyPairs'
@@ -315,14 +317,14 @@ export default {
icon: 'medicine-box',
label: 'label.recover.vm',
dataView: true,
- show: (record) => { return ['Destroyed'].includes(record.state) }
+ show: (record, store) => { return ['Destroyed'].includes(record.state) && store.features.allowuserexpungerecovervm }
},
{
api: 'expungeVirtualMachine',
icon: 'delete',
label: 'label.action.expunge.instance',
dataView: true,
- show: (record) => { return ['Destroyed'].includes(record.state) }
+ show: (record, store) => { return ['Destroyed', 'Expunging'].includes(record.state) && store.features.allowuserexpungerecovervm }
},
{
api: 'destroyVirtualMachine',
@@ -330,7 +332,8 @@ export default {
label: 'label.action.destroy.instance',
args: ['expunge', 'volumeids'],
dataView: true,
- groupAction: true
+ groupAction: true,
+ show: (record) => { return ['Running', 'Stopped', 'Error'].includes(record.state) }
}
]
},