From 135ddf8b98edbd3aab80fba1cdced3ab67c19a03 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Mon, 25 Nov 2019 06:48:01 +0530 Subject: [PATCH] config: action args remapping framework This implements actions args remapping framework which allows developers to specify how to provide/show args to the user/admin or how to override based on the resource by means of (a) `value(record)` function, (b) statically defined `api` name, (c) `options` array. For example, in the config file: ``` args: ['id', 'virtualmachineid', 'mode'], mapping: { id: { api: 'listIsos' }, virtualmachineid: { value: (record, params) => { return record.id } }, mode: { options: ['http', 'nfs', 'something else'] } } ``` Signed-off-by: Rohit Yadav --- ui/src/config/section/compute.js | 91 ++++++++++++++----- ui/src/config/section/iam.js | 36 ++++---- ui/src/config/section/image.js | 20 ++-- ui/src/config/section/infra/clusters.js | 7 +- ui/src/config/section/infra/hosts.js | 9 +- ui/src/config/section/infra/pods.js | 7 +- .../config/section/infra/primaryStorages.js | 6 +- ui/src/config/section/infra/routers.js | 10 +- .../config/section/infra/secondaryStorages.js | 3 +- ui/src/config/section/infra/systemVms.js | 8 +- ui/src/config/section/infra/zones.js | 9 +- ui/src/config/section/network.js | 12 +-- ui/src/config/section/offering.js | 25 ++--- ui/src/config/section/project.js | 7 +- ui/src/config/section/storage.js | 87 +++++++++++++----- ui/src/views/AutogenView.vue | 87 ++++++++++++++---- 16 files changed, 260 insertions(+), 164 deletions(-) diff --git a/ui/src/config/section/compute.js b/ui/src/config/section/compute.js index aa3277b559f..b51840056cb 100644 --- a/ui/src/config/section/compute.js +++ b/ui/src/config/section/compute.js @@ -90,7 +90,7 @@ export default { docHelp: 'adminguide/virtual_machines.html#stopping-and-starting-vms', dataView: true, groupAction: true, - args: ['id', 'forced'], + args: ['forced'], show: (record) => { return ['Running'].includes(record.state) } }, { @@ -98,7 +98,6 @@ export default { icon: 'reload', label: 'label.action.reboot.instance', dataView: true, - args: ['id'], show: (record) => { return ['Running'].includes(record.state) } }, { @@ -106,7 +105,12 @@ export default { icon: 'sync', label: 'label.reinstall.vm', dataView: true, - args: ['virtualmachineid', 'templateid'] + args: ['virtualmachineid', 'templateid'], + mapping: { + virtualmachineid: { + value: (record) => { return record.id } + } + } }, { api: 'createVMSnapshot', @@ -114,7 +118,12 @@ export default { label: 'Create VM Snapshot', dataView: true, args: ['virtualmachineid', 'name', 'description', 'snapshotmemory', 'quiescevm'], - show: (record) => { return ['Running'].includes(record.state) } + show: (record) => { return ['Running'].includes(record.state) }, + mapping: { + virtualmachineid: { + value: (record, params) => { return record.id } + } + } }, { api: 'attachIso', @@ -122,15 +131,28 @@ export default { label: 'label.action.attach.iso', dataView: true, args: ['id', 'virtualmachineid'], - show: (record) => { return !record.isoid } + show: (record) => { return !record.isoid }, + mapping: { + id: { + api: 'listIsos' + }, + virtualmachineid: { + value: (record, params) => { return record.id } + } + } }, { api: 'detachIso', icon: 'link', label: 'label.action.detach.iso', dataView: true, - args: ['id', 'virtualmachineid'], - show: (record) => { return 'isoid' in record && record.isoid } + args: ['virtualmachineid'], + show: (record) => { return 'isoid' in record && record.isoid }, + mapping: { + virtualmachineid: { + value: (record, params) => { return record.id } + } + } }, { api: 'migrateVirtualMachine', @@ -158,7 +180,7 @@ export default { icon: 'swap', label: 'label.change.affinity', dataView: true, - args: ['id', 'serviceofferingid'], + args: ['affinitygroupids'], show: (record) => { return ['Stopped'].includes(record.state) } }, { @@ -166,15 +188,15 @@ export default { icon: 'arrows-alt', label: 'Scale VM', dataView: true, - args: ['id', 'serviceofferingid', 'details'], - show: (record) => { return record.state === 'Stopped' || record.hypervisor === 'VMWare' } + args: ['serviceofferingid', 'details'], + show: (record) => { return record.hypervisor !== 'KVM' } }, { api: 'changeServiceForVirtualMachine', icon: 'sliders', label: 'Change Service Offering', dataView: true, - args: ['id', 'serviceofferingid'], + args: ['serviceofferingid'], show: (record) => { return ['Stopped'].includes(record.state) } }, { @@ -182,7 +204,6 @@ export default { icon: 'key', label: 'Reset Instance Password', dataView: true, - args: ['id'], show: (record) => { return ['Stopped'].includes(record.state) } }, { @@ -190,20 +211,31 @@ export default { icon: 'lock', label: 'Reset SSH Key', dataView: true, - show: (record) => { return ['Stopped'].includes(record.state) } + args: ['keypair'], + show: (record) => { return ['Stopped'].includes(record.state) }, + mapping: { + keypair: { + api: 'listSSHKeyPairs' + } + } }, { api: 'assignVirtualMachine', icon: 'user-add', label: 'Assign Instance to Another Account', dataView: true, - show: (record) => { return ['Stopped'].includes(record.state) } + show: (record) => { return ['Stopped'].includes(record.state) }, + args: ['virtualmachineid', 'account', 'domainid'], + mapping: { + virtualmachineid: { + value: (record, params) => { return record.id } + } + } }, { api: 'recoverVirtualMachine', icon: 'medicine-box', label: 'label.recover.vm', - args: ['id'], dataView: true, show: (record) => { return ['Destroyed'].includes(record.state) } }, @@ -211,7 +243,6 @@ export default { api: 'expungeVirtualMachine', icon: 'delete', label: 'label.action.expunge.instance', - args: ['id'], dataView: true, show: (record) => { return ['Destroyed'].includes(record.state) } }, @@ -219,7 +250,7 @@ export default { api: 'destroyVirtualMachine', icon: 'delete', label: 'label.action.destroy.instance', - args: ['id', 'expunge', 'volumeids'], + args: ['expunge', 'volumeids'], dataView: true, groupAction: true } @@ -266,8 +297,7 @@ export default { api: 'deleteInstanceGroup', icon: 'delete', label: 'Delete Instance Group', - dataView: true, - args: ['id'] + dataView: true } ] }, @@ -304,7 +334,18 @@ export default { icon: 'delete', label: 'Delete SSH key pair', dataView: true, - args: ['name', 'account', 'domainid'] + args: ['name', 'account', 'domainid'], + mapping: { + name: { + value: (record, params) => { return record.name } + }, + account: { + value: (record, params) => { return record.account } + }, + domainid: { + value: (record, params) => { return record.domainid } + } + } } ] }, @@ -327,14 +368,18 @@ export default { icon: 'plus', label: 'New Affinity Group', listView: true, - args: ['name', 'description', 'type'] + args: ['name', 'description', 'type'], + mapping: { + type: { + options: ['host anti-affinity', 'host affinity'] + } + } }, { api: 'deleteAffinityGroup', icon: 'delete', label: 'Delete Affinity Group', - dataView: true, - args: ['id'] + dataView: true } ] } diff --git a/ui/src/config/section/iam.js b/ui/src/config/section/iam.js index 2792080099e..aaca2bb027f 100644 --- a/ui/src/config/section/iam.js +++ b/ui/src/config/section/iam.js @@ -41,44 +41,40 @@ export default { icon: 'edit', label: 'label.edit', dataView: true, - args: ['id', 'username', 'email', 'firstname', 'lastname', 'timezone'] + args: ['username', 'email', 'firstname', 'lastname', 'timezone'] }, { api: 'updateUser', icon: 'key', label: 'Change Password', dataView: true, - args: ['id', 'currentpassword', 'password'] + args: ['currentpassword', 'password'] }, { api: 'registerUserKeys', icon: 'file-protect', label: 'Generate Keys', - dataView: true, - args: ['id'] + dataView: true }, { api: 'enableUser', icon: 'play-circle', label: 'Enable User', dataView: true, - show: (record) => { return record.state === 'disabled' }, - args: ['id'] + show: (record) => { return record.state === 'disabled' } }, { api: 'disableUser', icon: 'pause-circle', label: 'Disable User', dataView: true, - args: ['id'], show: (record) => { return record.state === 'enabled' } }, { api: 'deleteUser', icon: 'delete', label: 'Delete user', - dataView: true, - args: ['id'] + dataView: true } ] }, @@ -102,7 +98,7 @@ export default { icon: 'edit', label: 'label.update.account', dataView: true, - args: ['id', 'newname', 'domainid', 'roleid', 'networkdomain', 'details'] + args: ['newname', 'domainid', 'roleid', 'networkdomain', 'details'] }, { api: 'updateResourceCount', @@ -117,7 +113,6 @@ export default { label: 'Enable Account', dataView: true, show: (record) => { return record.state === 'disabled' || record.state === 'locked' }, - args: ['id'], params: { lock: 'false' } }, { @@ -126,7 +121,6 @@ export default { label: 'Disable Account', dataView: true, show: (record) => { return record.state === 'enabled' }, - args: ['id'], params: { lock: 'false' } }, { @@ -135,7 +129,7 @@ export default { label: 'Lock account', dataView: true, show: (record) => { return record.state === 'enabled' }, - args: ['id', 'lock'] + args: ['lock'] }, { api: 'deleteAccount', @@ -175,14 +169,19 @@ export default { icon: 'edit', label: 'label.action.edit.domain', dataView: true, - args: ['id', 'name', 'networkdomain'] + args: ['name', 'networkdomain'] }, { api: 'updateResourceCount', icon: 'sync', label: 'label.action.update.resource.count', dataView: true, - args: ['domainid'] + args: ['domainid'], + mapping: { + domainid: { + value: (record) => { return record.id } + } + } }, { api: 'deleteDomain', @@ -190,7 +189,7 @@ export default { label: 'label.delete.domain', dataView: true, show: (record) => { return record.level !== 0 }, - args: ['id', 'cleanup'] + args: ['cleanup'] } ] }, @@ -214,14 +213,13 @@ export default { icon: 'edit', label: 'Edit Role', dataView: true, - args: ['id', 'name', 'description', 'type'] + args: ['name', 'description', 'type'] }, { api: 'deleteRole', icon: 'delete', label: 'label.delete.role', - dataView: true, - args: ['id'] + dataView: true } ] } diff --git a/ui/src/config/section/image.js b/ui/src/config/section/image.js index 04fec8b9c6c..3a614f8f0f6 100644 --- a/ui/src/config/section/image.js +++ b/ui/src/config/section/image.js @@ -65,34 +65,34 @@ export default { icon: 'edit', label: 'label.edit', dataView: true, - args: ['id', 'name', 'displaytext', 'passwordenabled', 'sshkeyenabled', 'ostypeid', 'isdynamicallyscalable', 'isrouting'] + args: ['name', 'displaytext', 'passwordenabled', 'sshkeyenabled', 'ostypeid', 'isdynamicallyscalable', 'isrouting'] }, { api: 'extractTemplate', icon: 'cloud-download', label: 'Download Template', dataView: true, - args: ['id', 'zoneid', 'mode'] + args: ['zoneid', 'mode'] }, { api: 'updateTemplatePermissions', icon: 'reconciliation', label: 'Update template permissions', dataView: true, - args: ['id', 'op', 'accounts', 'projectids'] + args: ['op', 'accounts', 'projectids'] }, { api: 'copyTemplate', icon: 'copy', label: 'Copy Template', - args: ['id', 'sourcezoneid', 'destzoneids'], + args: ['sourcezoneid', 'destzoneids'], dataView: true }, { api: 'deleteTemplate', icon: 'delete', label: 'Delete Template', - args: ['id', 'zoneid'], + args: ['zoneid'], dataView: true, groupAction: true } @@ -133,34 +133,34 @@ export default { icon: 'edit', label: 'label.edit', dataView: true, - args: ['id', 'name', 'displaytext', 'bootable', 'ostypeid', 'isdynamicallyscalable', 'isrouting'] + args: ['name', 'displaytext', 'bootable', 'ostypeid', 'isdynamicallyscalable', 'isrouting'] }, { api: 'extractIso', icon: 'cloud-download', label: 'Download ISO', dataView: true, - args: ['id', 'zoneid', 'mode'] + args: ['zoneid', 'mode'] }, { api: 'updateIsoPermissions', icon: 'reconciliation', label: 'Update ISO Permissions', dataView: true, - args: ['id', 'op', 'accounts', 'projectids'] + args: ['op', 'accounts', 'projectids'] }, { api: 'copyIso', icon: 'copy', label: 'Copy ISO', - args: ['id', 'sourcezoneid', 'destzoneids'], + args: ['sourcezoneid', 'destzoneids'], dataView: true }, { api: 'deleteIso', icon: 'delete', label: 'Delete ISO', - args: ['id', 'zoneid'], + args: ['zoneid'], dataView: true, groupAction: true } diff --git a/ui/src/config/section/infra/clusters.js b/ui/src/config/section/infra/clusters.js index 79ad842c77c..ae9e8d74d6d 100644 --- a/ui/src/config/section/infra/clusters.js +++ b/ui/src/config/section/infra/clusters.js @@ -40,7 +40,6 @@ export default { icon: 'pause-circle', label: 'label.action.enable.cluster', dataView: true, - args: ['id'], defaultArgs: { allocationstate: 'Disabled' }, show: (record) => { return record.allocationstate === 'Enabled' } }, @@ -49,7 +48,6 @@ export default { icon: 'play-circle', label: 'label.action.disable.cluster', dataView: true, - args: ['id'], defaultArgs: { allocationstate: 'Enabled' }, show: (record) => { return record.allocationstate === 'Disabled' } }, @@ -74,7 +72,6 @@ export default { icon: 'plus-square', label: 'Manage Cluster', dataView: true, - args: ['id'], defaultArgs: { managedstate: 'Managed' }, show: (record) => { return record.clustertype === 'CloudManaged' && ['PrepareUnmanaged', 'Unmanaged'].includes(record.state) } }, @@ -83,7 +80,6 @@ export default { icon: 'minus-square', label: 'Unmanage Cluster', dataView: true, - args: ['id'], defaultArgs: { managedstate: 'Unmanaged' }, show: (record) => { return record.clustertype === 'CloudManaged' && record.state === 'Enabled' } }, @@ -135,8 +131,7 @@ export default { api: 'deleteCluster', icon: 'delete', label: 'label.action.delete.cluster', - dataView: true, - args: ['id'] + dataView: true } ] } diff --git a/ui/src/config/section/infra/hosts.js b/ui/src/config/section/infra/hosts.js index 5c631779f4a..64c1cbc1308 100644 --- a/ui/src/config/section/infra/hosts.js +++ b/ui/src/config/section/infra/hosts.js @@ -42,7 +42,7 @@ export default { icon: 'edit', label: 'label.edit', dataView: true, - args: ['id', 'hosttags', 'oscategoryid'] + args: ['hosttags', 'oscategoryid'] }, { api: 'provisionCertificate', @@ -57,7 +57,6 @@ export default { icon: 'forward', label: 'label.action.force.reconnect', dataView: true, - args: ['id'], show: (record) => { return ['Disconnected', 'Up'].includes(record.state) } }, { @@ -65,7 +64,6 @@ export default { icon: 'pause-circle', label: 'Disable Host', dataView: true, - args: ['id'], defaultArgs: { allocationstate: 'Disable' }, show: (record) => { return record.resourcestate === 'Enabled' } }, @@ -74,7 +72,6 @@ export default { icon: 'play-circle', label: 'Enable Host', dataView: true, - args: ['id'], defaultArgs: { allocationstate: 'Enable' }, show: (record) => { return record.resourcestate === 'Disabled' } }, @@ -99,7 +96,6 @@ export default { icon: 'plus-square', label: 'label.action.enable.maintenance.mode', dataView: true, - args: ['id'], show: (record) => { return record.resourcestate === 'Enabled' } }, { @@ -107,7 +103,6 @@ export default { icon: 'minus-square', label: 'label.action.cancel.maintenance.mode', dataView: true, - args: ['id'], show: (record) => { return record.resourcestate === 'Maintenance' || record.resourcestate === 'ErrorInMaintenance' || record.resourcestate === 'PrepareForMaintenance' } }, { @@ -195,7 +190,7 @@ export default { icon: 'delete', label: 'Remove Host', dataView: true, - args: ['id', 'forced'], + args: ['forced'], show: (record) => { return ['Maintenance', 'Disabled', 'Down', 'Alert', 'Disconnected'].includes(record.resourcestate) } } ] diff --git a/ui/src/config/section/infra/pods.js b/ui/src/config/section/infra/pods.js index 04aa26e68d5..23b80e4d2f2 100644 --- a/ui/src/config/section/infra/pods.js +++ b/ui/src/config/section/infra/pods.js @@ -44,7 +44,7 @@ export default { icon: 'edit', label: 'label.edit', dataView: true, - args: ['id', 'name', 'netmask', 'gateway'] + args: ['name', 'netmask', 'gateway'] }, { api: 'dedicatePod', @@ -67,7 +67,6 @@ export default { icon: 'play-circle', label: 'label.action.enable.pod', dataView: true, - args: ['id'], show: (record) => { return record.allocationstate === 'Disabled' } }, { @@ -75,7 +74,6 @@ export default { icon: 'pause-circle', label: 'label.action.disable.pod', dataView: true, - args: ['id'], show: (record) => { return record.allocationstate === 'Enabled' }, defaultArgs: { allocationstate: 'Disabled' } }, @@ -83,8 +81,7 @@ export default { api: 'deletePod', icon: 'delete', label: 'label.action.delete.pod', - dataView: true, - args: ['id'] + dataView: true } ] } diff --git a/ui/src/config/section/infra/primaryStorages.js b/ui/src/config/section/infra/primaryStorages.js index bab4a9176f2..bff25214638 100644 --- a/ui/src/config/section/infra/primaryStorages.js +++ b/ui/src/config/section/infra/primaryStorages.js @@ -40,14 +40,13 @@ export default { icon: 'edit', label: 'label.edit', dataView: true, - args: ['id', 'tags', 'capacitybytes', 'capacityiops'] + args: ['tags', 'capacitybytes', 'capacityiops'] }, { api: 'enableStorageMaintenance', icon: 'plus-square', label: 'label.action.enable.maintenance.mode', dataView: true, - args: ['id'], show: (record) => { return ['Up', 'Connecting', 'Down', 'ErrorInMaintenance'].includes(record.state) } }, { @@ -55,7 +54,6 @@ export default { icon: 'minus-square', label: 'label.action.cancel.maintenance.mode', dataView: true, - args: ['id'], show: (record) => { return ['Maintenance', 'PrepareForMaintenance', 'ErrorInMaintenance'].includes(record.state) } }, { @@ -63,7 +61,7 @@ export default { icon: 'delete', label: 'label.action.delete.primary.storage', dataView: true, - args: ['id', 'forced'], + args: ['forced'], show: (record) => { return !(record.state === 'Down' || record.state === 'Alert' || record.state === 'Maintenance' || record.state === 'Disconnected') } } ] diff --git a/ui/src/config/section/infra/routers.js b/ui/src/config/section/infra/routers.js index 07377d0bff6..f3631bb1319 100644 --- a/ui/src/config/section/infra/routers.js +++ b/ui/src/config/section/infra/routers.js @@ -28,7 +28,6 @@ export default { icon: 'caret-right', label: 'label.action.start.router', dataView: true, - args: ['id'], show: (record) => { return record.state === 'Stopped' } }, { @@ -36,7 +35,7 @@ export default { icon: 'stop', label: 'label.action.stop.router', dataView: true, - args: ['id', 'forced'], + args: ['forced'], show: (record) => { return record.state === 'Running' } }, { @@ -44,7 +43,6 @@ export default { icon: 'sync', label: 'label.action.reboot.router', dataView: true, - args: ['id'], hidden: (record) => { return record.state === 'Running' } }, { @@ -52,8 +50,8 @@ export default { icon: 'arrows-alt', label: 'label.change.service.offering', dataView: true, - args: ['id', 'serviceofferingid'], - show: (record) => { return record.state === 'Stopped' || record.hypervisor === 'VMWare' } + args: ['serviceofferingid'], + show: (record) => { return record.hypervisor !== 'KVM' } }, { api: 'upgradeRouterTemplate', @@ -61,7 +59,6 @@ export default { label: 'label.upgrade.router.newer.template', dataView: true, groupAction: true, - args: ['id'], show: (record) => { return record.requiresupgrade } }, { @@ -85,7 +82,6 @@ export default { icon: 'delete', label: 'label.destroy.router', dataView: true, - args: ['id'], show: (record) => { return ['Running', 'Error', 'Stopped'].includes(record.state) } } ] diff --git a/ui/src/config/section/infra/secondaryStorages.js b/ui/src/config/section/infra/secondaryStorages.js index 4b9861f543e..3b8141180b1 100644 --- a/ui/src/config/section/infra/secondaryStorages.js +++ b/ui/src/config/section/infra/secondaryStorages.js @@ -34,8 +34,7 @@ export default { api: 'deleteImageStore', icon: 'delete', label: 'label.action.delete.secondary.storage', - dataView: true, - args: ['id'] + dataView: true } ] } diff --git a/ui/src/config/section/infra/systemVms.js b/ui/src/config/section/infra/systemVms.js index 4aaaf0e3f39..3c87da07383 100644 --- a/ui/src/config/section/infra/systemVms.js +++ b/ui/src/config/section/infra/systemVms.js @@ -28,7 +28,6 @@ export default { icon: 'caret-right', label: 'label.action.start.systemvm', dataView: true, - args: ['id'], show: (record) => { return record.state === 'Stopped' } }, { @@ -36,7 +35,6 @@ export default { icon: 'stop', label: 'label.action.stop.systemvm', dataView: true, - args: ['id'], show: (record) => { return record.state === 'Running' } }, { @@ -44,7 +42,6 @@ export default { icon: 'sync', label: 'label.action.reboot.systemvm', dataView: true, - args: ['id'], show: (record) => { return record.state === 'Running' } }, { @@ -52,8 +49,8 @@ export default { icon: 'arrows-alt', label: 'label.change.service.offering', dataView: true, - args: ['id', 'serviceofferingid'], - show: (record) => { return record.hypervisor === 'VMWare' || record.state === 'Stopped' } + args: ['serviceofferingid'], + show: (record) => { return record.hypervisor !== 'KVM' } }, { api: 'migrateSystemVm', @@ -76,7 +73,6 @@ export default { icon: 'delete', label: 'label.action.destroy.systemvm', dataView: true, - args: ['id'], show: (record) => { return ['Running', 'Error', 'Stopped'].includes(record.state) } } ] diff --git a/ui/src/config/section/infra/zones.js b/ui/src/config/section/infra/zones.js index cf403927316..4d8edb01fae 100644 --- a/ui/src/config/section/infra/zones.js +++ b/ui/src/config/section/infra/zones.js @@ -57,7 +57,7 @@ export default { icon: 'edit', label: 'Edit Zone', dataView: true, - args: ['id', 'name', 'dns1', 'dns2', 'ip6dns1', 'ip6dns2', 'internaldns1', 'internaldns2', 'guestcidraddress', 'domain', 'localstorageenabled'], + args: ['name', 'dns1', 'dns2', 'ip6dns1', 'ip6dns2', 'internaldns1', 'internaldns2', 'guestcidraddress', 'domain', 'localstorageenabled'], show: (record) => { return record.networktype === 'Advanced' } }, { @@ -65,7 +65,7 @@ export default { icon: 'edit', label: 'Edit Zone', dataView: true, - args: ['id', 'name', 'dns1', 'dns2', 'ip6dns1', 'ip6dns2', 'internaldns1', 'internaldns2', 'domain', 'localstorageenabled'], + args: ['name', 'dns1', 'dns2', 'ip6dns1', 'ip6dns2', 'internaldns1', 'internaldns2', 'domain', 'localstorageenabled'], show: (record) => { return record.networktype === 'Basic' } }, { @@ -73,7 +73,6 @@ export default { icon: 'pause-circle', label: 'label.action.disable.zone', dataView: true, - args: ['id'], defaultArgs: { allocationstate: 'Disabled' }, show: (record) => { return record.allocationstate === 'Enabled' } }, @@ -82,7 +81,6 @@ export default { icon: 'play-circle', label: 'label.action.enable.zone', dataView: true, - args: ['id'], defaultArgs: { allocationstate: 'Enabled' }, show: (record) => { return record.allocationstate === 'Disabled' } }, @@ -174,8 +172,7 @@ export default { api: 'deleteZone', icon: 'delete', label: 'label.action.delete.zone', - dataView: true, - args: ['id'] + dataView: true } ] } diff --git a/ui/src/config/section/network.js b/ui/src/config/section/network.js index dda00a01c06..874f3944002 100644 --- a/ui/src/config/section/network.js +++ b/ui/src/config/section/network.js @@ -58,20 +58,19 @@ export default { icon: 'edit', label: 'Update Network', dataView: true, - args: ['id', 'name', 'displaytext', 'guestvmcidr'] + args: ['name', 'displaytext', 'guestvmcidr'] }, { api: 'restartNetwork', icon: 'sync', label: 'Restart Network', dataView: true, - args: ['id', 'makeredundant', 'cleanup'] + args: ['makeredundant', 'cleanup'] }, { api: 'deleteNetwork', icon: 'delete', label: 'Delete Network', - args: ['id'], dataView: true } ] @@ -109,20 +108,19 @@ export default { icon: 'edit', label: 'Update VPC', dataView: true, - args: ['id', 'name', 'displaytext'] + args: ['name', 'displaytext'] }, { api: 'restartVPC', icon: 'sync', label: 'Restart VPC', dataView: true, - args: ['id', 'makeredundant', 'cleanup'] + args: ['makeredundant', 'cleanup'] }, { api: 'deleteVPC', icon: 'delete', label: 'Delete VPC', - args: ['id'], dataView: true } ] @@ -157,7 +155,6 @@ export default { api: 'deleteSecurityGroup', icon: 'delete', label: 'Delete Security Group', - args: ['id'], dataView: true, show: (record) => { return record.name !== 'default' } } @@ -223,7 +220,6 @@ export default { api: 'disassociateIpAddress', icon: 'delete', label: 'Delete IP', - args: ['id'], dataView: true, show: (record) => { return !record.issourcenat } } diff --git a/ui/src/config/section/offering.js b/ui/src/config/section/offering.js index 5c17dc35711..b629530db5a 100644 --- a/ui/src/config/section/offering.js +++ b/ui/src/config/section/offering.js @@ -45,13 +45,12 @@ export default { icon: 'edit', label: 'Edit Offering', dataView: true, - args: ['id', 'name', 'displaytext'] + args: ['name', 'displaytext'] }, { api: 'deleteServiceOffering', icon: 'delete', label: 'Delete Offering', - dataView: true, - args: ['id'] + dataView: true }] }, { @@ -76,14 +75,13 @@ export default { label: 'Edit Offering', dataView: true, params: { issystem: 'true' }, - args: ['id', 'name', 'displaytext'] + args: ['name', 'displaytext'] }, { api: 'deleteServiceOffering', icon: 'delete', label: 'Delete Offering', dataView: true, - params: { issystem: 'true' }, - args: ['id'] + params: { issystem: 'true' } }] }, { @@ -110,13 +108,12 @@ export default { icon: 'edit', label: 'Edit Offering', dataView: true, - args: ['id', 'name', 'displaytext'] + args: ['name', 'displaytext'] }, { api: 'deleteDiskOffering', icon: 'delete', label: 'Delete Offering', - dataView: true, - args: ['id'] + dataView: true }] }, { @@ -138,13 +135,12 @@ export default { icon: 'edit', label: 'Edit Offering', dataView: true, - args: ['id', 'name', 'displaytext', 'availability'] + args: ['name', 'displaytext', 'availability'] }, { api: 'deleteNetworkOffering', icon: 'delete', label: 'Delete Offering', - dataView: true, - args: ['id'] + dataView: true }] }, { @@ -172,13 +168,12 @@ export default { icon: 'edit', label: 'Edit Offering', dataView: true, - args: ['id', 'name', 'displaytext'] + args: ['name', 'displaytext'] }, { api: 'deleteVPCOffering', icon: 'delete', label: 'Delete Offering', - dataView: true, - args: ['id'] + dataView: true }] } ] diff --git a/ui/src/config/section/project.js b/ui/src/config/section/project.js index e5155ff5712..1f2b033d28e 100644 --- a/ui/src/config/section/project.js +++ b/ui/src/config/section/project.js @@ -36,14 +36,13 @@ export default { icon: 'edit', label: 'Edit Project', dataView: true, - args: ['id', 'displaytext'] + args: ['displaytext'] }, { api: 'activateProject', icon: 'play-circle', label: 'Activate Project', dataView: true, - args: ['id'], show: (record) => { return record.state === 'Suspended' } }, { @@ -51,7 +50,6 @@ export default { icon: 'pause-circle', label: 'Suspend Project', dataView: true, - args: ['id'], show: (record) => { return record.state !== 'Suspended' } }, { @@ -65,8 +63,7 @@ export default { api: 'deleteProject', icon: 'delete', label: 'Delete Project', - dataView: true, - args: ['id'] + dataView: true } ] } diff --git a/ui/src/config/section/storage.js b/ui/src/config/section/storage.js index dccb7828e72..48e229899b0 100644 --- a/ui/src/config/section/storage.js +++ b/ui/src/config/section/storage.js @@ -60,7 +60,7 @@ export default { api: 'attachVolume', icon: 'paper-clip', label: 'Attach Volume', - args: ['id', 'virtualmachineid'], + args: ['virtualmachineid'], dataView: true, show: (record) => { return !('virtualmachineid' in record) } }, @@ -68,7 +68,6 @@ export default { api: 'detachVolume', icon: 'link', label: 'Detach Volume', - args: ['id'], dataView: true, show: (record) => { return 'virtualmachineid' in record && record.virtualmachineid } }, @@ -76,25 +75,37 @@ export default { api: 'createSnapshot', icon: 'camera', label: 'Take Snapshot', - args: ['volumeid', 'name', 'asyncbackup', 'tags'], dataView: true, - show: (record) => { return record.state === 'Ready' } + show: (record) => { return record.state === 'Ready' }, + args: ['volumeid', 'name', 'asyncbackup', 'tags'], + mapping: { + volumeid: { + value: (record) => { return record.id } + } + } }, { api: 'createSnapshotPolicy', icon: 'video-camera', label: 'Recurring Snapshots', - args: ['volumeid', 'schedule', 'timezone', 'intervaltype', 'maxsnaps'], dataView: true, - show: (record) => { return record.state === 'Ready' } + show: (record) => { return record.state === 'Ready' }, + args: ['volumeid', 'intervaltype', 'schedule', 'maxsnaps', 'timezone'], + mapping: { + volumeid: { + value: (record) => { return record.id } + }, + intervaltype: { + options: ['HOURLY', 'DAILY', 'WEEKLY', 'MONTHLY'] + } + } }, { api: 'resizeVolume', icon: 'fullscreen', label: 'Resize Volume', - type: 'main', - args: ['id', 'virtualmachineid'], - dataView: true + dataView: true, + args: ['size'] }, { api: 'migrateVolume', @@ -102,19 +113,30 @@ export default { label: 'Migrate Volume', args: ['volumeid', 'storageid', 'livemigrate'], dataView: true, - show: (record) => { return 'virtualmachineid' in record && record.virtualmachineid } + show: (record) => { return 'virtualmachineid' in record && record.virtualmachineid }, + mapping: { + volumeid: { + value: (record) => { return record.id } + }, + storageid: { + api: 'listStoragePools' + } + } }, { api: 'extractVolume', icon: 'cloud-download', label: 'Download Volume', - args: ['id', 'zoneid', 'mode'], - paramOptions: { + dataView: true, + args: ['zoneid', 'mode'], + mapping: { + zoneid: { + value: (record) => { return record.zoneid } + }, mode: { - value: 'HTTP_DOWNLOAD' + value: (record) => { return 'HTTP_DOWNLOAD' } } - }, - dataView: true + } }, { api: 'createTemplate', @@ -128,7 +150,6 @@ export default { api: 'deleteVolume', icon: 'delete', label: 'Delete Volume', - args: ['id'], dataView: true, groupAction: true } @@ -148,28 +169,36 @@ export default { icon: 'plus', label: 'Create volume', dataView: true, - args: ['snapshotid', 'name'] + args: ['snapshotid', 'name'], + mapping: { + snapshotid: { + value: (record) => { return record.id } + } + } }, { api: 'createTemplate', icon: 'picture', label: 'Create volume', dataView: true, - args: ['snapshotid', 'name', 'displaytext', 'ostypeid', 'ispublic', 'isfeatured', 'isdynamicallyscalable', 'requireshvm', 'passwordenabled', 'sshkeyenabled'] + args: ['snapshotid', 'name', 'displaytext', 'ostypeid', 'ispublic', 'isfeatured', 'isdynamicallyscalable', 'requireshvm', 'passwordenabled', 'sshkeyenabled'], + mapping: { + snapshotid: { + value: (record) => { return record.id } + } + } }, { api: 'revertSnapshot', icon: 'sync', label: 'Revert Snapshot', - dataView: true, - args: ['id'] + dataView: true }, { api: 'deleteSnapshot', icon: 'delete', label: 'Delete Snapshot', - dataView: true, - args: ['id'] + dataView: true } ] }, @@ -187,14 +216,24 @@ export default { icon: 'sync', label: 'Revert VM snapshot', dataView: true, - args: ['vmsnapshotid'] + args: ['vmsnapshotid'], + mapping: { + vmsnapshotid: { + value: (record) => { return record.id } + } + } }, { api: 'deleteVMSnapshot', icon: 'delete', label: 'Delete VM Snapshot', dataView: true, - args: ['vmsnapshotid'] + args: ['vmsnapshotid'], + mapping: { + vmsnapshotid: { + value: (record) => { return record.id } + } + } } ] } diff --git a/ui/src/views/AutogenView.vue b/ui/src/views/AutogenView.vue index 59bd8196c89..8fd7a3fdd67 100644 --- a/ui/src/views/AutogenView.vue +++ b/ui/src/views/AutogenView.vue @@ -120,13 +120,12 @@ @submit="handleSubmit" layout="vertical" > - - + + + + {{ opt }} + + + + + + + {{ opt.name && opt.type ? opt.name + ' (' + opt.type + ')' : opt.name || opt.description }} + + +