mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
allow ordering and filtering of API param args
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
7d8f2a7d40
commit
b954a8171b
@ -381,8 +381,8 @@ export default {
|
||||
},
|
||||
execAction (action) {
|
||||
this.currentAction = action
|
||||
this.currentAction['params'] = store.getters.apis[this.currentAction.api]['params']
|
||||
this.currentAction['params'].sort(function (a, b) {
|
||||
var params = store.getters.apis[this.currentAction.api]['params']
|
||||
params.sort(function (a, b) {
|
||||
if (a.name === 'name' && b.name !== 'name') { return -1 }
|
||||
if (a.name !== 'name' && b.name === 'name') { return -1 }
|
||||
if (a.name === 'id') { return -1 }
|
||||
@ -390,12 +390,22 @@ export default {
|
||||
if (a.name > b.name) { return 1 }
|
||||
return 0
|
||||
})
|
||||
if (action.args && action.args.length > 0) {
|
||||
this.currentAction['params'] = action.args.map(function (arg) {
|
||||
return params.filter(function (param) {
|
||||
return param.name === arg
|
||||
})[0]
|
||||
})
|
||||
} else {
|
||||
this.currentAction['params'] = params
|
||||
}
|
||||
|
||||
this.showAction = true
|
||||
for (const param of this.currentAction['params']) {
|
||||
if (param.type === 'uuid' || param.name === 'account') {
|
||||
this.listUuidOpts(param)
|
||||
}
|
||||
}
|
||||
this.showAction = true
|
||||
this.currentAction.loading = false
|
||||
},
|
||||
listUuidOpts (param) {
|
||||
|
||||
@ -21,7 +21,7 @@ export default {
|
||||
api: 'deployVirtualMachine',
|
||||
icon: 'plus',
|
||||
label: 'Deploy VM',
|
||||
params: ['name', 'zoneid', 'diskofferingid'],
|
||||
args: ['name', 'zoneid', 'templateid', 'serviceofferingid', 'rootdisksize'],
|
||||
listView: true
|
||||
},
|
||||
{
|
||||
@ -60,21 +60,21 @@ export default {
|
||||
icon: 'usb',
|
||||
label: 'Reinstall Instance',
|
||||
dataView: true,
|
||||
params: ['virtualmachineid']
|
||||
args: ['virtualmachineid']
|
||||
},
|
||||
{
|
||||
api: 'updateVMAffinityGroup',
|
||||
icon: 'swap',
|
||||
label: 'Update Affinity Group',
|
||||
dataView: true,
|
||||
params: ['id', 'serviceofferingid']
|
||||
args: ['id', 'serviceofferingid']
|
||||
},
|
||||
{
|
||||
api: 'changeServiceForVirtualMachine',
|
||||
icon: 'sliders',
|
||||
label: 'Change Service Offering',
|
||||
dataView: true,
|
||||
params: ['id', 'serviceofferingid']
|
||||
args: ['id', 'serviceofferingid']
|
||||
},
|
||||
{
|
||||
api: 'createVMSnapshot',
|
||||
@ -87,14 +87,14 @@ export default {
|
||||
icon: 'paper-clip',
|
||||
label: 'Attach ISO',
|
||||
dataView: true,
|
||||
params: ['id', 'virtualmachineid']
|
||||
args: ['id', 'virtualmachineid']
|
||||
},
|
||||
{
|
||||
api: 'detachIso',
|
||||
icon: 'link',
|
||||
label: 'Detach ISO',
|
||||
dataView: true,
|
||||
params: ['id', 'virtualmachineid']
|
||||
args: ['id', 'virtualmachineid']
|
||||
},
|
||||
{
|
||||
api: 'migrateVirtualMachine',
|
||||
@ -108,7 +108,7 @@ export default {
|
||||
icon: 'key',
|
||||
label: 'Reset Instance Password',
|
||||
dataView: true,
|
||||
params: ['id']
|
||||
args: ['id']
|
||||
},
|
||||
{
|
||||
api: 'resetSSHKeyForVirtualMachine',
|
||||
@ -120,7 +120,7 @@ export default {
|
||||
api: 'destroyVirtualMachine',
|
||||
icon: 'delete',
|
||||
label: 'Destroy VM',
|
||||
params: ['id'],
|
||||
args: ['id'],
|
||||
dataView: true,
|
||||
groupAction: true
|
||||
}
|
||||
@ -147,13 +147,13 @@ export default {
|
||||
api: 'createSSHKeyPair',
|
||||
icon: 'plus',
|
||||
label: 'Create SSH key pair',
|
||||
params: ['name', 'publickey', 'domainid']
|
||||
args: ['name', 'publickey', 'domainid']
|
||||
},
|
||||
{
|
||||
api: 'deleteSSHKeyPair',
|
||||
icon: 'delete',
|
||||
label: 'Delete SSH key pair',
|
||||
params: ['name', 'domainid', 'account']
|
||||
args: ['name', 'domainid', 'account']
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -169,13 +169,13 @@ export default {
|
||||
api: 'createAffinityGroup',
|
||||
icon: 'plus',
|
||||
label: 'New Affinity Group',
|
||||
params: ['name', 'description', 'type']
|
||||
args: ['name', 'description', 'type']
|
||||
},
|
||||
{
|
||||
api: 'deleteAffinityGroup',
|
||||
icon: 'delete',
|
||||
label: 'Delete Affinity Group',
|
||||
params: ['id']
|
||||
args: ['id']
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ export default {
|
||||
icon: 'plus',
|
||||
label: 'Create template',
|
||||
listView: true,
|
||||
params: ['displaytext', 'format', 'hypervisor', 'name', 'ostypeid', 'url', 'account', 'bits', 'checksum', 'details', 'directdownload', 'domainid', 'isdynamicallyscalable', 'isextractable', 'isfeatured', 'ispublic', 'isrouting', 'passwordenabled', 'projectid', 'requireshvm', 'sshkeyenabled', 'templatetag', 'zoneid', 'zoneids']
|
||||
args: ['displaytext', 'format', 'hypervisor', 'name', 'ostypeid', 'url', 'account', 'bits', 'checksum', 'details', 'directdownload', 'domainid', 'isdynamicallyscalable', 'isextractable', 'isfeatured', 'ispublic', 'isrouting', 'passwordenabled', 'projectid', 'requireshvm', 'sshkeyenabled', 'templatetag', 'zoneid', 'zoneids']
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@ -15,7 +15,7 @@ export default {
|
||||
api: 'deleteNetwork',
|
||||
icon: 'delete',
|
||||
label: 'Delete Network',
|
||||
params: ['id'],
|
||||
args: ['id'],
|
||||
listView: true,
|
||||
dataView: true
|
||||
}
|
||||
|
||||
@ -17,27 +17,27 @@ export default {
|
||||
icon: 'plus',
|
||||
label: 'Create Volume',
|
||||
type: 'main',
|
||||
params: ['name', 'zoneid', 'diskofferingid'],
|
||||
args: ['name', 'zoneid', 'diskofferingid'],
|
||||
listView: true
|
||||
}, {
|
||||
api: 'uploadVolume',
|
||||
icon: 'cloud-upload',
|
||||
label: 'Upload Volume From URL',
|
||||
type: 'main',
|
||||
params: ['url', 'name', 'zoneid', 'format', 'diskofferingid', 'checksum'],
|
||||
args: ['url', 'name', 'zoneid', 'format', 'diskofferingid', 'checksum'],
|
||||
listView: true
|
||||
}, {
|
||||
api: 'getUploadParamsForVolume',
|
||||
icon: 'upload',
|
||||
label: 'Upload Local Volume',
|
||||
params: ['@file', 'name', 'zoneid', 'format', 'checksum'],
|
||||
args: ['@file', 'name', 'zoneid', 'format', 'checksum'],
|
||||
listView: true
|
||||
},
|
||||
{
|
||||
api: 'attachVolume',
|
||||
icon: 'paper-clip',
|
||||
label: 'Attach Volume',
|
||||
params: ['id', 'virtualmachineid'],
|
||||
args: ['id', 'virtualmachineid'],
|
||||
dataView: true,
|
||||
hidden: (record) => { return record.virtualmachineid }
|
||||
},
|
||||
@ -45,7 +45,7 @@ export default {
|
||||
api: 'detachVolume',
|
||||
icon: 'link',
|
||||
label: 'Detach Volume',
|
||||
params: ['id', 'virtualmachineid'],
|
||||
args: ['id', 'virtualmachineid'],
|
||||
dataView: true,
|
||||
hidden: (record) => { return !record.virtualmachineid }
|
||||
},
|
||||
@ -53,7 +53,7 @@ export default {
|
||||
api: 'migrateVolume',
|
||||
icon: 'drag',
|
||||
label: 'Migrate Volume',
|
||||
params: ['volumeid', 'storageid', 'livemigrate'],
|
||||
args: ['volumeid', 'storageid', 'livemigrate'],
|
||||
dataView: true
|
||||
},
|
||||
{
|
||||
@ -61,14 +61,14 @@ export default {
|
||||
icon: 'fullscreen',
|
||||
label: 'Resize Volume',
|
||||
type: 'main',
|
||||
params: ['id', 'virtualmachineid'],
|
||||
args: ['id', 'virtualmachineid'],
|
||||
dataView: true
|
||||
},
|
||||
{
|
||||
api: 'extractVolume',
|
||||
icon: 'cloud-download',
|
||||
label: 'Download Volume',
|
||||
params: ['id', 'zoneid', 'mode'],
|
||||
args: ['id', 'zoneid', 'mode'],
|
||||
paramOptions: {
|
||||
'mode': {
|
||||
'value': 'HTTP_DOWNLOAD'
|
||||
@ -80,7 +80,7 @@ export default {
|
||||
api: 'deleteVolume',
|
||||
icon: 'delete',
|
||||
label: 'Delete Volume',
|
||||
params: ['id'],
|
||||
args: ['id'],
|
||||
dataView: true,
|
||||
groupAction: true
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user