diff --git a/ui/src/config/section/network.js b/ui/src/config/section/network.js index 70bfa925cfe..6f421987b0a 100644 --- a/ui/src/config/section/network.js +++ b/ui/src/config/section/network.js @@ -60,19 +60,6 @@ export default { popup: true, component: () => import('@/views/network/CreateNetwork.vue') }, - { - api: 'associateIpAddress', - icon: 'plus', - label: 'Acquire New IP', - dataView: true, - show: (record) => { return record && record.service && record.service.filter(x => x.name && ['StaticNat', 'SourceNat', 'Firewall', 'PortForwarding', 'Lb'].includes(x.name)).length > 0 }, - args: ['networkid'], - mapping: { - networkid: { - value: (record) => { return record.id } - } - } - }, { api: 'updateNetwork', icon: 'edit', diff --git a/ui/src/views/AutogenView.vue b/ui/src/views/AutogenView.vue index 3b53a44f241..de44650898e 100644 --- a/ui/src/views/AutogenView.vue +++ b/ui/src/views/AutogenView.vue @@ -559,6 +559,9 @@ export default { } } this.currentAction.loading = false + if (action.dataView && action.icon === 'edit') { + this.fillEditFormFieldValues() + } }, listUuidOpts (param) { if (this.currentAction.mapping && param.name in this.currentAction.mapping && !this.currentAction.mapping[param.name].api) { @@ -641,6 +644,22 @@ export default { action }) }, + fillEditFormFieldValues () { + const form = this.form + this.currentAction.paramFields.map(field => { + let fieldValue = null + let fieldName = null + if (field.type === 'uuid' || field.type === 'list' || field.name === 'account' || (this.currentAction.mapping && field.name in this.currentAction.mapping)) { + fieldName = field.name.replace('ids', 'name').replace('id', 'name') + } else { + fieldName = field.name + } + fieldValue = this.resource[fieldName] ? this.resource[fieldName] : null + if (fieldValue) { + form.getFieldDecorator(field.name, { initialValue: fieldValue }) + } + }) + }, handleSubmit (e) { e.preventDefault() this.form.validateFields((err, values) => {